with the help of a java program i parsed that and queried and retrieved 3 out of 10.
now i want to convert this 3 node to a string
i wrote an function which used xsl transformers to convert but it accepts only document, and if i used Document d = node.getParentDocument() it returns the whole xml document and if i use
Document d = ( Document ) node;
it throws an exception classcastexception.
how to convert that xml node to a document so that i can pass it to my function which uses Xsl transformers to convert.
if there s any other method to do that please help by telling my that
thanking you
If you are using java then there is a obj.toString() method that you can apply at element/node level or another crude way of doing what you want is to create a new document and append the node to it and print it..
A Document is not a node in and of itself, which is why the caste fails, you need to call document.documentElement() to get the root node of your document, then you can use that to do what you want (but remember, it will be an element, not a node, so you will have to still caste it to type node).
Something like:
(node) d.documentElement();
should return the root of the doc as a node reference.
Bookmarks