[SoapRMI] XB1 XPath

Andy Harrison andyh_at_agaricus.co.uk
Mon, 04 Apr 2005 14:51:54 +0100


Hi,

I've been looking at the sample given for XPath parsing in XPP3, a file 
called "Xb1XpathDemo.java".

*****
while ( resultsIter.hasNext() ) {
Object infosetItem = resultsIter.next();
System.out.println("----------------------------------"); 
System.out.println(builder.serializeToString(infosetItem));
}
*****

To get more utility from this, ie access to child nodes in the returned 
nodeset, do I just cast infosetItem to "XmlElementImpl"?

Also noticed that we are creating an XmlDocument from an 
XmlInfosetBuilder, does this mean we have loaded the entire doc into 
memory from the input stream? If this is the case, I only need to run 
XPath against a fixed part of my document, so is there a simple way to 
advance the input stream to the root node of the data that I wish to run 
  XPath expressions against?

*****
XmlInfosetBuilder builder = XmlInfosetBuilder.newInstance();
XmlDocument doc = builder.parseInputStream(in);
Xb1XPath xpath = new Xb1XPath("/body/div[2]");
*****

Finally, does anyone know any more examples or tutorials for using XB1 
and XPath?

thanks,
Andy