You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@xerces.apache.org by Troy Benson <tt...@altavista.com> on 2000/03/10 16:50:24 UTC

whitespace in attributes

I'm just beginning to learn about XML. I've been looking at Xerces-C v.1.0.1,
and have a question concerning whitespace in attribute values. Is whitespace
allowed for all attribute values or only for certain types of attributes? I have
an example like the following:

<recipe name="French Toast">

In the dtd file, name is specified as an ID. When I try running the sample
program, DOMCount on this XML file, I get an error that attribute name
does not support multiple values. I've tried running this XML file with a Java
parser as well, and I don't receive such an error. What is the correct 
implementation of the XML specification. Thanks.

Troy

____________________________________________________________________

For the largest MP3 index on the Web, go to http://mp3.altavista.com

____________________________________________________________________


Re: whitespace in attributes

Posted by Andy Clark <an...@apache.org>.
Troy Benson wrote:
> <recipe name="French Toast">
> 
> In the dtd file, name is specified as an ID. When I try running the sample
> program, DOMCount on this XML file, I get an error that attribute name
> does not support multiple values. I've tried running this XML file with a Java
> parser as well, and I don't receive such an error. What is the correct
> implementation of the XML specification. Thanks.

The XML Specification defines values of type ID to follow the
same rules as NMTOKEN with the restriction that the value be
unique within the document. Therefore, you are not allowed to
have a space in your ID values.

As for not getting an error in the Java parser, you *must*
register an error handler or else you will not receive 
notification of the error. But the parser does correctly
detect the error.

-- 
Andy Clark * IBM, JTC - Silicon Valley * andyc@apache.org