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 / March 2008

Tip: Looking for answers? Try searching our database.

manupulating a xml-file

Thread view: 
Jan Müller - 31 Mar 2008 13:27 GMT
hi,

at first: excuse me for my bad english :-)

i want to manupulate a element-text of a xml-file like this:
<element>text</element> ==> <element>manupulated text</element>.
for the parsing of the xml-file i use SAX, but i have no idea how i have to
manipulate the text and write it back into the xml-file.

can anyone give me a tip to solve my problem?

many thanky,
jan
Chase Preuninger - 31 Mar 2008 14:14 GMT
First I would see if I could maybe reconstruct the document adding the
text in as I do so then printing it back out with a PrintStream but
that probably is the worst way to do it.  Look in the api of a book
there has to be some like document builder class.

http://groups.google.com/group/java-software-develoupment?hl=en
Arne Vajhøj - 31 Mar 2008 15:30 GMT
> i want to manupulate a element-text of a xml-file like this:
> <element>text</element> ==> <element>manupulated text</element>.
> for the parsing of the xml-file i use SAX, but i have no idea how i have to
> manipulate the text and write it back into the xml-file.

SAX is purely an API for reading XML, so SAX in itself does not
provide any way of writing an updated file.

But it is relative simple to do - you can write out
start tag with attributes in startElement and
modified content + end tag in endElement.

Arne
Jan Müller - 31 Mar 2008 15:38 GMT
hi arne,

thank you very much for the idea. i will try your suggestion.

thx,
jan

>> i want to manupulate a element-text of a xml-file like this:
>> <element>text</element> ==> <element>manupulated text</element>.
[quoted text clipped - 9 lines]
>
> Arne


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.