et's say I have the following xml file within namspace (i am not
including it below)
<info>
<item>
<id>566</id>
............
</item>
<item>
<id>665</id>
............
</item>
<item>
<id>675</id>
............
</item>
</info>
I want to extract each< item> in its entirity; thus, in above, I want
to create 3 files names 566.xml, 655.xml: that is named after id in
each item, and
each containing just
<item>
............
</item>
.I tried using xpath didnt help, not sure how to readof the actual
tags.
Raymond DeCampo - 19 Feb 2006 18:53 GMT
> et's say I have the following xml file within namspace (i am not
> including it below)
[quoted text clipped - 26 lines]
> .I tried using xpath didnt help, not sure how to readof the actual
> tags.
Probably the best approach here is to use the DOM to create the new
documents. There are methods (the exact names escape me at the moment)
to clone or copy elements from one document to another. Then the
problem is getting a text representation of the new documents. For some
reason there is not a direct way of doing this. The best way is to use
the javax.transform.Transformer class with a trivial transform and a
StreamResult pointing to your file.
HTH,
Ray

Signature
This signature intentionally left blank.