How to know if a DOMDocument is owned by a parser

2019-09-19 07:11发布

问题:

I am looking into an issue where an API is getting called from two different sources. We have an API called dispatch. Its signature is as follows.

DOMDocument* dispatch( DOMDocument * requestDocument )

We observed that this API can be called by passing a DOMDocument object that is

  1. A stand-alone DOMDocument object created using DOMImplementation::createDocument http://xerces.apache.org/xerces-c/apiDocs-3/classDOMImplementation.html

  2. A parse owned DOMDocument object created using AbstractDOMParser::getDocument http://xerces.apache.org/xerces-c/apiDocs-3/classAbstractDOMParser.html#143bc9285686b49f0f06a184b079292a

If i created a document using approach 1, it wont be owned by the parser. However, if i create it using approach 2, it would be owned by the parser.

My question is, if i have a document, how would i know whether it is owned by a parser or not?.

Can you please help me on this or point me to some resource. I am exploring as we speak.

Thanks, PAvan.

回答1:

They're both the result of parsing.