Browse Prior Art Database

A State Driven Method And System For Serializing An XML

IP.com Disclosure Number: IPCOM000236734D
Publication Date: 2014-May-13
Document File: 4 page(s) / 55K

Publishing Venue

The IP.com Prior Art Database

Abstract

A state driven method and system is disclosed for serializing XML documents. The method and system guarantees that the XML conforms to a given XML schema. The method can only be used for non-recursive XML schemas. The XML schema is parsed, and a start state and an end state is created for each element declaration in the XML schema. Thereafter, allowed state transitions are derived from structure of the XML schema. During serialization, a current state is tracked and if there is no allowed transition from the current state to a state where a user intends to write next, then a corresponding validation fails.

This text was extracted from a PDF file.
This is the abbreviated version, containing approximately 36% of the total text.

Page 01 of 4

A State Driven Method And System For Serializing An XML

Disclosed is a state driven method and system for serializing an Extensible Markup Language (XML) document that is guaranteed to conform to a given XML Schema. The method can only be used for non-recursive XML schemas. For most applications, this is not an issue since recursive XML schemas are not that common. This assumption simplifies the problems and allows the serialization of the XML content to be modeled as a state machine. The method and system serializes XML tags as they are obtained thereby avoiding a need of maintaining the tags in memory and rereading a corresponding document. The method validates the XML being generated on the fly by checking that at the transition from the current state to a state corresponding to the new content is allowed.

In an embodiment of the present invention, an application utilizes an Application Programming Interface (API) to create an XML document. Initially, the method includes a step of parsing a Document Type Definition (DTD) or XML Schema Definition (XSD) for the document to be serialized. For each element declaration within the XML Schema, following states are created: a start element state, an end element state, a text state if the element contains text, and a new set of states for element declarations in declaration of the element's type.

The states are based on element declarations rather than the element names, thereby avoiding ambiguity in cases where an element with the same name appears in multiple places in the document. In addition, for each element declaration, a brand new set of states is created for all element declarations that occur within the declaration of the element type. Here, the step of creating the brand new set of states is performed recursively. This allows the method and system to properly record transitions when an element type is used in multiple places within the XML schema.

Each start element state also includes information about whether text content is allowed and the names, types, and optionality of corresponding attributes and also stores information about the element multiplicity. The method and system stores the minimum and maximum number of times that the element can occur. In addition, the state can be part of an element group which also has a multiplicity associated with it. Element groups record when some set of state transitions has a multiplicity that was defined in the XML schema.

After identifying the states, the method and system determines transitions that are allowed between the states based on structure of the XML Schema. An initial START state and a final DONE state are also created, and transitions for them are added as

well.

During serialization, the method and system maintains a stack for storing state information for each element in a current path. For each element, a multiplicity of each of the child elements is tracked for detecting multiplicity violations.

1


Page 02 of 4

In an...