You are on page 1of 10

Fuego With XML

1
Purchase Order XML Document

purchaseOrder

orderDate

shipTo
name
billTo street
city
items
item partNum
productName
quantity
USPrice
2
XML Feed Into a Fuego Process

3
Purchase Order XML Document

4
XML Schema Definition (XSD)

<?xml version="1.0" encoding="UTF-8"?>


<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
<xs:element name="USPrice" type="xs:decimal"/>
<xs:element name="billTo">
<xs:complexType>
<xs:sequence>
<xs:element ref="name"/>
<xs:element ref="street"/>
<xs:element ref="city"/>
<xs:element ref="state"/>
<xs:element ref="zip"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="city" type="xs:string"/>

<xs:element name="name" type="xs:string"/>
<xs:element name="partNum" type="xs:string"/>
<xs:element name="postcode" type="xs:string"/>
<xs:element name="productName" type="xs:string"/>
<xs:element name="purchaseOrder">
<xs:complexType>
<xs:sequence>
<xs:element ref="shipTo"/>
<xs:element ref="billTo"/>
<xs:element ref="items"/>
</xs:sequence>
<xs:attribute name="orderDate" type="xs:date" use="required"/>
</xs:complexType>

5
Expose the XSD

1. Create a new module called XML


2. Catalog an XML’s XSD file

file:\C:\Student\XML\PO3.xsd

6
Wrapper PurchaseOrder Object

3. Wrapper (“Create Heir”)

7
Method to Access XML File

4. Create a Method in this new wrapper object to retrieve and parse the
information in an XML file that uses this schema.

8
Add Logic to Access and Parse the XML

5. Type this FBL into the method you just created

// "PurchaseOrder" is the root object in the XML file for this example.
// In production, do not hard code a local directory like this.
// It is only here in this example for clarity.

purchaseOrder = PurchaseOrder("file:/C:/yourDirectoryName/po2.xml")

display purchaseOrder.orderDate
display purchaseOrder.billTo.name
display purchaseOrder.shipTo.name
display purchaseOrder.items.item.partNum

6. Run the code from the Debugger

9
Purchase Order Information Displayed

7. “billTo.name” displayed

10

You might also like