importNode content not able to see in xml editor

wxdqz

New Member
Hi
My requirment is to copy the portion of the incoming xml into another xml file.

i used following code to copy from incoming xml into another xml.


lDocumentBuilFactory = DocumentBuilderFactory.newInstance();
lIncomingFeedDocBuilder = lDocumentBuilFactory.newDocumentBuilder();
lNewFeedDocBuilder = lDocumentBuilFactory.newDocumentBuilder();
lIncomingFeedDocument = lIncomingFeedDocBuilder.parse(new FileInputStream(
lIncomingFeePath));
lNewFeedDocument = lNewFeedDocBuilder.newDocument();
Element lElement = (Element) lNewFeedDocument.importNode(lIncomingFeedDocument.getElementsByTagName(
"content").item(0), true);
lNewFeedDocument.appendChild(lElement);
lNewFile = new File(lDestinationFile);
lNewFileOutStrearm = new FileOutputStream(lNewFile);
lNewFilePW = new PrintWriter(lNewFileOutStrearm);
lTransformerFactory = TransformerFactory.newInstance();
lTranfrmNewDocToFile = lTransformerFactory.newTransformer();
lTranfrmNewDocToFile.transform(new DOMSource(lNewFeedDocument),
new StreamResult(lNewFilePW));


able to copy it but when i try to open it in xml editor it is not opening.
it is displaying error

An invalid character was found in text content. Error processing resource 'file:///F:/copiedfeed.xml'. Line ...

Gastroenterology</u>, 99(7): 1371

copied xml, portion of content is below.

<section_text><![CDATA[><a name="aaa" />American Journal of Gastroenterology</u>, 99(7): 1371?385]]></section_text>

if i remove - between 1371?385, it works fine
what could be the workaround for it
Thanks
vittal
 
Back
Top