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 Gary Hughes <ge...@itga.com.au> on 2002/12/17 23:54:44 UTC

parser feature fgXercesUserAdoptsDOMDocument

Hi,

I have a question regarding the fgXercesUserAdoptsDOMDocument feature of 
the xerces parser. It doesn't appear to work, I create a parser with the 
code below. If I attempt to set the feature it appears to work fine 
however it doesn't change the behaviour of the parser and if I call 
getFeature or canSetFeature for the same feature it throws a not found 
exception.

I'm using xerces 2.1 on solaris 2.6/2.8 with g++ 2.95.3.

DOMBuilder* parser = 
DOMImplementationRegistry::getDOMImplementation(gLS)->createDOMBuilder(DOMImplementationLS::MODE_SYNCHRONOUS,0));

parser->setFeature(XMLUni::fgXercesUserAdoptsDOMDocument, true);

Am I doing something wrong or is this feature broken? Without this I 
have to keep the parser instance around for a lot longer than is needed 
which is a bit messy and inconvenient in my app.

thanks.

Gary.


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


Re: parser feature fgXercesUserAdoptsDOMDocument

Posted by Gareth Reakes <ga...@decisionsoft.com>.
Hi,
	I think thats a bug. Ill have a look into it.

thanks

Gareth



On Fri, 20 Dec 2002, Gary Hughes wrote:

> Hi Gareth,
> 
> The parser does not seem to relinquish ownership of the document, I am 
> also concerned over the fact that calling setFeature does not raise an 
> exception while getFeature or canSetFeature both raise a not found 
> exception for the same feature (fgXercesUserAdoptsDOMDocument).
> 
> I'll try your method thanks.
> 
> Gary.
> 
> 
> 
> Gareth Reakes wrote:
> > Hi,
> > 	when you say it does not change the behaviour what do you mean? 
> > What you should see is that when you delete the parser it does not delete 
> > the document. The following code works for me:
> > 
> > parser->parse(gXmlFile); 
> > DOMDocument *doc = parser->getDocument();
> > parser->adoptDocument();
> > std::cerr << 
> > XMLString::transcode(doc->getDocumentElement()->getNodeName()) << 
> > std::endl;
> > delete parser;
> > std::cerr << 
> > XMLString::transcode(doc->getDocumentElement()->getNodeName()) << 
> > std::endl;
> > 
> > 
> > 
> > Gareth
> > 
> > 
> > On Wed, 18 Dec 2002, Gary Hughes wrote:
> > 
> > 
> >>Hi,
> >>
> >>I have a question regarding the fgXercesUserAdoptsDOMDocument feature of 
> >>the xerces parser. It doesn't appear to work, I create a parser with the 
> >>code below. If I attempt to set the feature it appears to work fine 
> >>however it doesn't change the behaviour of the parser and if I call 
> >>getFeature or canSetFeature for the same feature it throws a not found 
> >>exception.
> >>
> >>I'm using xerces 2.1 on solaris 2.6/2.8 with g++ 2.95.3.
> >>
> >>DOMBuilder* parser = 
> >>DOMImplementationRegistry::getDOMImplementation(gLS)->createDOMBuilder(DOMImplementationLS::MODE_SYNCHRONOUS,0));
> >>
> >>parser->setFeature(XMLUni::fgXercesUserAdoptsDOMDocument, true);
> >>
> >>Am I doing something wrong or is this feature broken? Without this I 
> >>have to keep the parser instance around for a lot longer than is needed 
> >>which is a bit messy and inconvenient in my app.
> >>
> >>thanks.
> >>
> >>Gary.
> >>
> >>
> >>---------------------------------------------------------------------
> >>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
> 
> 

-- 
Gareth Reakes, Head of Product Development  +44-1865-203192
DecisionSoft Limited                        http://www.decisionsoft.com
XML Development and Services




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


Re: parser feature fgXercesUserAdoptsDOMDocument

Posted by Gary Hughes <ge...@itga.com.au>.
Hi Gareth,

