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 林 子芯 <mi...@hotmail.com> on 2002/05/22 17:15:15 UTC

how to re-use the parsed document


hi,
prehaps it is a trival task for most of you guys, but i couldn't get it 
right, i was wondering whether it is possible to save the parsed document 
and allow it to be use whenever it is needed. at present i have an xml 
document that is needed for different purposes, so instead of re-parsing 
the document each time for specify purposes, can i stored the parsed 
document in a variable and call such variable whenever it is needed.  if it 
is possible can somebody suggest how it could be done? 

Many thanks
Regards
Kit



_________________________________________________________________
在您的行動裝置上傳送接收 Hotmail 郵件,請移至:http://mobile.msn.com


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


RE: how to re-use the parsed document

Posted by Erik Rydgren <er...@mandarinen.se>.
If you are using DOM this is a trivial task.
Just store the DOMDocument object and make a clone of it everytime you need
to use it.
Cloning the document is performed like this.

Create a new DOMDocument with the same namespace, publicid, systemid and
DocType as the original.
Deep import the root node from the original document into the new document
and thereby get a new node.
Add that node to the new document as root.
Now you have a copy. I might have forgotten some step or problem but you'll
probably work it out by yourself.

Regards

Erik Rydgren
Mandarinen systems AB
Sweden


-----Original Message-----
From: 林 子芯 [mailto:minikittygo@hotmail.com]
Sent: den 22 maj 2002 17:15
To: xerces-c-dev@xml.apache.org
Subject: how to re-use the parsed document




hi,
prehaps it is a trival task for most of you guys, but i couldn't get it
right, i was wondering whether it is possible to save the parsed document
and allow it to be use whenever it is needed. at present i have an xml
document that is needed for different purposes, so instead of re-parsing
the document each time for specify purposes, can i stored the parsed
document in a variable and call such variable whenever it is needed.  if it
is possible can somebody suggest how it could be done?

Many thanks
Regards
Kit



_________________________________________________________________
在您的行動裝置上傳送接收 Hotmail 郵件,請移至:http://mobile.msn.com


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


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