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 Umesh Chandak <um...@gs-lab.com> on 2007/03/16 07:58:22 UTC

load grammar function of class SAX2XMLReaderImpl is hanging

Hi All,
I am using the loadGrammar function of class SAX2XMLReaderImpl for
loadding the grammar of XSD. But it is hanging in class DFAContentModel
in member function calcFollowList. I don't know the reason why it is
hanging.
Here is the code snippet I am using

const bool schemaFullChecking = true;
    
SAX2XMLReaderImpl* parser = new
SAX2XMLReaderImpl(XMLPlatformUtils::fgMemoryManager, grammarPool);
Janitor<SAX2XMLReaderImpl> janParser(parser);
 
parser->setFeature(XMLUni::fgSAX2CoreNameSpaces, true);
parser->setFeature(XMLUni::fgXercesSchema, true);
parser->setFeature(XMLUni::fgXercesSchemaFullChecking,
schemaFullChecking);
parser->setFeature(XMLUni::fgSAX2CoreNameSpacePrefixes, false);
parser->setFeature(XMLUni::fgSAX2CoreValidation, true);
parser->setFeature(XMLUni::fgXercesDynamic, true);
XSDErrorHandler* errorHandler = new XSDErrorHandler();  
Janitor<XSDErrorHandler> janErrorHandler(errorHandler);
parser->setErrorHandler(errorHandler);
Grammar* result = parser->loadGrammar(xsdFileName,
Grammar::SchemaGrammarType, true);


I am also giving the xsd file I am using. It is simple xsd file.

<?xml version="1.0"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://xsdtesting" xmlns:x="http://xsdtesting"
xmlns:imp="http://importedXSD">
	<xsd:complexType name="B">
		<xsd:sequence>
			<xsd:element name="foo" minOccurs="1" maxOccurs="1"/>
			<xsd:any namespace="##any" minOccurs="0" maxOccurs="unbounded"/>
		</xsd:sequence>
	</xsd:complexType>
	<xsd:complexType name="R">
		<xsd:complexContent>
			<xsd:restriction base="x:B">
				<xsd:sequence>
					<xsd:element name="foo" minOccurs="1" maxOccurs="1"/>
					<xsd:choice minOccurs="1" maxOccurs="1">
						<xsd:element name="e1" minOccurs="1" maxOccurs="30000"/>
					</xsd:choice>
				</xsd:sequence>
			</xsd:restriction>
		</xsd:complexContent>
	</xsd:complexType>
	<xsd:element name="doc">
		<xsd:complexType>
			<xsd:choice>
				<xsd:element name="elem" type="x:R"/>
			</xsd:choice>
		</xsd:complexType>
	</xsd:element>
</xsd:schema>
  

Thanks.
Regards,
Umesh


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


Re: load grammar function of class SAX2XMLReaderImpl is hanging

Posted by Alberto Massari <am...@datadirect.com>.
At 15.29 16/03/2007 +0530, Umesh Chandak wrote:
>Hi Alberto,
>Thanks once again.
>What is the safe value of maxoccurs for good performance? You can
>specify the range.

Umesh,
there is no "safe value"; Xerces builds a DFA map that describes 
every possible state of a valid XML, so the performances depend on 
the total number of states.
A single maxOccurs=999999 will crash your application, but also an 
element with maxOccurs=20 that has a sequence of 20 other elements 
with a maxOccurs=20 could crash it too.

Alberto

