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