xom-interest AT lists.ibiblio.org
Subject: XOM API for Processing XML with Java
List archive
Re: [XOM-interest] XOM enforces whitespace for xpath text() expression
- From: Michael Kay <mike AT saxonica.com>
- To: xom-interest AT lists.ibiblio.org
- Subject: Re: [XOM-interest] XOM enforces whitespace for xpath text() expression
- Date: Tue, 24 May 2011 00:06:43 +0100
On 23/05/2011 23:19, Pieper, Aaron wrote:
Hello,
I am working on some unit tests which use XPath to draw assertions on a
document. I encountered some surprising behavior, when evaluating the
following document.
<endpoint>
<service>getData
<errors/>
</service>
</endpoint>
The XPath expression /endpoint/service[text()='getData'] returns a
single node in some XML frameworks (like Dom4J)
That's outrageously wrong. Gratuitously removing whitespace in mixed content can have no possible excuse. It's not a violation of the XPath spec, which allows you to construct the input tree any way you like, but it's totally against the accepted semantics of XML.
Even if it weren't mixed content, for example <service> getData </service>, it would be highly questionable. It would be justified only if there's a schema that tells you something about the data type of the service element.
Michael Kay
Saxonica
-
[XOM-interest] XOM enforces whitespace for xpath text() expression,
Pieper, Aaron, 05/23/2011
-
Re: [XOM-interest] XOM enforces whitespace for xpath text() expression,
Michael Kay, 05/23/2011
- Re: [XOM-interest] XOM enforces whitespace for xpath text() expression, Pieper, Aaron, 05/23/2011
-
Re: [XOM-interest] XOM enforces whitespace for xpath text() expression,
Michael Kay, 05/23/2011
Archive powered by MHonArc 2.6.24.