Browse Prior Art Database

EC XML Parser for parsing XML into Java Hashtable

IP.com Disclosure Number: IPCOM000013898D
Original Publication Date: 2000-Aug-01
Included in the Prior Art Database: 2003-Jun-19
Document File: 3 page(s) / 133K

Publishing Venue

IBM

Abstract

Disclosed is a method and a program to parse an arbitrary XML message into Java Hashtable. EC XML Parser will parse a buffer containing a XML message and generate name value pairs (NVPs) based on a template definition defined by system or user, then put the NVPs into Java Hashtable. This disclosure will give Java programmers a chance to write applications accepting XML messages without understanding any XML specification. What he should know is the Java Hashtable containing all NVPs generated from the XML message. Object ECParser. parseBuf Template Definitions

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 52% of the total text.

Page 1 of 3

EC XML Parser for parsing XML into Java Hashtable

  Disclosed is a method and a program to parse an arbitrary XML message into Java Hashtable. EC XML Parser will parse a buffer containing a XML message and generate name value pairs (NVPs) based on a template definition defined by system or user, then put the NVPs into Java Hashtable.

This disclosure will give Java programmers a chance to write applications accepting XML messages without understanding any XML specification. What he should know is the Java Hashtable containing all NVPs generated from the XML message.

 Object ECParser. parseBuf

Template Definitions

XML Message

Java Hashtable: (Containing Name Value Pairs)

<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE UpdateOrderStatus SYSTEM "Update_NC_OrderStatus_10.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>

<TotalTaxPrice>200</TotalTaxPrice>

</TotalPriceInfo>

....

</Header>

<Item>

....

</Item>

<Item>

....

</Item>

</OrderStatus> </UpdateOrderStatus>

seqNum = 1

status = "TEST STATUS"

inNum = 123

exNum = P3234

currency = "DEM"

price = 2093.34

...

itemsVector = Vector

(A Vector contains items)

Output: Hashtable

Document='UpdateOrderStatus' version='1.0' Element='OrderStatus'

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'

Whenever the EC Parser gets an XML message buffer, the Parser checks if the message is defined in the template definition or not. If the answer is yes, the Parser parses the XML message element by element. First according to the XPath of the element name, the Parser gets the name of name value pair (NVP) from the template definition. Secondary, EC Parser obtains the value for that element from XML message, and set it to the value of NVP. Now one NVP is generated. After the whole XML message is parsed, a list of NVP will be generated. Then the Parser puts NVPs into the Java Hashtable.

Template Definition:

TemplateDefinition is defined for each DTD in a XML format called ECTemplate. EC Parser parses the input XML message, gets the document type of XML, version of the document type if it exists, and the element name one by one from the message, then looks up TempateDefinition defined in the ECTemplate to find mapping list: TemplateItem. Once TemplateItem is found, the mapping is started. The parser builds the XPath for each element from input XML, searche...