logo       

Re: possible bug while validating schemas: msg#00088

Subject: Re: possible bug while validating schemas
That will probably be good enough but it really depends on how much memory 
you have.

Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: mrglavas@xxxxxxxxxx
E-mail: mrglavas@xxxxxxxxxx

"Paul Tomsic" <ptomsic@xxxxxxxxx> wrote on 10/30/2006 11:27:48 AM:

> okay, just for a sanity check on this, would something like this seem
> to be the appropriate use of the SecurityManager to fulfill my needs
> of not running out of memory?
> 
>        SAXParser parser = new SAXParser();
>        parser.setFeature("http://xml.org/sax/features/validation";, 
true);
> parser.setFeature("http://apache.org/xml/features/validation/schema";,
> true);
>        parser.setFeature("http://apache.
> org/xml/features/validation/schema-full-checking",
> true);
>        .....
>        SecurityManager securityManager = new SecurityManager();
> 
> securityManager.setMaxOccurNodeLimit(5000);
> 
> parser.setProperty("http://apache.org/xml/properties/security-manager";,
> securityManager);
> 
> 
> thanks again
> 
> 
> On 10/29/06, Michael Glavassevich <mrglavas@xxxxxxxxxx> wrote:
> > Hi Paul,
> >
> > You can avoid the OOM error by setting the JAXP secure processing 
feature
> > [1] or a SecurityManager [2][3]. This puts a limit on the maxOccurs 
values
> > in the schema. A fatal error is emitted if the limit is exceeded.
> >
> > Thanks.
> >
> > [1]
> > http://xerces.apache.org/xerces2-
> j/javadocs/api/javax/xml/XMLConstants.html#FEATURE_SECURE_PROCESSING
> > [2] 
http://xerces.apache.org/xerces2-j/properties.html#security-manager
> > [3]
> > http://xerces.apache.org/xerces2-
> j/javadocs/xerces2/org/apache/xerces/util/SecurityManager.html
> >
> > Michael Glavassevich
> > XML Parser Development
> > IBM Toronto Lab
> > E-mail: mrglavas@xxxxxxxxxx
> > E-mail: mrglavas@xxxxxxxxxx
> >
> > "Paul Tomsic" <ptomsic@xxxxxxxxx> wrote on 10/29/2006 11:10:17 PM:
> >
> > > ah, of course.  great catch.  thank you.
> > > is there an obvious way to trap for this?
> > >
> > > i'm working for a large organization that tends to have 1000's of 
ppl
> > > that could be the maker of the XSD.
> > >
> > > short of me making an FAQ page of best-practices (which no one will
> > > read) can i programatically trap for this type of thing, as opposed 
to
> > > having minor issues like this occur, thus causing an OOM error?
> > >
> > > thanks again
> > >
> > >
> > > On 10/29/06, Michael Glavassevich <mrglavas@xxxxxxxxxx> wrote:
> > > > Hi Paul,
> > > >
> > > > This happens because you have maxOccurs="50000" on "
> > > > originDestinationPair". The larger the value of maxOccurs the more
> > memory
> > > > Xerces requires to build the DFA representation of the content 
model.
> > If
> > > > the value is sufficiently large you'll run out of memory. The
> > workaround
> > > > for this limitation [1] has always been to change large maxOccurs
> > values
> > > > to unbounded.
> > > >
> > > > Thanks.
> > > >
> > > > [1] http://xerces.apache.org/xerces2-j/xml-schema.html
> > > >
> > > > Michael Glavassevich
> > > > XML Parser Development
> > > > IBM Toronto Lab
> > > > E-mail: mrglavas@xxxxxxxxxx
> > > > E-mail: mrglavas@xxxxxxxxxx
> > > >
> > > > "Paul Tomsic" <ptomsic@xxxxxxxxx> wrote on 10/27/2006 05:42:36 PM:
> > > >
> > > > > I think i've found a bug in xerces 2.8.1.
> > > > > I've attached a tarball that reproduces the error.
> > > > > The error is "OutOfMemoryError: Java heap space"
> > > > >
> > > > > the situation is an XML file points to a XSD which contains 
several
> > > > > "included" XSDs.
> > > > > one of those XSD's has a mismatched targetNamespace.
> > > > >
> > > > > While stepping thru the code in a debugger, it does find the 
problem
> > > > > and record the correct SAXParseException, but it continues to
> > traverse
> > > > > the tree of included XSDs, thus causing the heap space out of 
memory
> > > > > situation.
> > > > >
> > > > > hopefully it's something that i'm doing wrong, though.   any
> > thoughts
> > > > helpful.
> > > > >
> > > > > To run the attached tarball, simply expand it, load up the "lib"
> > > > directory w/
> > > > > -xercesImpl 2.8.1
> > > > > -xml-apis 2.8.1
> > > > > -resolver - the version that ships w/ xerces 2.8.1
> > > > >
> > > > > then run the "run.sh" shell script.
> > > > >
> > > > > thanks
> > > > >
> > > > >
> > ---------------------------------------------------------------------
> > > > > To unsubscribe, e-mail: j-users-unsubscribe@xxxxxxxxxxxxxxxxx
> > > > > For additional commands, e-mail: j-users-help@xxxxxxxxxxxxxxxxx
> > > >
> > > > 
---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: j-users-unsubscribe@xxxxxxxxxxxxxxxxx
> > > > For additional commands, e-mail: j-users-help@xxxxxxxxxxxxxxxxx
> > > >
> > > >
> > >
> > > 
---------------------------------------------------------------------
> > > To unsubscribe, e-mail: j-users-unsubscribe@xxxxxxxxxxxxxxxxx
> > > For additional commands, e-mail: j-users-help@xxxxxxxxxxxxxxxxx
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: j-users-unsubscribe@xxxxxxxxxxxxxxxxx
> > For additional commands, e-mail: j-users-help@xxxxxxxxxxxxxxxxx
> >
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: j-users-unsubscribe@xxxxxxxxxxxxxxxxx
> For additional commands, e-mail: j-users-help@xxxxxxxxxxxxxxxxx


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
boot-loaders.gr...    php.pear.genera...    debugging.valgr...    kde.redhat.user...    text.xml.xsl.ge...    culture.languag...    hardware.microc...    java.servicemix...    redhat.release....    web.zope.plone....    user-groups.lin...    opendarwin.webk...    video.mjpeg.use...    sysutils.bcfg2....    encryption.gpg....    lx-office.devel...    xfree86.forum/2...    mail.mutt.devel...    acpi.devel/2003...    qnx.openqnx.dev...    network.irc.irs...    freebsd.devel.m...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe