You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by pr...@wipro.com on 2005/05/16 12:24:43 UTC

Convert Xalan Document to Xerces

Hi Everybody,

Basically want to add new node to existing Xalan Document.


XalanDocument theDocument is created as shown below ,

XalanSourceTreeInit             theSourceTreeInit;
XalanSourceTreeDOMSupport  theDOMSupport;
XalanSourceTreeParserLiaison theLiaison(theDOMSupport);
XalanDocument* theDocument;
theDOMSupport->setParserLiaison(theLiaison);
....
theDocument = theLiaison->parseXMLStream(inStream);

The "Domdoc" seems to return null always. please do help me how to
proceed on this ?

XercesDOMSupport     domSupport;
XercesParserLiaison   parserLiaison(domSupport);
const DOMDocument*   Domdoc =
parserLiaison.mapToXercesDocument(theDocument);
if ( Domdoc == NULL ) {
    cerr << "Domdoc  is NULL"  << endl;
}

Since I have already coded eveything in Xalan I cannot switch over to
Xerces. Any kind of hint will be of great help to me.

Thanks
Praveen





Confidentiality Notice

The information contained in this electronic message and any attachments to this message are intended
for the exclusive use of the addressee(s) and may contain confidential or privileged information. If
you are not the intended recipient, please notify the sender at Wipro or Mailadmin@wipro.com immediately
and destroy all copies of this message and any attachments.

Re: Convert Xalan Document to Xerces

Posted by da...@us.ibm.com.
> XercesDOMSupport     domSupport;
> XercesParserLiaison   parserLiaison(domSupport);
> const DOMDocument*   Domdoc = 
parserLiaison.mapToXercesDocument(theDocument);
> if ( Domdoc == NULL ) {
>     cerr << "Domdoc  is NULL"  << endl;
> }

It looks like you've create a XercesParserLiaison instance in order to 
recover the underlying Xerces DOMDocument from an instance you've created 
with XalanSourceTreeParserLiaison.  Since there is no underlying 
DOMDocument, it's not surprising it returns a null pointer.

If you really want to work the Xerces-C DOM, then use a 
XercesParserLiaison instance instead of a XalanSourceTreeParserLiaison. 
However, you should be aware that performance will suffer.  If you intend 
to modify the DOMDocument and use it again with Xalan-C, you must start 
with a Xerces DOMDocument and use the XercesParserLiaison to wrap it for 
use with Xalan-C.  There is some information regarding this in the 
documentation, and you can search the mail archive for more information.

Dave

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