Claims
- 1. A system to process an XML document, comprising:
a streaming parser capable of parsing an XML document and generating a stream of at least one event, wherein each event can represent a portion of the document; a matching component capable of performing matching on an event in the stream and notifying an observer if the event is a match; said observer capable of listening for a matching event and passing it to a user object; and said user object capable of handling the matching event.
- 2. The system according to claim 1, wherein:
the XML document is represented in a hierarchical structure.
- 3. The system according to claim 2, wherein:
the hierarchical structure can be a tree with each node containing a portion of the document.
- 4. The system according to claim 3, wherein:
the streaming parser is capable of performing a method, comprising:
traversing the XML tree and adding visited nodes into a data structure; processing the nodes in the data structure and generating an event for each node; and appending the event to the output stream.
- 5. The system according to claim 4, wherein:
the tree can be traversed using a breath-first or depth-first search.
- 6. The system according to claim 4, wherein:
the data structure can be a queue.
- 7. The system according to claim 4, wherein:
the data structure can be processed using a first-in-first-out approach.
- 8. The system according to claim 1, wherein:
the matching component is capable of keeping only a portion of the XML document in memory at any given time.
- 9. The system according to claim 1, wherein:
the matching component is capable of knowing the schema of the XML document and foreseeing the coming events.
- 10. The system according to claim 1, wherein:
the matching component is capable of performing an expression-based match, which can be an XPath query.
- 11. The system according to claim 3, wherein:
the matching component is capable of keeping, cloning and destroying the entirety or a portion of the sub-tree descending from a node in the tree.
- 12. The system according to claim 1, wherein:
the user object is capable of returning the matching event to an XML stream for use by any other component.
- 13. A method for processing an XML document, comprising:
parsing an XML document and generating a stream of at least one event, wherein each event can represent a portion of the document; performing matching on an event in the stream and notifying an observer if the event is a match; listening for a matching event and passing it to a user object; and handling the matching event.
- 14. The method according to claim 13, further comprising:
representing the XML document in a hierarchical structure, which can be a tree with each node containing a portion of the document.
- 15. The method according to claim 14, wherein:
the parsing of the XML document comprises the steps of:
traversing the XML tree and adding visited nodes into a data structure; processing the nodes in the data structure and generating an event for each node; and appending the event to the output stream.
- 16. The method according to claim 15, wherein:
the XML tree is traversed using a breath-first or depth-first search.
- 17. The method according to claim 15, wherein:
the data structure is processed using a first-in-first-out approach.
- 18. The method according to claim 13, further comprising:
keeping only a portion of the XML document in memory at any given time.
- 19. The method according to claim 13, further comprising:
knowing the schema of the XML document and foreseeing the coming events.
- 20. The method according to claim 13, further comprising:
performing an expression-based match, which can be an XPath query.
- 21. The method according to claim 14, further comprising:
keeping, cloning and destroying the entirety or a portion of the sub-tree descending from a node in the tree.
- 22. The method according to claim 13, further comprising:
returning the matching event to an XML stream for use by any other component.
- 23. A machine readable medium having instructions stored thereon that when executed by a processor cause a system to:
parse an XML document and generate a stream of at least one event, wherein each event can represent a portion of the document; perform matching on an event in the stream and notify an observer if the event is a match; listen for a matching event and pass it to a user object; and handle the matching event.
- 24. The machine readable medium of claim 23, further comprising instructions that when executed cause the system to:
represent the XML document in a hierarchical structure, which can be a tree with each node containing a portion of the document.
- 25. The machine readable medium of claim 24, wherein the instructions that when executed cause the system to:
parse the XML document, comprising the steps of:
traversing the XML tree and adding visited nodes into a data structure; processing the nodes in the data structure and generating an event for each node; and appending the event to the output stream.
- 26. The machine readable medium of claim 25, wherein the instructions that when executed cause the system to:
traverse the tree using a breath-first or depth-first search.
- 27. The machine readable medium of claim 25, wherein the instructions that when executed cause the system to:
process the data structure using a first-in-first-out approach.
- 28. The machine readable medium of claim 23, further comprising instructions that when executed cause the system to:
perform an expression-based match, which can be an XPath query.
- 29. The machine readable medium of claim 23, further comprising instructions that when executed cause the system to:
keep only a portion of the XML document in memory at any given time.
- 30. The machine readable medium of claim 23, further comprising instructions that when executed cause the system to:
know the schema of the XML document and foresee the coming events.
- 31. The machine readable medium of claim 24, further comprising instructions that when executed cause the system to:
keep, clone and destroy the entirety or a portion of the sub-tree descending from a node in the tree.
- 32. The machine readable medium of claim 23, further comprising instructions that when executed cause the system to:
return the matching event to an XML stream for use by any other component.
- 33. A system for processing an XML document, comprising:
means for parsing an XML document and generating a stream of at least one event, wherein each event can represent a portion of the document; means for performing matching on an event in the stream and notifying an observer if the event is a match; means for listening for a matching event and passing it to a user object; and means for handling the matching event.
- 34. A computer data signal embodied in a transmission medium, comprising:
a code segment including instructions to parse an XML document and generate a stream of at least one event, wherein each event can represent a portion of the document; a code segment including instructions to perform matching on an event in the stream and notify an observer if the event is a match; a code segment including instructions to listen for a matching event and pass it to a user object; and a code segment including instructions to handle the matching event.
CLAIM OF PRIORITY
[0001] This application claims priority from the following application, which is hereby incorporated by reference in its entirety:
[0002] U.S. Provisional Application No. 60/451,313, entitled SYSTEMS AND METHODS FOR STREAMING XPATH QUERY, by Patrick Calahan, filed on Feb. 28, 2003 (Attorney Docket No. BEAS-01330US0 SRM/DTX).
[0003] The following applications are cross-referenced and incorporated herein by reference in its entirety:
[0004] U.S. patent application Ser. No. 10/304,207 entitled “Streaming Parser API,” by Chris Fry et al., filed Nov. 26, 2002.
Provisional Applications (1)
|
Number |
Date |
Country |
|
60451313 |
Feb 2003 |
US |