The XML Port Manager window lets you create queries against the XML source file, to define one or more output data streams.
XML source view – displays the contents of the source document.
Data Model tab – displays a relational view of the source document.
Reference tab – displays the available component variables.
OUT-Port area – used to write queries against the data model, and send the results to a particular OUT-port. Although XML Port Manager is configured with one OUT-port by default, you can add additional ports, and write additional queries.
When you open XML Port Manager, the OUT-Port area includes a standard query against the XML view, which returns all columns and all rows to OUT1. Assume that your XML source document contains customer data expressed as attribute values of each data node:
<root> <data id="101" fname="Michaels" lname="Devlin" address="114 Pioneer Avenue" city="Kingston" state="NJ" zip="07070"/> <data id="102" fname="Beth" lname="Reiser"
address="33 Whippany Road" city="Rockwood" state="NY" zip="10154"/> <data id="103" fname="Erin" lname="Niedringhaus" address="190 Windsor Street" city="Tara" state="PA" zip="19301"/> </root>
To retrieve customer attributes against the XML, you can use a query similar to:
select * from V_XML_CONTENT WHERE TAB_data_ATT_city = 'Kingston'
This query opens the Content Browser, and returns only those rows whose city value matches Kingston. In the Tabular view, you can write a query that looks similar to:
select * from TAB_data where ATT_city='Kingston'
XML data relationships are generally expressed as parent/child, or as node/attribute relationships. Content Browser returns XML Port Manager query results as columns and rows. Column and row references refer to query results, not XML data.
Retrieving data from your XML data source
Use standard SQL syntax to write your queries directly into the port field in the OUT-Port area:
select column FROM table_name
Query Designer helps you design queries for the Tabular view. Depending on the structure of the XML source, you may need to create joins between the tables to return rows of data.
The default XML view_name is V_XML_CONTENT
.
To return a row, qualify the select statement
with a WHERE clause (select * from V_XML_CONTENT
WHERE TAB_state_ATT_state = 'NY'
).
In the Tabular view, XML nodes formatted as attribute
expressions sometimes create a wrapper element you can qualify with
a WHERE clause (select * from
TAB_data where ATT_city='Kingston'
) to
return a row.
Writing queries against the Table view
You can write queries against the Table view directly into the port field in the OUT-Port Area, or use Query Designer. Use standard SQL syntax to query tables in the Table view.
Right-click the port section and select Add port or Remove port.
You can add an Info Port to forward the XML document to the next component. This port is visible after you exit XML Port Manager.