Re: manupulating a xml-file



Jan Müller wrote:
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
.



Relevant Pages

  • Re: Find numeric value in xml file, recalculate, and replace old value
    ... > reads an xml-file, find a tag that contains a value, recalculate ... > over to a new xml-file. ... I know it's doable in perl but prefer to keep perl ...
    (comp.unix.shell)
  • Re: manupulating a xml-file
    ... 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 ... modified content + end tag in endElement. ...
    (comp.lang.java.programmer)
  • Find a tag in XML, replace progressively
    ... I am trying to write a shell-script that reads an xml-file, ... ItemRevision id tag that contains "id", ...
    (comp.unix.shell)
  • Re: Find numeric value in xml file, recalculate, and replace old value
    ... > I'm trying to write a shell-script (using SUN OS at the moment) that reads ... > an xml-file, find a tag that contains a value, recalculate that value and ... > know it's doable in perl but prefer to keep perl out of it if possible. ... Assuming only one matching tag per line... ...
    (comp.unix.shell)