You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by Bob Kersten <qb...@oce.nl> on 2000/10/02 14:16:23 UTC

write an XML document to disk

Hello,

    I've looked through the documents but I couldn't find a function
to write an XML document  back to disk. I need to parse a document
(DOMParser), change certain nodes and write the entire thing back to
disk. How is this last step (the writing-part) done?

Bye,
  Bop.



RE: write an XML document to disk

Posted by Radovan Chytracek <Ra...@cern.ch>.
> However, during translation, the ordering of attributes within an
> element are mixed up. For example, if the original XML was
>
> <customer ref="17535" rating="100" type="cut" />
>
> the output looks like
>
> <customer rating="100" type="cut" ref="17535" />
>
> This seems to be because the method used to get the attributes is
> DOM_Node::GetAttributes(), which returns a DOM_NamedNodeMap that by its own
> confession is not ordered.
>
> Does anyone know a way of obtaining the attributes in the order they
> appeared in the original file?

AFAIK, the order of element's attributes is not preserved by an XML parser.
This is in XML 1.0 specification.

Radovan


RE: write an XML document to disk

Posted by Nick Coleman <n....@2020speech.com>.
Bob

Check out the DOMPrint sample application - this reads in an XML document
and writes it out again.

Which brings me on to another question. We are using an application based on
DOMPrint to read in an XML file, update the contents and then write out the
modified file to disk. So far so good. However, during translation, the
ordering of attributes within an element are mixed up. For example, if the
original XML was

<customer ref="17535" rating="100" type="cut" />

the output looks like

<customer rating="100" type="cut" ref="17535" />

This seems to be because the method used to get the attributes is
DOM_Node::GetAttributes(), which returns a DOM_NamedNodeMap that by its own
confession is not ordered.

Does anyone know a way of obtaining the attributes in the order they
appeared in the original file?

Thanks

Nick Coleman



-----Original Message-----
From: Bob Kersten [mailto:qbk@oce.nl]
Sent: Monday, October 02, 2000 1:16 PM
To: xerces-c-dev@xml.apache.org
Subject: write an XML document to disk


Hello,

    I've looked through the documents but I couldn't find a function
to write an XML document  back to disk. I need to parse a document
(DOMParser), change certain nodes and write the entire thing back to
disk. How is this last step (the writing-part) done?

Bye,
  Bop.



---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org