XML streaming transformer
First Claim
Patent Images
1. A computer-implemented method of transforming a document, including:
- receiving events in a stream generated by parsing of an input file using a computer, including a plurality of element start-events, input events and element end-events;
responding to an element start-event for an element by matching an element name for the element to a template name for 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 the named template that was activated in response to the element start-event for the current element, 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. A template specifies a transformation that is applied to a document in a streaming mode, without building a full object tree in memory representing the document.
60 Citations
39 Claims
-
1. A computer-implemented method of transforming a document, including:
-
receiving events in a stream generated by parsing of an input file using a computer, including a plurality of element start-events, input events and element end-events; responding to an element start-event for an element by matching an element name for the element to a template name for 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 the named template that was activated in response to the element start-event for the current element, 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 generated by parsing of an input file using a computer, including a plurality of element start-events, input events and element end-events; responding to an element start-event for an element by matching an element name for the element to a template name for 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 an element name for the nested element to a template name for 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 that was activated in response to the element start-event, 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 method of memory utilization while performing a transformation on an XML document, including:
-
loading a template including one or more subtemplates; processing an event stream resulting from sequentially processing of an input source using a computer, including repeatedly matching a template name for a subtemplate to an element name for 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 that was activated in response to the element start-event 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