File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes XML and Related Technologies and the fly likes ProcessingInstruction - how to place before root elem Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Reply Bookmark "ProcessingInstruction - how to place before root elem" Watch "ProcessingInstruction - how to place before root elem" New topic
Author

ProcessingInstruction - how to place before root elem

Holger Prause
Ranch Hand

Joined: Oct 09, 2000
Posts: 47
Hi
I have an existing xml File and i use Xerces to read it in.
<code>
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = dbf.newDocumentBuilder();
org.w3c.dom.Document sourceDoc = builder.parse(new FileInputStream(outputPath));
</code>
But now i want to create a ProcessingInstruction ,i read the api and found that method :
createProcessingInstruction(java.lang.String target, java.lang.String data)
this method returns a ProcessingInstruction which i have to add lateron on the Dom tree.But how can i add this ProcessingInstruction BEFORE the Root-Element.
Has anyone of u already done that ? Must i create a new Document to add the ProcessingInstruction before the root-element ?

Thx a lot,
Holger
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: ProcessingInstruction - how to place before root elem
 
Similar Threads
JDOM: attach Content to other Element?
Jdom namespace issue
Adding an xml-stylesheet Processing Instruction to a document
modifying the value of the node
java.lang.ClassCastException: com.sun.org.apache.xerces.internal.dom.DocumentImpl