jQuery in Action, 2nd edition*
The moose likes XML and Related Technologies and the fly likes how to insert header Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "how to insert header" Watch "how to insert header" New topic
Author

how to insert header

uma prem
Greenhorn

Joined: Jun 21, 2010
Posts: 11

Hi,

I am new to programming, need your kind help :

Currently I have a set of xml files in a folder consisting of single xml per file. I need to insert the below header for each xml. How can i do this
<header>
<identifier>ip:abc:12345</identifier>
<datestamp>datetimestampZ</datestamp>
<setSpec>active</setSpec>
</header>

Please help

Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41068
    
  43
Any of DOM libraries can do that: DOM, JDOM, XOM, dom4j, ...


Ping & DNS - my free Android networking tools app
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12759
    
    5
Alternately you could treat it as a pure text manipulation problem.

You would learn much more useful Java programming by doing as Ulf suggests.

How big are these files that have to be modified?

Bill
uma prem
Greenhorn

Joined: Jun 21, 2010
Posts: 11
Thanks Ulf Dittmer

Hi William,

The file size is only max of 8kb per file but have many files(1000files in folder)

I am doing like this first trying to read the file

but error is coming what s the mistake please let me know i have attached my file.

Thanks a lot.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

uma prem wrote:but error is coming what s the mistake


If you want other people to explain an error message, it would be a good idea if you told them what the error message said. Don't you agree?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to insert header
 
Similar Threads
xml error_please help
insert header and footer with POI HWPF?
Inserting image in header/footer in excel using jxl
How to insert data into xml ?
how to insert textvalue in existing XMl file