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 09:44:39 -0500

This release resulted in a surprising failure for me. I've been successfully
giving a prefix to the default namespace of a document using:

XPathContext context =
XPathContext.makeNamespaceContext(doc.getRootElement());
context.addNamespace("a", context.lookup(""));

This now fails because the lookup results in a null. Here's the test case.

package com.deere.axiom.rest.followpass;

import static org.junit.Assert.assertEquals;

import java.io.IOException;
import java.io.StringReader;

import nu.xom.Builder;
import nu.xom.Document;
import nu.xom.Nodes;
import nu.xom.ParsingException;
import nu.xom.ValidityException;
import nu.xom.XPathContext;

import org.junit.Test;


public class ERHTest {

// This test fails with
// nu.xom.XPathException: XPath error: Cannot resolve namespace
prefix 'a'
@Test
public void testNotWithNamespaceGenericLookup() throws
ValidityException, ParsingException, IOException {
Document doc = new Builder().build(new StringReader("<hi
xmlns='there://mr.space/alien'/>"));
XPathContext context =
XPathContext.makeNamespaceContext(doc.getRootElement());
context.addNamespace("a", context.lookup(""));
Nodes query = doc.query("//*[not(self::a:human)]", context);
assertEquals(1, query.size());
}

}

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: Saturday, May 12, 2012 4:12 PM
To: XOM interest
Subject: [XOM-interest] XOM 1.2.8 released

I've posted XOM 1.2.8 in the usual location:

http://www.xom.nu/

This release fixes several bugs in XPath processing that have shown up
in the last month or two, including a nasty incompatibility with Java
7 that could throw an IllegalArgumentException when evaluating
expression that select attributes with a union operator. If you use
XPath at all, I recommend you upgrade at your earliest convenience.

--
Elliotte Rusty Harold
elharo AT ibiblio.org
_______________________________________________
XOM-interest mailing list
XOM-interest AT lists.ibiblio.org
http://lists.ibiblio.org/mailman/listinfo/xom-interest




Archive powered by MHonArc 2.6.24.

Top of Page