>Thanks.
>Regards,
>Umesh
>On Fri, 2007-03-16 at 10:02 +0100, Alberto Massari wrote:
> > At 13.02 16/03/2007 +0530, Umesh Chandak wrote:
> > >Hi ,
> > >Thanks, It worked this time. But can you tell me why it is happening.
> > >what is the problem with the figure 30000.
> > >Is this a bug in xerces?
> > >If not does it documented some where.
> >
> > It's a known limitation of Xerces:
> > http://xml.apache.org/xerces-c/schema.html#limitation
> >
> > Alberto
> >
> >
> > >Thanks.
> > >Regards,
> > >Umesh
> > >On Fri, 2007-03-16 at 08:00 +0100, Alberto Massari wrote:
> > > > Hi Umesh,
> > > > the reason is the maxOccurs=30000; I would suggest to change it to be
> > > > unbounded.
> > > >
> > > > Alberto
> > > >
> > > > At 12.28 16/03/2007 +0530, Umesh Chandak wrote:
> > > > >Hi All,
> > > > >I am using the loadGrammar function of class SAX2XMLReaderImpl for
> > > > >loadding the grammar of XSD. But it is hanging in class 
> DFAContentModel
> > > > >in member function calcFollowList. I don't know the reason why it is
> > > > >hanging.
> > > > >Here is the code snippet I am using
> > > > >
> > > > >const bool schemaFullChecking = true;
> > > > >
> > > > >SAX2XMLReaderImpl* parser = new
> > > > >SAX2XMLReaderImpl(XMLPlatformUtils::fgMemoryManager, grammarPool);
> > > > >Janitor<SAX2XMLReaderImpl> janParser(parser);
> > > > >
> > > > >parser->setFeature(XMLUni::fgSAX2CoreNameSpaces, true);
> > > > >parser->setFeature(XMLUni::fgXercesSchema, true);
> > > > >parser->setFeature(XMLUni::fgXercesSchemaFullChecking,
> > > > >schemaFullChecking);
> > > > >parser->setFeature(XMLUni::fgSAX2CoreNameSpacePrefixes, false);
> > > > >parser->setFeature(XMLUni::fgSAX2CoreValidation, true);
> > > > >parser->setFeature(XMLUni::fgXercesDynamic, true);
> > > > >XSDErrorHandler* errorHandler = new XSDErrorHandler();
> > > > >Janitor<XSDErrorHandler> janErrorHandler(errorHandler);
> > > > >parser->setErrorHandler(errorHandler);
> > > > >Grammar* result = parser->loadGrammar(xsdFileName,
> > > > >Grammar::SchemaGrammarType, true);
> > > > >
> > > > >
> > > > >I am also giving the xsd file I am using. It is simple xsd file.
> > > > >
> > > > ><?xml version="1.0"?>
> > > > ><xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> > > > >targetNamespace="http://xsdtesting" xmlns:x="http://xsdtesting"
> > > > >xmlns:imp="http://importedXSD">
> > > > >         <xsd:complexType name="B">
> > > > >                 <xsd:sequence>
> > > > >                         <xsd:element name="foo" minOccurs="1"
> > > maxOccurs="1"/>
> > > > >                         <xsd:any namespace="##any" minOccurs="0"
> > > > > maxOccurs="unbounded"/>
> > > > >                 </xsd:sequence>
> > > > >         </xsd:complexType>
> > > > >         <xsd:complexType name="R">
> > > > >                 <xsd:complexContent>
> > > > >                         <xsd:restriction base="x:B">
> > > > >                                 <xsd:sequence>
> > > > >                                         <xsd:element name="foo"
> > > > > minOccurs="1" maxOccurs="1"/>
> > > > >                                         <xsd:choice minOccurs="1"
> > > > > maxOccurs="1">
> > > > >                                                 <xsd:element
> > > > > name="e1" minOccurs="1" maxOccurs="30000"/>
> > > > >                                         </xsd:choice>
> > > > >                                 </xsd:sequence>
> > > > >                         </xsd:restriction>
> > > > >                 </xsd:complexContent>
> > > > >         </xsd:complexType>
> > > > >         <xsd:element name="doc">
> > > > >                 <xsd:complexType>
> > > > >                         <xsd:choice>
> > > > >                                 <xsd:element name="elem" type="x:R"/>
> > > > >                         </xsd:choice>
> > > > >                 </xsd:complexType>
> > > > >         </xsd:element>
> > > > ></xsd:schema>
> > > > >
> > > > >
> > > > >Thanks.
> > > > >Regards,
> > > > >Umesh
> > > > >
> > > > >
> > > > >---------------------------------------------------------------------
> > > > >To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
> > > > >For additional commands, e-mail: c-dev-help@xerces.apache.org
> > > >
> > > >
> > > > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
> > > > For additional commands, e-mail: c-dev-help@xerces.apache.org
> > > >
> > > >
> > >
> > >
> > >---------------------------------------------------------------------
> > >To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
> > >For additional commands, e-mail: c-dev-help@xerces.apache.org
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
> > For additional commands, e-mail: c-dev-help@xerces.apache.org
> >
> >
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
>For additional commands, e-mail: c-dev-help@xerces.apache.org


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


Re: load grammar function of class SAX2XMLReaderImpl is hanging

