Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / August 2006

Tip: Looking for answers? Try searching our database.

xml parsing.............

Thread view: 
crazzybugger - 19 Aug 2006 17:07 GMT
hi ,

  i am having an XML file and i would like to append a node at to the
document ................. i know you can use DOM to build the whole
tree and then append to the root and then write to the file.........my
question is this...............can we do this without re-writing the
file each and every time..............??? like some appending to the
xml file????
Arne Vajhøj - 20 Aug 2006 00:33 GMT
>    i am having an XML file and i would like to append a node at to the
> document ................. i know you can use DOM to build the whole
> tree and then append to the root and then write to the file.........my
> question is this...............can we do this without re-writing the
> file each and every time..............??? like some appending to the
> xml file????

Since appending to an XML file will make it invalid, then NO.

Arne
crazzybugger - 20 Aug 2006 04:26 GMT
> >    i am having an XML file and i would like to append a node at to the
> > document ................. i know you can use DOM to build the whole
[quoted text clipped - 6 lines]
>
> Arne

so if i am having a very big XML file it tends to be a waste of time
trying to add new elements.........
Arne Vajhøj - 20 Aug 2006 16:37 GMT
> so if i am having a very big XML file it tends to be a waste of time
> trying to add new elements.........

If you have huge data that you need to update frequently, then
XML is not a good choice for storage.

Arne
Arne Vajhøj - 20 Aug 2006 16:38 GMT
>> so if i am having a very big XML file it tends to be a waste of time
>> trying to add new elements.........
>
> If you have huge data that you need to update frequently, then
> XML is not a good choice for storage.

Correction:

If you have huge data that you need to update frequently, then
a single XML file is not a good choice for storage.

Arne
relogout@gmail.com - 20 Aug 2006 01:35 GMT
you should know the struture of the XML file first
so.........you must parse it any way before appanding something
> hi ,
>
[quoted text clipped - 4 lines]
> file each and every time..............??? like some appending to the
> xml file????
Rohit Kumbhar - 20 Aug 2006 12:34 GMT
> hi ,
>
[quoted text clipped - 4 lines]
> file each and every time..............??? like some appending to the
> xml file????

Castor can take away a lot of pains.
http://www.castor.org/
William Brogden - 20 Aug 2006 16:56 GMT
> hi ,
>
[quoted text clipped - 4 lines]
> file each and every time..............??? like some appending to the
> xml file????

The way to handle this is to not have the file be a complete
XML document - in other words, leave out the xml declaration
and the root element. Then you can append nodes all you want.
Of course, in order to parse the file you need to contrive to
add the missing root - this is easily done since parsers just
want a character stream - you can use java.io.SequenceInputStream
to combine a String representing the document root, the file of
node data and a String representing the closing root element.

For an even more complex example:
http://www.xml.com/pub/a/2003/07/16/fragmentreader.html

Bill
crazzybugger - 20 Aug 2006 19:08 GMT
> > hi ,
> >
[quoted text clipped - 18 lines]
>
> Bill

excellent idea! i really liked it.......... i shall try implementing it


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.