# US 2004/0168124 A1 · System and method of mapping between software objects & structured language element-based documents

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 2004/0168124 A1
- Document ID: US20040168124A1
- Status: Published application
- Kind: A1
- Application number: 10/479,671
- Filed: 2003-12-04
- Published: 2004-08-26
- Earliest claimed: 2001-06-07
- Inventors: Michael Beisiegel; John Green; Jay W. Warfield
- Web page: https://patentgrep.com/patent/US20040168124A1

## CPC

- G06F 40/154: Tree transformation for tree-structured or markup documents, e.g. XSLT, XSL-FO or stylesheets
- G06F 40/143: Markup, e.g. Standard Generalized Markup Language [SGML] or Document Type Definition [DTD]
- G06F 40/226: Validation
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

A method and system that provides a common framework for mapping between a document (e.g. an XML document) and a software object (e.g. a Java object). The framework uses a handler that masks how a property is obtained for mapping. This results in mapping code that has a common appearance for both directions of mapping. A mapping between elements of an XML document and the properties of a Java object is contained in a mapper. A mapper maps from the XML document (108) to an object (110) using a parser (104) (such as DOM or SAX). Mapping in the other direction (Java to XML) requires that the elements of the XML document (118) be built in a particular order to ensure validity of the resulting XML document (118). The present invention builds an XML template document using JSP, for example. Using JSP based templates enables tags of the document to be written in the JSP, with callbacks to get element and attribute values. Further, content can be directed to a buffer, or directly to a response stream of a servlet.

## Claims

### Claim 1

A computer-implemented method for converting a data structure representing a software object to structured language elements of a document, the method comprising:
(a) generating a structured language element template document;
(b) reading properties from the software object, the properties being associated with the structured language elements of the document;
(c) using the properties, obtaining constructs defined by the structured language elements based on the association between the properties and the structured language elements; and
(d) populating the structured language element template document with the constructs.

### Claim 2 (depends on 1)

The computer-implemented method of claim 1, wherein step (c) includes direct call back to the software object to obtain properties that represent the constructs that define structure and content of the document.

### Claim 3 (depends on 1)

The computer-implemented method of claim 1, wherein step (c) includes creating an object model that represents structure and content of the document.

### Claim 4 (depends on 1)

The computer-implemented method of claim 1, wherein the structured language elements represent Extensible Markup Language (XML) constructs.

### Claim 5 (depends on 1)

The computer-implemented method of claim 1, wherein step (c) includes constructing a loop in the template document to process repeating structures language elements.

### Claim 6

A computer-implemented method for converting structured language elements of a document to a data structure representing a software object, the method comprising:
(a) reading each of the structured language elements of the document;
(b) determining a property, selected from a set of available properties defined by the data structure of the software object, associated with structured language elements of the document; and
(c) populating the properties of the data structure representing the software object with structured language element values from the document.

### Claim 7 (depends on 6)

The computer-implemented method of claim 6, wherein step (a) includes generating events that represent structure and content of the document.

### Claim 8 (depends on 6)

The computer-implemented method of claim 6, wherein step (a) includes calling back to a handler with events that represent structure and content of the document.

### Claim 9 (depends on 6)

The computer-implemented method of claim 6, wherein step (a) includes creating an object model that represents structure and content of the document.

### Claim 10 (depends on 6)

The computer-implemented method of claim 6, wherein the structured language elements represent Extensible Markup Language (XML) constructs and step (a) further includes enforcing Document Type Definition (DTD) and XML schema standards.

### Claim 11 (depends on 10)

The computer-implemented method of claim 10, further comprising maintaining a stack for recursive XML constructs.

### Claim 12

A system for converting a software object (116) containing properties to a document (118) defined by structured language elements, the system comprising:
(a) a document template (112);
(b) a handler interface (114-1)for providing a representation of the structured language elements of the document (118) based on call backs made by the document template (112);
(c) a mapping module(114-2, 114-3), in communication with the handler interface (114-1), for converting properties of the software objects (116) to structured language elements recognized by the document (118); and
(d) an output target class (114-4), in communication with the mapping module (114-2, 114-3), for writing the structured language elements generated in step (c) to the document (118).

### Claim 13 (depends on 12)

The system of claim 12, wherein the mapping module includes a mapping interface (114-2) for executing the conversion of the properties to the structured language elements and for setting an output target stream of the document (118) and a mapping class (114-3) for providing methods used by the mapping interface (114-2).

### Claim 14 (depends on 13)

The system of claim 13, wherein the output target stream is defined as a buffer.

### Claim 15 (depends on 13)

The system of claim 13, wherein the output target stream is defined as a response stream of a servlet.

### Claim 16 (depends on 12)

The system of claim 12, wherein the structured language elements represent Extensible Markup Language (XML) constructs.

### Claim 17 (depends on 16)

The system of claim 16, wherein the document template is created using JavaServer Pages (JSP).

### Claim 18

