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.
Output port area – used to write queries against the data model, and send the results to a particular OUT-port. Although XML Port Manager is by default, configured with one OUT-port, 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. The 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 the 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.