Project

Profile

Help

Bug #6381 » JavaDefaultNamespaceTest1.java

Martin Honnen, 2024-03-31 14:45

 
import net.sf.saxon.s9api.*;

import java.io.File;

public class JavaDefaultNamespaceTest1 {
public static void main(String[] args) throws SaxonApiException {
Processor processor = new Processor();

System.out.println(processor.getSaxonProductVersion());

XPathCompiler xpathProcessor = processor.newXPathCompiler();

xpathProcessor.setUnprefixedElementMatchingPolicy(UnprefixedElementMatchingPolicy.ANY_NAMESPACE);

DocumentBuilder docBuilder = processor.newDocumentBuilder();

XdmNode doc = docBuilder.build(new File("sample1.xml"));

System.out.println(xpathProcessor.evaluate("/root/foo", doc));

doc = docBuilder.build(new File("sample2.xml"));

System.out.println(xpathProcessor.evaluate("/root/foo", doc));
}

}
(2-2/4)