Re: writing Nodes

Lev Lvovsky <[email protected]> Wed, 25 Jul 2007 17:53:24 -0700
Newsgroups gmane.text.xml.xerces-p.devel
Message-ID <[email protected]>
Jason,

On Jul 24, 2007, at 10:48 PM, Jason Stewart wrote:

> Hi Lev,
>
> On 7/25/07, Lev Lvovsky <[email protected]> wrote:
>
>> Are there any existing functions which can do this, or do I need to
>> piece it together on my own?
>>
>
> There is nothing directly. You would have to define something using
> the DOM methods are using a DOMTreeWalker possibly.

I've decided that since I'm looping through the elements in the file  
that I'm parsing, that I might as well construct a duplicate document  
with only the child elements that I want (those whose data is  
incorrect).

I'm having some problems in creating this document, and wanted to  
just run by the process that I'm going through for some possible  
corrections.  Effectively I'm going off of the sample code,  
specifically DOMCreate.pl.

1.  The file which I'm parsing does not directly mention any DOCTYPE  
(as defined in the call to createDocumentType()).  Can I also omit  
it's inclusion from the document which I'm creating?

2.  after I've created the document with a fake doctype, I proceed to  
clone a node which I'm interested (I'm assuming I need to clone the  
node, as opposed to simply adding it to the new document), and then  
append it to the document.  I get the following error: "A attempt was  
made to insert a node where it is not permitted".  Do I need to cast  
the DOMNode as an element somehow, or?

any help would be appreciated - if there's a user guide to Xerces,  
that would be even more appreciated!

thanks,
-lev