Issue Details (XML | Word | Printable)

Key: XERCESJ-773
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Blocker Blocker
Assignee: Michael Glavassevich
Reporter: Steve Baker
Votes: 1
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
Xerces2-J

Poor performance when processing schemas with high values of maxOccurs

Created: 05/Aug/03 10:06 PM   Updated: 25/Aug/07 04:31 PM
Return to search
Component/s: XML Schema 1.0 Structures
Affects Version/s: 2.5.0
Fix Version/s: 2.9.1

Time Tracking:
Not Specified

Environment:
Operating System: Linux
Platform: PC

Bugzilla Id: 22139
Resolution Date: 23/Feb/07 06:24 PM


 Description  « Hide
When validating an instance of an XML order against its schema, the process took
 5 minutes 7 seconds and required an increased maximum heap size to run to
completion.

The problem was traced to a maxOccurs value of 9999 on an element (the
OrderLine). Changing this to unbounded reduced the time taked to 1.16 seconds
and required no increase in the default heap size.

 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Michael Glavassevich added a comment - 23/Feb/07 06:24 PM
I've just committed an improvement to code in SVN which covers a number of common cases. We now build a representation of large minOccurs/maxOccurs in constant time and memory (which uses a counter during validation) for element and wildcard particles when each model group particle in the content model:

* has minOccurs/maxOccurs == 1; or
* contains only one element/wildcard particle with minOccurs/maxOccurs == 1

Handling sequences, choices and nested minOccurs/maxOccurs is somewhat tricker. We would need a more general solution than the one implemented for elements and wildcards to process those gracefully. I've opened a new JIRA issue [1] for tracking that.

[1] http://issues.apache.org/jira/browse/XERCESJ-1227