XML streaming transformer
First Claim
Patent Images
1. A method of transforming a document, including:
- receiving events in a stream, including a plurality of element start-events, input events and element end-events;
responding to an element start-event for an element by matching the element to a named template and activating the named template or, lacking a match, by treating the element as content of a parent element;
responding to an element end-event for a current element using a matching named template, if any, including;
responsive to instructions in the matching named template, outputting at least some of literal text or input events corresponding to the current element;
clearing the input events corresponding to content of the current element; and
deactivating the matching named template.
8 Assignments
0 Petitions
Accused Products
Abstract
The present invention includes devices and methods to specify a document transformation and to transform a document in a streaming mode, without building a full object tree in memory representing the document. Particular aspects of the present invention are described in the claims, specification and drawings.
130 Citations
39 Claims
-
1. A method of transforming a document, including:
-
receiving events in a stream, including a plurality of element start-events, input events and element end-events;
responding to an element start-event for an element by matching the element to a named template and activating the named template or, lacking a match, by treating the element as content of a parent element;
responding to an element end-event for a current element using a matching named template, if any, including;
responsive to instructions in the matching named template, outputting at least some of literal text or input events corresponding to the current element;
clearing the input events corresponding to content of the current element; and
deactivating the matching named template. - View Dependent Claims (2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16)
-
-
17. A computer-implemented method of transforming a document, including:
-
receiving events in a stream, including a plurality of element start-events, input events and element end-events;
responding to an element start-event for an element by matching the element to a named template and activating the named template and variables, if any, in a scope corresponding to the named template;
responding to a nested element start-event by matching the nested element to an additional named template and activating the additional named template and variables, if any, in a scope corresponding to the additional named template or, lacking a match, by treating the nested element as content of the parent element;
responding to input events according to instructions in a most recently activated named template, wherein the instructions optionally include assigning input to one or more of the variables;
responding to an element end-event by processing the corresponding named template, if any, including processing instructions in the named template, wherein the instructions optionally include manipulating the variables and outputting at least some of literal text and the variables;
clearing the variables in a scope of the corresponding named template; and
deactivating the corresponding named template. - View Dependent Claims (18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29)
-
-
30. A memory utilization strategy while performing a transformation on an XML document, including:
-
loading a template including one or more subtemplates;
processing a event stream from an input source, including repeatedly matching a subtemplate to a start-event in the input source;
buffering an input stream until an end-event matched to the start-event is received; and
processing instructions in the subtemplate to transform the buffered input stream, outputting results of the processing and releasing for reuse memory used for the buffering and the processing. - View Dependent Claims (31, 32, 33, 34, 35, 36, 37, 38, 39)
-
Specification