[xml] non-quoted attributes invalid?

Date view Thread view Subject view Author view

From: Bryan E. Chafy (bchafy@ccs.neu.edu)
Date: Sun Nov 28 1999 - 15:03:42 EST


My xml file has some attributes without quotes:

<?xml version="1.0"?>
<!DOCTYPE client SYSTEM "client.dtd">
<image href="img.gif" HEIGHT=0 WIDTH=22/>

When I try to parse, I get:

test.xml:3: error: AttValue: " or ' expected
<image href="img.gif" HEIGHT=0 WIDTH=22/>
                             ^
test.xml:3: error: error parsing attribute name
<image href="img.gif" HEIGHT=0 WIDTH=22/>
                             ^
test.xml:3: error: xmlParseStartTag: problem parsing attributes
<image href="img.gif" HEIGHT=0 WIDTH=22/>
                             ^
test.xml:3: error: Couldn't find end of Start Tag
<image href="img.gif" HEIGHT=0
<image href="img.gif" HEIGHT=0 WIDTH=22/>
                             ^
test.xml:3: error: Extra content at the end of the document
<image href="img.gif" HEIGHT=0 WIDTH=22/>

When I looked at xmlParseAttValue, it looks like it does not check for
unquoted attrubutes (numerical). Maybee add something like:

   if (CUR == '"') { ... }
   else if (CUR == '\'') { ... }
   else if (CUR == "-" || (int)CUR ==atoi(CUR)){ // if not quoted, maybee a numerical value?
     ctxt->instate = XML_PARSER_ATTRIBUTE_VALUE;
      NEXT;
      ret = xmlDecodeEntities(ctxt, -1, XML_SUBSTITUTE_REF, ' ', '<', 0);
     ...
     } else { ... }
// not tested

Also, why is libxml called the xml library for gnome? What's so
gnome about it? It looks like a generic XML DOM/SAX parser usefull for
things other than just gnome.

Bryan

----
Message from the list xml@rufus.w3.org
Archived at : http://rufus.w3.org/veillard/XML/messages
to unsubscribe: echo "unsubscribe xml" | mail  majordomo@rufus.w3.org


Date view Thread view Subject view Author view

This archive was generated by hypermail 2b29 : Wed Aug 02 2000 - 12:29:53 EDT