Difference between revisions of "XML Query Tool"

From PresenceWiki
Jump to: navigation, search
Line 9: Line 9:
  
 
XML Query Nodes are re-usable, which means you can create one and re-use in multiple Tasks (or in the same Task). Changes to any instance of an XML Query will affect all other instances.
 
XML Query Nodes are re-usable, which means you can create one and re-use in multiple Tasks (or in the same Task). Changes to any instance of an XML Query will affect all other instances.
 +
 +
=== How the XML Query Tool works ===
 +
 +
The strategy for querying XML documents in Presence is to convert the document into a flattened table structure (which is how Presence stores data). Because XML documents are multi-dimensional and the relationships between parent, child and sibling nodes need to be preserved this can result in large record sets. Please consider the following example document:
 +
 +
http://www.international-presence.com/wikidocs/images/xml_sample_1.png
 +
 +
The XML Query tool will internally convert this document into the following flat structure:
 +
 +
http://www.international-presence.com/wikidocs/images/xml_sample_2.png
 +
 +
This is reasonably concise because there are no repeated elements or elements outside the "person" group. However if the document were to be more complex, as in the following example, the table structure becomes larger:
 +
 +
http://www.international-presence.com/wikidocs/images/xml_sample_3.png
 +
 +
As you can see an extra element ("disciplinaries") has been introduced as a child of "person". Since the first entry has two such elements this means that there will now be two rows for John Smith instead of just one. As the complexity of the XML document increases so does the size of the resulting data table and the amount of time required to perform the query, so this is something that users should bear in mind when designing their query - limiting the elements included in the resulting data table and defining relationships between elements where possible will help.
  
 
=== Using the XML Query Editor ===
 
=== Using the XML Query Editor ===
Line 30: Line 46:
  
 
Aliases will automatically be created unless you uncheck "Automatically create aliases". As with the [[SQL Statement Nodes|SQL]] editor there are also controls to change or remove aliases.
 
Aliases will automatically be created unless you uncheck "Automatically create aliases". As with the [[SQL Statement Nodes|SQL]] editor there are also controls to change or remove aliases.
 +
 +
==== Conditions Panel ====
 +
 +
The Conditions Panel allows the user to specify the [[Rules]] for element inclusion. Conditions can comprise of static comparisons (e.g. attribute value equals 10), relative comparison (e.g. attribute value equals another attribute value), function calls, data table references, and combinations thereof.
  
 
== See Also ==
 
== See Also ==
  
 
{{DataAccess}}
 
{{DataAccess}}

Revision as of 15:59, 27 July 2010

Under Construction

This page (XML Query Tool) is currently undergoing modifications and may be incomplete. We apologise for any inconvenience.

No extra information has been provided.

Questions? Email Us.


The XML Query Node

This Node allows you to perform queries against XML documents and convert the results into a Data Table which is stored in the Presence Context for reference by subsequent Nodes.

In order to query an XML document, you must have access to an XSD document which describes the structure of the XML. If an XSD document is unavailable you can create your own using software such as XML Spy.

XML Query Nodes are re-usable, which means you can create one and re-use in multiple Tasks (or in the same Task). Changes to any instance of an XML Query will affect all other instances.

How the XML Query Tool works

The strategy for querying XML documents in Presence is to convert the document into a flattened table structure (which is how Presence stores data). Because XML documents are multi-dimensional and the relationships between parent, child and sibling nodes need to be preserved this can result in large record sets. Please consider the following example document:

http://www.international-presence.com/wikidocs/images/xml_sample_1.png

The XML Query tool will internally convert this document into the following flat structure:

http://www.international-presence.com/wikidocs/images/xml_sample_2.png

This is reasonably concise because there are no repeated elements or elements outside the "person" group. However if the document were to be more complex, as in the following example, the table structure becomes larger:

http://www.international-presence.com/wikidocs/images/xml_sample_3.png

As you can see an extra element ("disciplinaries") has been introduced as a child of "person". Since the first entry has two such elements this means that there will now be two rows for John Smith instead of just one. As the complexity of the XML document increases so does the size of the resulting data table and the amount of time required to perform the query, so this is something that users should bear in mind when designing their query - limiting the elements included in the resulting data table and defining relationships between elements where possible will help.

Using the XML Query Editor

To create an XML Query Node, right click in your task edit view and select "Create New > XML Query" from the pop-up menu. You will then be presented with the XML Query Dialog:

http://www.international-presence.com/wikidocs/images/xml_dialog_1.png

The first panel prompts the user for the following information:

  • Name: This is the name to give to this query
  • Description: This is a description of the query's purpose
  • XSD Location: This is the location of the XSD document which describes the XML structure. It can be on your local network, on the internet or intranet, or at an FTP location.

Select Items Panel

http://www.international-presence.com/wikidocs/images/xml_dialog_2.png


This is the panel that is used to specify which elements and / or attributes you are interested in querying. On the left hand side is a tree-view of the expected XML structure (resulting from the XSD document). To select an element, drag it into the main list pane. Any elements beneath it in the document tree will also be included, as well as attributes.

Aliases will automatically be created unless you uncheck "Automatically create aliases". As with the SQL editor there are also controls to change or remove aliases.

Conditions Panel

The Conditions Panel allows the user to specify the Rules for element inclusion. Conditions can comprise of static comparisons (e.g. attribute value equals 10), relative comparison (e.g. attribute value equals another attribute value), function calls, data table references, and combinations thereof.

See Also

Task Elements : Data Accesss Task Elements : XML Query Tool

SQL Statement Nodes | Object Monitor Nodes | XML Query Nodes | Mail Scanner Nodes
Web Services Nodes | LDAP Query Nodes | JSON Node | Flat File Parser | Data Table Nodes | Variable Nodes
Transaction Control Nodes | Context XML Nodes


Task Elements | Resources