Dismiss
InnovationQ will be updated on Sunday, Oct. 22, from 10am ET - noon. You may experience brief service interruptions during that time.
Browse Prior Art Database

Generic XML Generator from Java Hashtable

IP.com Disclosure Number: IPCOM000013824D
Original Publication Date: 2000-Dec-01
Included in the Prior Art Database: 2003-Jun-18
Document File: 3 page(s) / 132K

Publishing Venue

IBM

Abstract

Disclosed is a method and a program to generate arbitrary XML from a Java Hashtable. In Java Hashtable, first the DTD file name is provided. Secondary, all the values for XML tags are stored in name value pairs (NVPs) format. The Generator uses DTD to construct XML and put the value for each tag in the XML from Hashtable, and finally outputs a XML message. This disclosure will give Java programmers a chance to write applications to generate XML messages without understanding any XML specification. What he should know is the Java Hashtable containing key and values, which will be put into XML message. Input: Java Hashtable (Containing Name Value Pairs)

This text was extracted from a PDF file.
At least one non-text object (such as an image or picture) has been suppressed.
This is the abbreviated version, containing approximately 43% of the total text.

Page 1 of 3

Generic XML Generator from Java Hashtable

Disclosed is a method and a program to generate arbitrary XML from a Java Hashtable. In Java Hashtable, first the DTD file name is provided. Secondary, all the values for XML tags are stored in name value pairs (NVPs) format. The Generator uses DTD to construct XML and put the value for each tag in the XML from Hashtable, and finally outputs a XML message.

This disclosure will give Java programmers a chance to write applications to generate XML messages without understanding any XML specification. What he should know is the Java Hashtable containing key and values, which will be put into XML message.

Input: Java Hashtable

(Containing Name Value Pairs)

DTD files

The input of the XML Generator is a Java Hashtable. In this Hashtable, one name value pair (NVP) is mandatory which is 'dtdName'. The XML Generator will get the DTD file name from 'dtdName' in Hashtable, and read the DTD file. After the XML Generator succeeds to read the DTD file, the Generator knows the document type and version of DTD, also knows all the tags for XML and all the content model (type) of these tags: mandatory or optional, repeatable or not. Now the Generator can construct an empty XML.

The next step is to find the mapping definition. This is done by searching TemplateDefinition in the ECTemplate. Since the Generator already knows the DocumentType and version of DTD, the Generator will search the TemplateDefinition to find StartElement and TemplateItem mapping (The mapping can be used for this Java Hashtable).

1

dtdName = UpdateOrderStatus.dtd

seqNum = 1

status = "TEST STATUS"

inNum = 123

exNum = P3234

currency = "DEM"

price = 2093.34

taxPrice = 300

...

itemsVector = Vector

(A Vector contains items)

<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE UpdateOrderStatus SYSTEM "UpdateOrderStatus.dtd" >

<UpdateOrderStatus version="1.0">

<OrderStatus>

<SequenceNumber>1</SequenceNumber>

<Header>

<Status>TEST STATUS</Status>

<OrderNumber type="internal">123</OrderNumber>

<OrderNumber type="external">P3242</OrderNumber>

<TotalPriceInfo currency="DEM">

<TotalNetPrice>2093.34</TotalNetPrice>

</TotalPriceInfo>

....

</Header>

<Item>

....

</Item>

<Item>

....

</Item>

</OrderStatus> </UpdateOrderStatus>

 EC XML Generator

Template Definitions

Search DocumentType and version to find StartElement and TemplateItem

Output: XML Message

UpdateOrderStatus.dtd

DocumentType='UpdateOrderStatus' version='1.0' StartElement='OrderStatus'

TemplateItem:

XPath='SequenceNumber' Field='seqNum'

XPath='Header/Status' Field='status'

XPath='Header/OrderNumber@type' XPathType='ATTRIBUTE'

XPath='Header/OrderNumber[@type="internal"]' Field='inNum'

XPath='Header/OrderNumber[@type="external"]' Field='exNum'

XPath='Header/TotalPriceInfo@currency' Field='currency'

XPath='Header/TotalPriceInfo/TotalNetPrice' Field='price'

XPath='Header/TotalPriceInfo/TotalTaxPrice' XPathType='EMPTY'

XPath='Item' XPathType='VECTOR' Field='itemsVector'

[This page contains 1 picture o...