• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

ProcessingInstruction - how to place before root elem

 
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!