A system for converting a document (108) containing structured language elements to a software object (110), the system comprising:
(a) a parser (104) for obtaining events representative of features of the document (108);
(b) an input source class (106-1) for reading the document (108);
(c) a content handler class (106-2), in communication with the input source class (106-1), for implementing a buffer for the events obtained by the parser (104); and
(d) a mapping module (106-3, 106-4), in communication with the content handler class (106-2), for converting the events obtained by the parser (104) to properties for the software object (110).

### Claim 19 (depends on 18)

The system of claim 18, wherein the mapping module includes a mapping interface (106-4) for executing the conversion of the events to the properties and for setting an output target stream of the software object (110) and a mapping class (106-3) for providing methods used by the mapping interface (106-4).

### Claim 20 (depends on 19)

The system of claim 19, wherein the structured language elements represent Extensible Markup Language (XML) constructs.

### Claim 21

A method of converting a software object having properties to a document represented by structured language elements, the method comprising:
(a) supplying the software object to an instance of an invoked mapping interface;
(b) compiling and executing a template using an instance of an invoked container; and
(c) writing the document to a specified output stream using the compiled template.

### Claim 22 (depends on 21)

The method of claim 21, further comprising calling back to the mapping interface to maintain state of processing.

### Claim 23 (depends on 21)

The method of claim 21, further comprising calling an isOptionalElementPresent method through the compiled template to determine if selected portions of the document are to be generated.

### Claim 24 (depends on 21)

The method of claim 21, further comprising calling an isOptionalAttributePresent method through the compiled template to determine if selected portions of the document are to be generated.

### Claim 25 (depends on 21)

The method of claim 21, further comprising maintaining a state of processing using a stack when generating complex types within the document, said complex types selected from the group consisting of: an array, recursion and a complex type being contained within another complex type.

### Claim 26 (depends on 25)

The method of claim 25, wherein the state of the stack is maintained by call backs from the compiled template to the mapping interface to indicate when the complex types start and end.

### Claim 27 (depends on 21)

The method of claim 21, further comprising calling a getElementRepetitions method to determine how many times the template loops over selected portions of the document.

### Claim 28 (depends on 21)

The method of claim 21, wherein the structured language elements represent Extensible Markup Language (XML) constructs and the template is created using JavaServer Pages (JSP).

### Claim 29

A method of converting a document containing structured language elements to a software object, the method comprising:
(a) supplying the document to an instance of an invoked mapping interface;
(b) registering the mapping interface as a content handler;
(c) parsing the document using an instance of an invoked parser; and
(d) populating the software object with properties associated with structured language elements parsed from the document through call backs made to the mapping interface.

### Claim 30 (depends on 29)

The method of claim 29, wherein step (d) includes call backs to invoke methods selected from the group consisting of: startDocument, startElement, characters, endElement, and endDocument.

### Claim 31 (depends on 30)

The method of claim 30, wherein the startDocument and startElement methods executed by the mapping interface creates the software object.

### Claim 32 (depends on 29)

The method of claim 29, wherein the endElement method executed by the mapping interface sets the properties into the software object.

### Claim 33 (depends on 29)

The method of claim 29, wherein the structured language elements represent Extensible Markup Language (XML) constructs.

### Claim 34

A computer program product for converting a data structure representing a software object to structured language elements of a document, the computer program product comprising computer readable program code devices for:
(a) generating a structured language element template document;
(b) reading properties from the software object, the properties being associated with the structured language elements of the document;
(c) using the properties, obtaining constructs defined by the structured language elements based on the association between the properties and the structured language elements; and
(d) populating the structured language element template document with the constructs.

### Claim 35 (depends on 34)

The computer program product of claim 34, wherein step (c) includes direct call back to the software object to obtain events that represent the constructs that define structure and content of the document.

### Claim 36 (depends on 34)

The computer program product of claim 34, wherein step (c) includes creating an object model that represents structure and content of the document.

### Claim 37 (depends on 34)

The computer program product of claim 34, wherein the structured language elements represent Extensible Markup Language (XML) constructs.

### Claim 38 (depends on 34)

The computer program product of claim 34, wherein step (c) includes constructing a loop in the template document to process repeating structures language elements.

### Claim 39

A computer program product for converting structured language elements of a document to a data structure representing a software object, the computer program product comprising computer readable program code devices for:
(a) reading each of the structured language elements of the document;
(b) determining a property, selected from a set of available properties defined by the data structure of the software object, associated with structured language elements of the document; and
(c) populating the properties of the data structure representing the software object with structured language element values from the document.

### Claim 40 (depends on 39)

The computer program product of claim 39, wherein step (a) includes generating events that represent structure and content of the document.

### Claim 41 (depends on 39)

The computer program product of claim 39, wherein step (a) includes calling back to a handler with events that represent structure and content of the document.

### Claim 42 (depends on 39)

The computer program product of claim 39, wherein step (a) includes creating an object model that represents structure and content of the document.

### Claim 43 (depends on 39)

The computer program product of claim 39, wherein the structured language elements represent Extensible Markup Language (XML) constructs and step (a) further includes enforcing Document Type Definition (DTD) and XML schema standards.

### Claim 44 (depends on 43)

The computer program product of claim 43, further comprising maintaining a stack for recursive XML constructs.
