Skip to Content.
Sympa Menu

xom-interest - Re: [XOM-interest] XOM 1.2.8 released

xom-interest AT lists.ibiblio.org

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: Regier Avery J <RegierAveryJ AT JohnDeere.com>
  • To: XOM API for Processing XML with Java <xom-interest AT lists.ibiblio.org>
  • Subject: Re: [XOM-interest] XOM 1.2.8 released
  • Date: Mon, 14 May 2012 15:11:03 -0500

Sorry, the previous was accidentally sent before I finished it.

I am quite happy that this now works:
@Test
public void testNotWithDefaultNamespace() throws ValidityException,
ParsingException, IOException {
Document doc = new Builder().build(new StringReader("<hi
xmlns='there://mr.space/alien'/>"));
XPathContext context =
XPathContext.makeNamespaceContext(doc.getRootElement());
Nodes query = doc.query("//*[not(self::human)]", context);
assertEquals(1, query.size());
}

> The prefixes in XPath expressions do not have to be the same as the
> prefixes (or lack thereof) in the queried document.

By this statement it seems that I should be able to create an alias for a
namespace that currently lacks one. Why make it hard?

> IN general, though, why would you want to do that? Outside of the true
> ugliness of HTML/XHTML, I've never really seen a need for writing one
> expression to apply regardless of namespaces.

My immediate use is to translate from a simplified syntax sent over URLs to
transform the document being returned from that URL. The client is always
giving the path in the namespace associated with the one document returned.
The service knows what those namespaces are.

I am specifically attempting to implement embed/fields for REST services as
presented in
REST API Design Rulebook by Mark Massé
(O'Reilly). Copyright 2012 Mark Massé, 978-1-449-31050-9
Chapter 6, pp 73-77, "Response Representation Composition"


I am working through trying to use the new XOM and make all my tests pass
again. It really threw a spanner in the works.


Avery J. Regier
RegierAveryJ AT JohnDeere.com


-----Original Message-----
From: xom-interest-bounces AT lists.ibiblio.org
[mailto:xom-interest-bounces AT lists.ibiblio.org] On Behalf Of Elliotte Rusty
Harold
Sent: Monday, May 14, 2012 12:49 PM
To: XOM API for Processing XML with Java
Subject: Re: [XOM-interest] XOM 1.2.8 released

As Michael surmised, that's a deliberate bug fix. You should no longer
need to bind anything to the default namespace.

--
Elliotte Rusty Harold
elharo AT ibiblio.org





Archive powered by MHonArc 2.6.24.

Top of Page