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: [EMAIL PROTECTED]
> > > >For additional commands, e-mail: [EMAIL PROTECTED]
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > >
> > >
> >
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: [EMAIL PROTECTED]
> >For additional commands, e-mail: [EMAIL PROTECTED]
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]