Posted by Umesh Chandak <um...@gs-lab.com>.
Hi Alberto,  
Thanks once again.
What is the safe value of maxoccurs for good performance? You can
specify the range.
Thanks.
Regards,
Umesh 
On Fri, 2007-03-16 at 10:02 +0100, Alberto Massari wrote:
> At 13.02 16/03/2007 +0530, Umesh Chandak wrote:
> >Hi ,
> >Thanks, It worked this time. But can you tell me why it is happening.
> >what is the problem with the figure 30000.
> >Is this a bug in xerces?
> >If not does it documented some where.
> 
> It's a known limitation of Xerces:
> http://xml.apache.org/xerces-c/schema.html#limitation
> 
> Alberto
> 
> 
> >Thanks.
> >Regards,
> >Umesh
> >On Fri, 2007-03-16 at 08:00 +0100, Alberto Massari wrote:
> > > Hi Umesh,
> > > the reason is the maxOccurs=30000; I would suggest to change it to be
> > > unbounded.
> > >
> > > Alberto
> > >
> > > At 12.28 16/03/2007 +0530, Umesh Chandak wrote:
> > > >Hi All,
> > > >I am using the loadGrammar function of class SAX2XMLReaderImpl for
> > > >loadding the grammar of XSD. But it is hanging in class DFAContentModel
> > > >in member function calcFollowList. I don't know the reason why it is
> > > >hanging.
> > > >Here is the code snippet I am using
> > > >
> > > >const bool schemaFullChecking = true;
> > > >
> > > >SAX2XMLReaderImpl* parser = new
> > > >SAX2XMLReaderImpl(XMLPlatformUtils::fgMemoryManager, grammarPool);
> > > >Janitor<SAX2XMLReaderImpl> janParser(parser);
> > > >
> > > >parser->setFeature(XMLUni::fgSAX2CoreNameSpaces, true);
> > > >parser->setFeature(XMLUni::fgXercesSchema, true);
> > > >parser->setFeature(XMLUni::fgXercesSchemaFullChecking,
> > > >schemaFullChecking);
> > > >parser->setFeature(XMLUni::fgSAX2CoreNameSpacePrefixes, false);
> > > >parser->setFeature(XMLUni::fgSAX2CoreValidation, true);
> > > >parser->setFeature(XMLUni::fgXercesDynamic, true);
> > > >XSDErrorHandler* errorHandler = new XSDErrorHandler();
> > > >Janitor<XSDErrorHandler> janErrorHandler(errorHandler);
> > > >parser->setErrorHandler(errorHandler);
> > > >Grammar* result = parser->loadGrammar(xsdFileName,
> > > >Grammar::SchemaGrammarType, true);
> > > >
> > > >
> > > >I am also giving the xsd file I am using. It is simple xsd file.
> > > >
> > > ><?xml version="1.0"?>
> > > ><xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> > > >targetNamespace="http://xsdtesting" xmlns:x="http://xsdtesting"
> > > >xmlns:imp="http://importedXSD">
> > > >         <xsd:complexType name="B">
> > > >                 <xsd:sequence>
> > > >                         <xsd:element name="foo" minOccurs="1" 
> > maxOccurs="1"/>
> > > >                         <xsd:any namespace="##any" minOccurs="0"
> > > > maxOccurs="unbounded"/>
> > > >                 </xsd:sequence>
> > > >         </xsd:complexType>
> > > >         <xsd:complexType name="R">
> > > >                 <xsd:complexContent>
> > > >                         <xsd:restriction base="x:B">
> > > >                                 <xsd:sequence>
> > > >                                         <xsd:element name="foo"
> > > > minOccurs="1" maxOccurs="1"/>
> > > >                                         <xsd:choice minOccurs="1"
> > > > maxOccurs="1">
> > > >                                                 <xsd:element
> > > > name="e1" minOccurs="1" maxOccurs="30000"/>
> > > >                                         </xsd:choice>
> > > >                                 </xsd:sequence>
> > > >                         </xsd:restriction>
> > > >                 </xsd:complexContent>
> > > >         </xsd:complexType>
> > > >         <xsd:element name="doc">
> > > >                 <xsd:complexType>
> > > >                         <xsd:choice>
> > > >                                 <xsd:element name="elem" type="x:R"/>
> > > >                         </xsd:choice>
> > > >                 </xsd:complexType>
> > > >         </xsd:element>
> > > ></xsd:schema>
> > > >
> > > >
> > > >Thanks.
> > > >Regards,
> > > >Umesh
> > > >
> > > >
> > > >---------------------------------------------------------------------
> > > >To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
> > > >For additional commands, e-mail: c-dev-help@xerces.apache.org
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
> > > For additional commands, e-mail: c-dev-help@xerces.apache.org
> > >
> > >
> >
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
> >For additional commands, e-mail: c-dev-help@xerces.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
> For additional commands, e-mail: c-dev-help@xerces.apache.org
> 
> 


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


