Skip to Content.
Sympa Menu

xom-interest - Re: [XOM-interest] XOM enforces whitespace for xpath text() expression

xom-interest AT lists.ibiblio.org

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: "Pieper, Aaron" <PieperA AT Pragmatics.com>
  • To: "XOM API for Processing XML with Java" <xom-interest AT lists.ibiblio.org>
  • Subject: Re: [XOM-interest] XOM enforces whitespace for xpath text() expression
  • Date: Mon, 23 May 2011 19:49:55 -0400

>> <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.

That's right. Like I said in my original message, I think XOM is doing
the right thing here. You've added a sprinkling of hyperbole to my
original statement, but we're in agreement.

It sounds like you strongly believe that the idea of normalizing a
document (getting rid of whitespace) is dangerous, and that Xom
shouldn't encourage it. Some other frameworks facilitate this with
methods like Dom4J's builder.setStripWhitespaceText() method, or JDom's
Format.TextMode class, so I was surprised at first when XOM didn't offer
similar out-of-the-box functionality. But, I understand why XOM doesn't
want to go in that direction. It sounds like if someone is writing code
which is dependent on whitespace stripping, they should either avoid
XOM, or they should continue implementing their own NormalizingFactory.

- Aaron




Archive powered by MHonArc 2.6.24.

Top of Page