You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-users@xerces.apache.org by Alexis Blaze <ly...@yahoo.com> on 2006/12/28 17:37:44 UTC

problem in creating DOMDocuments

I have some experience with XML in javascript and java, but i'm new at
xerces...

i want to create a DOMDocument from a XMLTemplate...

an example of the template will look like this...

---------------------------------
<resource id="" type="">
  <judul/>
  <pengarang/>
  <keywords/>
  <hak-akses/>
  <bahasa/>
  <metadata/>
</resource>
-----------------------------------

as you can see, all the tag are empty, so ii will used the DOMDocument to
fill in the textContent....

the problem is, i don't know how to load the template into the
DOMDocument... I have read the CreateDOMDocument sample, but it create
DOMDocument from scratch... unlike what i want...in java script, all that i
need to do is

------------------------
xmlStr = "<resource id=''
type=''><judul/><pengarang/><keywords/><hak-akses/><bahasa/><metadata/></resource>";
doc.load(xmlStr); <--- this will load the xmlStr into DOMDocument...
------------------------

is there any way to do this??

thank for your help....

-- 
View this message in context: http://www.nabble.com/problem-in-creating-DOMDocuments-tf2891037.html#a8076750
Sent from the Xerces - C - Users mailing list archive at Nabble.com.


RE: problem in creating DOMDocuments

Posted by Alexis Blaze <ly...@yahoo.com>.
Oh... now i get it... thanks a lot.. :D now that i can build the
DOMDocument... another problem came.. i would like to put the xml into a
string... i have read the DOMPrint sample and the sample show us how to
print the xml into file and console.. but not into a string...


Jacinto, Alex wrote:
> 
> No, you're going to do the same thing you are doing when you call load
> in Javascript.  Put the xml document in a buffer and then tell Xerces to
> parse it.  Then you'll get a DOM in memory where you can add text node,
> attributes, etc.  Same concept as javascript.
> 
> Alex Jacinto
> 
> 

-- 
View this message in context: http://www.nabble.com/problem-in-creating-DOMDocuments-tf2891037.html#a8084629
Sent from the Xerces - C - Users mailing list archive at Nabble.com.


RE: problem in creating DOMDocuments

Posted by Alexis Blaze <ly...@yahoo.com>.

By parse the document, do you mean that i need to parse the document using
sax or dom, and put every element, attributes, text, etc on a DOMDocument? I
can understand that approach.. But, is there any other more simple
approach?? bacause it rather complicated to created a special parser just to
do this stuff..


Jacinto, Alex wrote:
> 
> Alexis,
> 
> You need to parse the document then add whatever you want.  See the
> parsing examples.
> 

-- 
View this message in context: http://www.nabble.com/problem-in-creating-DOMDocuments-tf2891037.html#a8077218
Sent from the Xerces - C - Users mailing list archive at Nabble.com.