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 el...@ni.com on 2003/04/02 01:06:57 UTC

DOMWriter->writeNode with DocumentFragment

When I try to "get XML" on a DOMDocumentFragment the DOMWriter->writeNode()
returns:

Unrecognized Node Type

Should I be able to get the content of a document fragment?  Once I append
the docfrag to a document the writeNode will show it in the contents.  But
when I try to peform this action on a DOMDocumentFragment it does not work?
Am I missing something?  I thought a DOMWriter was supposed to be able to
handle a docfrag.

                  // get the DOM representation
                  DOMNode                             *doc =
parser->getDocument();
                  DOMNode                 *docel=((DOMDocument*)doc)
->getDocumentElement();
                  DOMNode                 *docelchild=docel->getFirstChild
();
                  DOMNode                 *docelchild2=docel->getFirstChild
()->getNextSibling();
                  DOMNode
*docelchildofchild=docelchild->getFirstChild();
                  DOMDocumentType         *docdoctype=((DOMDocument*)doc)
->getDoctype();
                  DOMDocumentFragment     *docdocfrag=((DOMDocument*)doc)
->createDocumentFragment();
                  XMLCh                   *docfragname=XMLString::transcode
("newdocfrag");
                  DOMNode                 *docfragchild=((DOMDocument*)doc)
->createElement(docfragname);
                  XMLCh                   *docfragtext=XMLString::transcode
("newdocfragtext");
                  DOMText                 *docfragchildtext
=((DOMDocument*)doc)->createTextNode(docfragtext);
                  docfragchild->appendChild(docfragchildtext);
                  docdocfrag->appendChild(docfragchild);
                  cout<<"DocumentFragment XML: "<<endl;
                  theSerializer->writeNode(myFormTarget, *docdocfrag);


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


Re: DOMWriter->writeNode with DocumentFragment

Posted by PeiYong Zhang <pe...@ca.ibm.com>.
Would you please open a bugzilla report on this? thanks.

Rgds,
PeiYong

----- Original Message -----
From: <el...@ni.com>
To: <xe...@xml.apache.org>
Sent: Tuesday, April 01, 2003 6:06 PM
Subject: DOMWriter->writeNode with DocumentFragment


> When I try to "get XML" on a DOMDocumentFragment the
DOMWriter->writeNode()
> returns:
>
> Unrecognized Node Type
>
> Should I be able to get the content of a document fragment?  Once I append
> the docfrag to a document the writeNode will show it in the contents.  But
> when I try to peform this action on a DOMDocumentFragment it does not
work?
> Am I missing something?  I thought a DOMWriter was supposed to be able to
> handle a docfrag.
>
>                   // get the DOM representation
>                   DOMNode                             *doc =
> parser->getDocument();
>                   DOMNode                 *docel=((DOMDocument*)doc)
> ->getDocumentElement();
>                   DOMNode                 *docelchild=docel->getFirstChild
> ();
>                   DOMNode
*docelchild2=docel->getFirstChild
> ()->getNextSibling();
>                   DOMNode
> *docelchildofchild=docelchild->getFirstChild();
>                   DOMDocumentType         *docdoctype=((DOMDocument*)doc)
> ->getDoctype();
>                   DOMDocumentFragment     *docdocfrag=((DOMDocument*)doc)
> ->createDocumentFragment();
>                   XMLCh
*docfragname=XMLString::transcode
> ("newdocfrag");
>                   DOMNode
*docfragchild=((DOMDocument*)doc)
> ->createElement(docfragname);
>                   XMLCh
*docfragtext=XMLString::transcode
> ("newdocfragtext");
>                   DOMText                 *docfragchildtext
> =((DOMDocument*)doc)->createTextNode(docfragtext);
>                   docfragchild->appendChild(docfragchildtext);
>                   docdocfrag->appendChild(docfragchild);
>                   cout<<"DocumentFragment XML: "<<endl;
>                   theSerializer->writeNode(myFormTarget, *docdocfrag);
>
>
> ---------------------------------------------------------------------
> 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


Re: DOMWriter->writeNode with DocumentFragment

Posted by PeiYong Zhang <pe...@ca.ibm.com>.
Elliot,

    You may do the verification once the fix is in the nightly build.

Rgds,
PeiYong

----- Original Message -----
From: <el...@ni.com>
To: <xe...@xml.apache.org>
Sent: Tuesday, April 01, 2003 6:06 PM
Subject: DOMWriter->writeNode with DocumentFragment


> When I try to "get XML" on a DOMDocumentFragment the
DOMWriter->writeNode()
> returns:
>
> Unrecognized Node Type
>
> Should I be able to get the content of a document fragment?  Once I append
> the docfrag to a document the writeNode will show it in the contents.  But
> when I try to peform this action on a DOMDocumentFragment it does not
work?
> Am I missing something?  I thought a DOMWriter was supposed to be able to
> handle a docfrag.
>
>                   // get the DOM representation
>                   DOMNode                             *doc =
> parser->getDocument();
>                   DOMNode                 *docel=((DOMDocument*)doc)
> ->getDocumentElement();
>                   DOMNode                 *docelchild=docel->getFirstChild
> ();
>                   DOMNode
*docelchild2=docel->getFirstChild
> ()->getNextSibling();
>                   DOMNode
> *docelchildofchild=docelchild->getFirstChild();
>                   DOMDocumentType         *docdoctype=((DOMDocument*)doc)
> ->getDoctype();
>                   DOMDocumentFragment     *docdocfrag=((DOMDocument*)doc)
> ->createDocumentFragment();
>                   XMLCh
*docfragname=XMLString::transcode
> ("newdocfrag");
>                   DOMNode
*docfragchild=((DOMDocument*)doc)
> ->createElement(docfragname);
>                   XMLCh
*docfragtext=XMLString::transcode
> ("newdocfragtext");
>                   DOMText                 *docfragchildtext
> =((DOMDocument*)doc)->createTextNode(docfragtext);
>                   docfragchild->appendChild(docfragchildtext);
>                   docdocfrag->appendChild(docfragchild);
>                   cout<<"DocumentFragment XML: "<<endl;
>                   theSerializer->writeNode(myFormTarget, *docdocfrag);
>
>
> ---------------------------------------------------------------------
> 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