See section 3.3.3 of the XML specification. If I've read it correctly, parsers must strip leading and trailing whitespace and compress internal whitespace to a single space for attribute values declared as something other than CDATA. However, "All attributes for which no declaration has been read should be treated by a non-validating parser as if declared CDATA." If you're validating, declare the attribute as CDATA. If you're not validating, you can declare it as CDATA or not declare it at all.
Note that I'm basing all this on reading the spec, which I may be misinterpreting. I haven't tried it. -----Original Message----- From: Neil Sherman [mailto:[EMAIL PROTECTED]] Sent: Friday, December 14, 2001 5:08 AM To: '[EMAIL PROTECTED]' Subject: Reading attribute values with leading spaces Hi all, I have an attribute value that has leading spaces and I would like to maintain those leading spaces when I read in the value, but Xerces seems to strip the leading spaces from the string that I get back! i.e. <XMLTAG attribute=" value"></XMLTAG> I then obtain this attribute value with: string = attribs.getNamedItem("attribute").getNodeValue().transcode(); But what I get back is: "value" and NOT " value" Is there anyway around this? The obvious solution is to place a character at the front that can then be stripped off, thus retaining the spaces but I was wondering if there is a better solution ?? Many thanks Neil --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