Re: load grammar function of class SAX2XMLReaderImpl is hanging

Posted by Michael Glavassevich <mr...@ca.ibm.com>.
The version of Xerces-J in SVN no longer has this limitation for a number 
of common cases (including Umesh's schema). If a complex type meets 
certain conditions [1] element and wildcard particles with 
minOccurs/maxOccurs are processed in constant space/time and are 
represented with a single state in the DFA. I imagine something similar 
could be implemented in Xerces-C.

[1] http://svn.apache.org/viewvc?view=rev&revision=511014

Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: mrglavas@ca.ibm.com
E-mail: mrglavas@apache.org

Alberto Massari <am...@datadirect.com> wrote on 03/16/2007 05:02:37 AM:

> At 13.02 16/03/2007 +0530, Umesh Chandak wrote:
> >Hi ,
> >Thanks, It worked this time. But can you tell me why it is happening.
> >what is the problem with the figure 30000.
> >Is this a bug in xerces?
> >If not does it documented some where.
> 
> It's a known limitation of Xerces:
> http://xml.apache.org/xerces-c/schema.html#limitation
> 
> Alberto
> 
> 
> >Thanks.
> >Regards,
> >Umesh
> >On Fri, 2007-03-16 at 08:00 +0100, Alberto Massari wrote:
> > > Hi Umesh,
> > > the reason is the maxOccurs=30000; I would suggest to change it to 
be
> > > unbounded.
> > >
> > > Alberto
> > >
> > > At 12.28 16/03/2007 +0530, Umesh Chandak wrote:
> > > >Hi All,
> > > >I am using the loadGrammar function of class SAX2XMLReaderImpl for
> > > >loadding the grammar of XSD. But it is hanging in class 
DFAContentModel
> > > >in member function calcFollowList. I don't know the reason why it 
is
> > > >hanging.
> > > >Here is the code snippet I am using
> > > >
> > > >const bool schemaFullChecking = true;
> > > >
> > > >SAX2XMLReaderImpl* parser = new
> > > >SAX2XMLReaderImpl(XMLPlatformUtils::fgMemoryManager, grammarPool);
> > > >Janitor<SAX2XMLReaderImpl> janParser(parser);
> > > >
> > > >parser->setFeature(XMLUni::fgSAX2CoreNameSpaces, true);
> > > >parser->setFeature(XMLUni::fgXercesSchema, true);
> > > >parser->setFeature(XMLUni::fgXercesSchemaFullChecking,
> > > >schemaFullChecking);
> > > >parser->setFeature(XMLUni::fgSAX2CoreNameSpacePrefixes, false);
> > > >parser->setFeature(XMLUni::fgSAX2CoreValidation, true);
> > > >parser->setFeature(XMLUni::fgXercesDynamic, true);
> > > >XSDErrorHandler* errorHandler = new XSDErrorHandler();
> > > >Janitor<XSDErrorHandler> janErrorHandler(errorHandler);
> > > >parser->setErrorHandler(errorHandler);
> > > >Grammar* result = parser->loadGrammar(xsdFileName,
> > > >Grammar::SchemaGrammarType, true);
> > > >
> > > >
> > > >I am also giving the xsd file I am using. It is simple xsd file.
> > > >
> > > ><?xml version="1.0"?>
> > > ><xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> > > >targetNamespace="http://xsdtesting" xmlns:x="http://xsdtesting"
> > > >xmlns:imp="http://importedXSD">
> > > >         <xsd:complexType name="B">
> > > >                 <xsd:sequence>
> > > >                         <xsd:element name="foo" minOccurs="1" 
> > maxOccurs="1"/>
> > > >                         <xsd:any namespace="##any" minOccurs="0"
> > > > maxOccurs="unbounded"/>
> > > >                 </xsd:sequence>
> > > >         </xsd:complexType>
> > > >         <xsd:complexType name="R">
> > > >                 <xsd:complexContent>
> > > >                         <xsd:restriction base="x:B">
> > > >                                 <xsd:sequence>
> > > >                                         <xsd:element name="foo"
> > > > minOccurs="1" maxOccurs="1"/>
> > > >                                         <xsd:choice minOccurs="1"
> > > > maxOccurs="1">
> > > >                                                 <xsd:element
> > > > name="e1" minOccurs="1" maxOccurs="30000"/>
> > > >                                         </xsd:choice>
> > > >                                 </xsd:sequence>
> > > >                         </xsd:restriction>
> > > >                 </xsd:complexContent>
> > > >         </xsd:complexType>
> > > >         <xsd:element name="doc">
> > > >                 <xsd:complexType>
> > > >                         <xsd:choice>
> > > >                                 <xsd:element name="elem" 
type="x:R"/>
> > > >                         </xsd:choice>
> > > >                 </xsd:complexType>
> > > >         </xsd:element>
> > > ></xsd:schema>
> > > >
> > > >
> > > >Thanks.
> > > >Regards,
> > > >Umesh
> > > >
> > > >
> > > 
>---------------------------------------------------------------------
> > > >To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
> > > >For additional commands, e-mail: c-dev-help@xerces.apache.org
> > >
> > >
> > > 
---------------------------------------------------------------------
> > > To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
> > > For additional commands, e-mail: c-dev-help@xerces.apache.org
> > >
> > >
> >
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
> >For additional commands, e-mail: c-dev-help@xerces.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
> For additional commands, e-mail: c-dev-help@xerces.apache.org

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


Re: load grammar function of class SAX2XMLReaderImpl is hanging

Posted by Alberto Massari <am...@datadirect.com>.
At 13.02 16/03/2007 +0530, Umesh Chandak wrote:
>Hi ,
>Thanks, It worked this time. But can you tell me why it is happening.
>what is the problem with the figure 30000.
>Is this a bug in xerces?
>If not does it documented some where.

It's a known limitation of Xerces:
http://xml.apache.org/xerces-c/schema.html#limitation

Alberto


>Thanks.
>Regards,
>Umesh
>On Fri, 2007-03-16 at 08:00 +0100, Alberto Massari wrote:
> > Hi Umesh,
> > the reason is the maxOccurs=30000; I would suggest to change it to be
> > unbounded.
> >
> > Alberto
> >
> > At 12.28 16/03/2007 +0530, Umesh Chandak wrote:
> > >Hi All,
> > >I am using the loadGrammar function of class SAX2XMLReaderImpl for
> > >loadding the grammar of XSD. But it is hanging in class DFAContentModel
> > >in member function calcFollowList. I don't know the reason why it is
> > >hanging.
> > >Here is the code snippet I am using
> > >
> > >const bool schemaFullChecking = true;
> > >
> > >SAX2XMLReaderImpl* parser = new
> > >SAX2XMLReaderImpl(XMLPlatformUtils::fgMemoryManager, grammarPool);
> > >Janitor<SAX2XMLReaderImpl> janParser(parser);
> > >
> > >parser->setFeature(XMLUni::fgSAX2CoreNameSpaces, true);
> > >parser->setFeature(XMLUni::fgXercesSchema, true);
> > >parser->setFeature(XMLUni::fgXercesSchemaFullChecking,
> > >schemaFullChecking);
> > >parser->setFeature(XMLUni::fgSAX2CoreNameSpacePrefixes, false);
> > >parser->setFeature(XMLUni::fgSAX2CoreValidation, true);
> > >parser->setFeature(XMLUni::fgXercesDynamic, true);
> > >XSDErrorHandler* errorHandler = new XSDErrorHandler();
> > >Janitor<XSDErrorHandler> janErrorHandler(errorHandler);
> > >parser->setErrorHandler(errorHandler);
> > >Grammar* result = parser->loadGrammar(xsdFileName,
> > >Grammar::SchemaGrammarType, true);
> > >
> > >
> > >I am also giving the xsd file I am using. It is simple xsd file.
> > >
> > ><?xml version="1.0"?>
> > ><xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> > >targetNamespace="http://xsdtesting" xmlns:x="http://xsdtesting"
> > >xmlns:imp="http://importedXSD">
> > >         <xsd:complexType name="B">
> > >                 <xsd:sequence>
> > >                         <xsd:element name="foo" minOccurs="1" 
> maxOccurs="1"/>
> > >                         <xsd:any namespace="##any" minOccurs="0"
> > > maxOccurs="unbounded"/>
> > >                 </xsd:sequence>
> > >         </xsd:complexType>
> > >         <xsd:complexType name="R">
> > >                 <xsd:complexContent>
> > >                         <xsd:restriction base="x:B">
> > >                                 <xsd:sequence>
> > >                                         <xsd:element name="foo"
> > > minOccurs="1" maxOccurs="1"/>
> > >                                         <xsd:choice minOccurs="1"
> > > maxOccurs="1">
> > >                                                 <xsd:element
> > > name="e1" minOccurs="1" maxOccurs="30000"/>
> > >                                         </xsd:choice>
> > >                                 </xsd:sequence>
> > >                         </xsd:restriction>
> > >                 </xsd:complexContent>
> > >         </xsd:complexType>
> > >         <xsd:element name="doc">
> > >                 <xsd:complexType>
> > >                         <xsd:choice>
> > >                                 <xsd:element name="elem" type="x:R"/>
> > >                         </xsd:choice>
> > >                 </xsd:complexType>
> > >         </xsd:element>
> > ></xsd:schema>
> > >
> > >
> > >Thanks.
> > >Regards,
> > >Umesh
> > >
> > >
> > >---------------------------------------------------------------------
> > >To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
> > >For additional commands, e-mail: c-dev-help@xerces.apache.org
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
> > For additional commands, e-mail: c-dev-help@xerces.apache.org
> >
> >
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
>For additional commands, e-mail: c-dev-help@xerces.apache.org


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


Re: load grammar function of class SAX2XMLReaderImpl is hanging

Posted by Umesh Chandak <um...@gs-lab.com>.
Hi ,
Thanks, It worked this time. But can you tell me why it is happening.
what is the problem with the figure 30000.
Is this a bug in xerces?
If not does it documented some where. 

Thanks.
Regards,
Umesh  
On Fri, 2007-03-16 at 08:00 +0100, Alberto Massari wrote:
> Hi Umesh,
> the reason is the maxOccurs=30000; I would suggest to change it to be 
> unbounded.
> 
> Alberto
> 
> At 12.28 16/03/2007 +0530, Umesh Chandak wrote:
> >Hi All,
> >I am using the loadGrammar function of class SAX2XMLReaderImpl for
> >loadding the grammar of XSD. But it is hanging in class DFAContentModel
> >in member function calcFollowList. I don't know the reason why it is
> >hanging.
> >Here is the code snippet I am using
> >
> >const bool schemaFullChecking = true;
> >
> >SAX2XMLReaderImpl* parser = new
> >SAX2XMLReaderImpl(XMLPlatformUtils::fgMemoryManager, grammarPool);
> >Janitor<SAX2XMLReaderImpl> janParser(parser);
> >
> >parser->setFeature(XMLUni::fgSAX2CoreNameSpaces, true);
> >parser->setFeature(XMLUni::fgXercesSchema, true);
> >parser->setFeature(XMLUni::fgXercesSchemaFullChecking,
> >schemaFullChecking);
> >parser->setFeature(XMLUni::fgSAX2CoreNameSpacePrefixes, false);
> >parser->setFeature(XMLUni::fgSAX2CoreValidation, true);
> >parser->setFeature(XMLUni::fgXercesDynamic, true);
> >XSDErrorHandler* errorHandler = new XSDErrorHandler();
> >Janitor<XSDErrorHandler> janErrorHandler(errorHandler);
> >parser->setErrorHandler(errorHandler);
> >Grammar* result = parser->loadGrammar(xsdFileName,
> >Grammar::SchemaGrammarType, true);
> >
> >
> >I am also giving the xsd file I am using. It is simple xsd file.
> >
> ><?xml version="1.0"?>
> ><xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> >targetNamespace="http://xsdtesting" xmlns:x="http://xsdtesting"
> >xmlns:imp="http://importedXSD">
> >         <xsd:complexType name="B">
> >                 <xsd:sequence>
> >                         <xsd:element name="foo" minOccurs="1" maxOccurs="1"/>
> >                         <xsd:any namespace="##any" minOccurs="0" 
> > maxOccurs="unbounded"/>
> >                 </xsd:sequence>
> >         </xsd:complexType>
> >         <xsd:complexType name="R">
> >                 <xsd:complexContent>
> >                         <xsd:restriction base="x:B">
> >                                 <xsd:sequence>
> >                                         <xsd:element name="foo" 
> > minOccurs="1" maxOccurs="1"/>
> >                                         <xsd:choice minOccurs="1" 
> > maxOccurs="1">
> >                                                 <xsd:element 
> > name="e1" minOccurs="1" maxOccurs="30000"/>
> >                                         </xsd:choice>
> >                                 </xsd:sequence>
> >                         </xsd:restriction>
> >                 </xsd:complexContent>
> >         </xsd:complexType>
> >         <xsd:element name="doc">
> >                 <xsd:complexType>
> >                         <xsd:choice>
> >                                 <xsd:element name="elem" type="x:R"/>
> >                         </xsd:choice>
> >                 </xsd:complexType>
> >         </xsd:element>
> ></xsd:schema>
> >
> >
> >Thanks.
> >Regards,
> >Umesh
> >
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
> >For additional commands, e-mail: c-dev-help@xerces.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
> For additional commands, e-mail: c-dev-help@xerces.apache.org
> 
> 


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


Re: load grammar function of class SAX2XMLReaderImpl is hanging

Posted by Alberto Massari <am...@datadirect.com>.
Hi Umesh,
the reason is the maxOccurs=30000; I would suggest to change it to be 
unbounded.

Alberto

At 12.28 16/03/2007 +0530, Umesh Chandak wrote:
>Hi All,
>I am using the loadGrammar function of class SAX2XMLReaderImpl for
>loadding the grammar of XSD. But it is hanging in class DFAContentModel
>in member function calcFollowList. I don't know the reason why it is
>hanging.
>Here is the code snippet I am using
>
>const bool schemaFullChecking = true;
>
>SAX2XMLReaderImpl* parser = new
>SAX2XMLReaderImpl(XMLPlatformUtils::fgMemoryManager, grammarPool);
>Janitor<SAX2XMLReaderImpl> janParser(parser);
>
>parser->setFeature(XMLUni::fgSAX2CoreNameSpaces, true);
>parser->setFeature(XMLUni::fgXercesSchema, true);
>parser->setFeature(XMLUni::fgXercesSchemaFullChecking,
>schemaFullChecking);
>parser->setFeature(XMLUni::fgSAX2CoreNameSpacePrefixes, false);
>parser->setFeature(XMLUni::fgSAX2CoreValidation, true);
>parser->setFeature(XMLUni::fgXercesDynamic, true);
>XSDErrorHandler* errorHandler = new XSDErrorHandler();
>Janitor<XSDErrorHandler> janErrorHandler(errorHandler);
>parser->setErrorHandler(errorHandler);
>Grammar* result = parser->loadGrammar(xsdFileName,
>Grammar::SchemaGrammarType, true);
>
>
>I am also giving the xsd file I am using. It is simple xsd file.
>
><?xml version="1.0"?>
><xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>targetNamespace="http://xsdtesting" xmlns:x="http://xsdtesting"
>xmlns:imp="http://importedXSD">
>         <xsd:complexType name="B">
>                 <xsd:sequence>
>                         <xsd:element name="foo" minOccurs="1" maxOccurs="1"/>
>                         <xsd:any namespace="##any" minOccurs="0" 
> maxOccurs="unbounded"/>
>                 </xsd:sequence>
>         </xsd:complexType>
>         <xsd:complexType name="R">
>                 <xsd:complexContent>
>                         <xsd:restriction base="x:B">
>                                 <xsd:sequence>
>                                         <xsd:element name="foo" 
> minOccurs="1" maxOccurs="1"/>
>                                         <xsd:choice minOccurs="1" 
> maxOccurs="1">
>                                                 <xsd:element 
> name="e1" minOccurs="1" maxOccurs="30000"/>
>                                         </xsd:choice>
>                                 </xsd:sequence>
>                         </xsd:restriction>
>                 </xsd:complexContent>
>         </xsd:complexType>
>         <xsd:element name="doc">
>                 <xsd:complexType>
>                         <xsd:choice>
>                                 <xsd:element name="elem" type="x:R"/>
>                         </xsd:choice>
>                 </xsd:complexType>
>         </xsd:element>
></xsd:schema>
>
>
>Thanks.
>Regards,
>Umesh
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
>For additional commands, e-mail: c-dev-help@xerces.apache.org


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