[SoapRMI] XB1 XPath
Aleksander Slominski
aslom_at_cs.indiana.edu
Tue, 05 Apr 2005 10:56:10 -0500
Andy Harrison wrote:
> To clarify, I'm trying to take a chunk from one document to create
> another. I think I could use XPath to get the nodeset I want, then
> create a new document with just that nodeset.
>
> Xb1XPath xpath = new Xb1XPath("/path/to/my/nodeset");
> XmlDocumentImpl newdoc = new XmlDocumentImpl();
> newdoc.addChild(xpath.selectSingleNode(doc));
>
> Xb1XPath xpathinside = new Xb1XPath("/path/inside/my/snippet");
> Object myData = xpathinside.selectSingleNode(newdoc);
>
> The above code doesn't work becuse I can't seem to be able to create a
> XmlDocumentImpl. The constructor takes (string,boolean,string)
> arguments, but it's not working for me. Hopefully someone can help me
> achieve what I'm looking for though?
Andy,
when i am back from travel i will check this in details but in general
you should use builder.newDocument() (XmlInfosetBuilder)
then if you want process a fragment you can use XmlPullParser - position
it on STAR_TAG for fragment and call builder.parseFragment() then you
should be able to run XPath on this fragment, when you are finished with
this chunk XML move to next.
i believe that should allow you to get through very large XML documents
by processing it in chunks and be able to do XPath on each chunk.
is it what you want to do?
alek
--
The best way to predict the future is to invent it - Alan Kay