The parser does not seem to relinquish ownership of the document, I am 
also concerned over the fact that calling setFeature does not raise an 
exception while getFeature or canSetFeature both raise a not found 
exception for the same feature (fgXercesUserAdoptsDOMDocument).

I'll try your method thanks.

Gary.



Gareth Reakes wrote:
> Hi,
> 	when you say it does not change the behaviour what do you mean? 
> What you should see is that when you delete the parser it does not delete 
> the document. The following code works for me:
> 
> parser->parse(gXmlFile); 
> DOMDocument *doc = parser->getDocument();
> parser->adoptDocument();
> std::cerr << 
> XMLString::transcode(doc->getDocumentElement()->getNodeName()) << 
> std::endl;
> delete parser;
> std::cerr << 
> XMLString::transcode(doc->getDocumentElement()->getNodeName()) << 
> std::endl;
> 
> 
> 
> Gareth
> 
> 
> On Wed, 18 Dec 2002, Gary Hughes wrote:
> 
> 
>>Hi,
>>
>>I have a question regarding the fgXercesUserAdoptsDOMDocument feature of 
>>the xerces parser. It doesn't appear to work, I create a parser with the 
>>code below. If I attempt to set the feature it appears to work fine 
>>however it doesn't change the behaviour of the parser and if I call 
>>getFeature or canSetFeature for the same feature it throws a not found 
>>exception.
>>
>>I'm using xerces 2.1 on solaris 2.6/2.8 with g++ 2.95.3.
>>
>>DOMBuilder* parser = 
>>DOMImplementationRegistry::getDOMImplementation(gLS)->createDOMBuilder(DOMImplementationLS::MODE_SYNCHRONOUS,0));
>>
>>parser->setFeature(XMLUni::fgXercesUserAdoptsDOMDocument, true);
>>
>>Am I doing something wrong or is this feature broken? Without this I 
>>have to keep the parser instance around for a lot longer than is needed 
>>which is a bit messy and inconvenient in my app.
>>
>>thanks.
>>
>>Gary.
>>
>>
>>---------------------------------------------------------------------
>>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: parser feature fgXercesUserAdoptsDOMDocument

Posted by Gareth Reakes <ga...@decisionsoft.com>.
Hi,
	when you say it does not change the behaviour what do you mean? 
What you should see is that when you delete the parser it does not delete 
the document. The following code works for me:

parser->parse(gXmlFile); 
DOMDocument *doc = parser->getDocument();
parser->adoptDocument();
std::cerr << 
XMLString::transcode(doc->getDocumentElement()->getNodeName()) << 
std::endl;
delete parser;
std::cerr << 
XMLString::transcode(doc->getDocumentElement()->getNodeName()) << 
std::endl;



Gareth


On Wed, 18 Dec 2002, Gary Hughes wrote:

> Hi,
> 
> I have a question regarding the fgXercesUserAdoptsDOMDocument feature of 
> the xerces parser. It doesn't appear to work, I create a parser with the 
> code below. If I attempt to set the feature it appears to work fine 
> however it doesn't change the behaviour of the parser and if I call 
> getFeature or canSetFeature for the same feature it throws a not found 
> exception.
> 
> I'm using xerces 2.1 on solaris 2.6/2.8 with g++ 2.95.3.
> 
> DOMBuilder* parser = 
> DOMImplementationRegistry::getDOMImplementation(gLS)->createDOMBuilder(DOMImplementationLS::MODE_SYNCHRONOUS,0));
> 
> parser->setFeature(XMLUni::fgXercesUserAdoptsDOMDocument, true);
> 
> Am I doing something wrong or is this feature broken? Without this I 
> have to keep the parser instance around for a lot longer than is needed 
> which is a bit messy and inconvenient in my app.
> 
> thanks.
> 
> Gary.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
> 
> 

-- 
Gareth Reakes, Head of Product Development  +44-1865-203192
DecisionSoft Limited                        http://www.decisionsoft.com
XML Development and Services




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