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 "Alberto Massari (JIRA)" <xe...@xml.apache.org> on 2006/08/23 11:38:17 UTC

[jira] Resolved: (XERCESC-1626) loadGrammar is releasing a DOMBuilder previously parsed document when it shouldn't

     [ http://issues.apache.org/jira/browse/XERCESC-1626?page=all ]

Alberto Massari resolved XERCESC-1626.
--------------------------------------

    Resolution: Fixed

Fix is in SVN; please verify

> loadGrammar is releasing a DOMBuilder previously parsed document when it shouldn't
> ----------------------------------------------------------------------------------
>
>                 Key: XERCESC-1626
>                 URL: http://issues.apache.org/jira/browse/XERCESC-1626
>             Project: Xerces-C++
>          Issue Type: Bug
>          Components: DOM, Validating Parser (Schema) (Xerces 1.5 or up only)
>    Affects Versions: 2.7.0
>         Environment: Windows XP Pro 32bit, 
> Xerces-2.7.0,
> Visual C++ 6.0 sp5
>            Reporter: Ori D.
>
> I'm parsing xml file using Xerces-c 2.7 DOM.
> After loading a schema grammar to the parser, my previously parsed xml document is released (and therefore further access to the document in the code causes segmentation fault)
> I do the following things (more or less):
> 1. create a XMLGrammarPoolImpl object and then create a new
> DOMBuilder using it as an input.
> m_grammarPool = new XMLGrammarPoolImpl(XMLPlatformUtils::fgMemoryManager);
> const XMLCh gLS[] = { chLatin_L, chLatin_S, chNull };
> m_DomImpl = DOMImplementationRegistry::getDOMImplementation(gLS);
> m_DomParser = ((DOMImplementationLS*)m_DomImpl)->createDOMBuilder(DOMImplementationLS::MODE_SYNCHRONOUS, 0, XMLPlatformUtils::fgMemoryManager, m_grammarPool);
> m_DomParser->setFeature(XMLUni::fgDOMNamespaces, true);
> m_DomParser->setFeature(XMLUni::fgXercesSchema, true);
> m_DomParser->setFeature(XMLUni::fgXercesSchemaFullChecking, true);
> m_DomParser->setFeature(XMLUni::fgDOMValidateIfSchema, true);
> m_DomParser->setFeature(XMLUni::fgDOMDatatypeNormalization, true);
> 2. Parse an xml file using the DOMBuilder and keep a reference to
> the DOMDocument, 'doc'
> doc = m_DomParser->parse(inputSource);
> 3. Create a new DOMInputSource and call DOMBuilder
> ->loadGrammar(inputSrc, SchemaGrammarType, true)
> SchemaGrammar *pGrammar = (SchemaGrammar*) m_DomParser->loadGrammar(schemaInputSource, Grammar::SchemaGrammarType, true);
> The result is that my previous parsed document, 'doc' is being released by the following code in parsers\DOMBuilderImpl.cpp on DOMBuilderImpl::loadGrammar  (line 703):
>         // Release DOM tree - DTD
>         DOMDocument* doc = adoptDocument();
>         if (doc)
>             doc->release();

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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