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 Hal DeVore <ha...@acm.org> on 2001/07/17 12:06:09 UTC

Re: copy nodes from one DOM to another

>>>>> On Tue, 17 Jul 2001, "Rolf" == Rolf Jakob wrote:

  Rolf> For an XML editing application I would like to copy a
  Rolf> node from one DOM to another.

I have advice for using the DOM (in any implementation) for 
XML editing applications:

        Don't

I've been working on a Real Work (tm) project involving editing
XML for about 6 months.  Sadly, when I got started Xerces C had
some functionality problems in the area of entity references
that made it unusable to me.  So, since my part of the project
was Windows only and the project was only going to last 2 months
(rueful grin), I went over to the Dark Side and used MSXML.
Another part of our project lives on a Web Server and I believe
they're using Xerces J but they're not "round tripping" the XML.

But, regardless of the particular implementation, the DOM Level  
1 API is NOT SUITABLE for a lot of applications that alter XML.  

My own show stopper was that I needed to be able to create
user-defined entity definitions and change user-selected bits
of text into entity references.  That's when I discovered that
everything in the DOCTYPE is read-only in the DOM.  I ended
up using MSXML to parse the input file, walking the DOM tree
creating a similar tree of my own devising, and then deleting the
DOM tree.  I believe that I would have had to do the same thing
if I had ended up using Xerces (or I would have hacked the 
Xerces source to allow operations illegal in DOM level 1).

--Hal



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


Re: copy nodes from one DOM to another

Posted by Rolf Jakob <rj...@nuemail.panmail.com>.
Hello Hal,

On Tuesday 17 July 2001 12:06, you wrote:
> >>>>> On Tue, 17 Jul 2001, "Rolf" == Rolf Jakob wrote:
>
>   Rolf> For an XML editing application I would like to copy a
>   Rolf> node from one DOM to another.
>
> I have advice for using the DOM (in any implementation) for
> XML editing applications:
>
>         Don't

Sounds like you got frustrated while trying to use it then.

Fortunately I have some time for that application and I do it more or less 
for myself - at least in the first step.

It should assist me in creating a documentation with lots of templates which 
in turn are created from plain text files. So this was a quite boring job and 
I want to have something that makes it easier.
The source text files are given and the resulting XML therefor is so 
predictable and the copy rules are set so that I know that the edited XML 
will be compliant to the description.

For a generic XML editor with a copy function using just any XML files this 
would be far more complicated. But luckily I don't need this (yet).

I could solve my problem with target_document::importNode() without much 
cheating (I used doc.setErrorChecking(false) for some time ;)

Rolf

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