Parsing an XML Document

Sybase WorkSpace provides a subset of the Adaptive Server Enterprise Transact-SQL extensions for accessing and processing XML documents in SQL statements: xmlextract, xmltext, xmlparse, and xmlrepresentation.

  1. For the appropriate ASE connection profile and database, select the appropriate procedural object.
    Object How to select
    Stored procedure Expand the Stored Procedures folder, right-click the stored procedure, and select Edit.
    Trigger Expand the Tables folder, expand the table, and then expand the Triggers folder. Right-click the trigger and select Edit.
  2. In the Source page, place the cursor in the desired location within the SQL code, right-click and select Adaptive Server Enterprise > SQL/XML Wizard .
  3. Select the XML query function.
    Option Description
    Apply XML Query Expression Use the xmlextract function to apply an XML query to an XML document and return the selected results.
    Evaluate XML Query Expression Use the xmltest function to apply an XML query to an XML document and return a boolean result.
    Parse XML to Image Use the xmlparse function to parse and index an XML document to improve processing efficiency.
    Examine Parsed Images Use the xmlrepresentation function to determine whether a given image column contains a parsed XML document.
  4. Modify the appropriate options for the function you selected.
    Option Description
    XML Document (all) Select one of the following:
    • Variable – enter a new variable or choose an existing variable. Variable names begin with "@".

    • Column name – enter a table name and column name, or click Select Column and choose a table/column pair from the Select Table and Column dialog.

    • XML document – enter the content of the XML document, or choose Browse to point to an existing XML document.

    • Embedded expression – enter an embedded expression.

    XPath Expression (xmlextract, xmltest) Enter an XPath expression.
    XML Error Handling (xmlextract, xmlparse, xmltest) Select an error-handling option: exception (default), null, and message.
    Return Type (xmlextract) Enter new return type or choose an existing return type.
    Expected Value Is False (xmltest) Select this option to insert "not" into the query between the XPath expression and the XML document expression.
  5. Click Finish.
Related concepts
Real-Time Messaging Services
Mapping Functions
Related tasks
Sending a Message to a JMS Queue
Receiving a Message from a JMS Queue
Sending a Message to a WebSphere MQ Queue
Receiving a Message from a WebSphere MQ Queue
Publishing a Message to a Topic
Subscribing to a Topic
Consuming a Message from a Topic
Unsubscribing from a Topic
Registering a Subscription
Retrieving XML Message Properties
Related reference
Select for XML Statements


Created June 25, 2009. Send feedback on this help topic to Sybase Technical Publications: pubs@sybase.com