Altova Mailing List Archives>Archive Index >microsoft.public.xml Archive Home >Recent entries [Thread Prev] >Thread Next - Re: XPathDocument and significant whitespace XPathDocument and significant whitespaceTo: NULL Date: 12/4/2005 4:35:00 AM Why doesn't XPathDocument(validatingReader, XmlSpace.Default) preserve *all* the significant whitespace returned by the specified XmlValidatingReader (.NET Framework 1.1)? For example: <!DOCTYPE p [ <!ELEMENT p (#PCDATA | b | i)*> <!ELEMENT b (#PCDATA)> <!ELEMENT i (#PCDATA)> ]> <p>Here is <b>bold</b> <i>italic</i> text.</p> The DTD says the <p> element contains mixed content, so when XmlValidatingReader reads this document, the XmlNodeType of the space between "</b>" and "<i>" is XmlNodeType.SignificantWhitespace. But the space is discarded by XPathDocument -- its private ReadChildNodes method treats significant whitespace as regular whitespace (which is then discarded) if the reader's XmlSpace property is anything but XmlSpace.Preserve. Why does XPathDocument make this extra check for xml:space="preserve"? (Since I don't want to put xml:space attributes all over the place in my documents, I'm going to pass XmlSpace.Preserve as the second argument to the XPathDocument constructor instead of XmlSpace.Default. But I'd still like to understand this behavior.) Michael | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
