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: exmlextract, xmltext, xmlparse, and xmlrepresentation.

  1. From Enterprise Explorer, find the ASE connection profile.
  2. Select the procedural object for which you want to parse an XML document.
    Procedural Object How to select
    Stored procedure Expand the Stored Procedures folder, right-click the procedure, and select Edit.
    Trigger Expand the Tables folder, expand the table, and then the Triggers folder. Right-click the trigger and select Edit.
  3. Place the cursor in the desired location in the code, right-click and select Adaptive Server Enterprise > SQL/XML Wizard.
  4. Select the XML query function.
    Option Description
    Apply XML Query Expression Select this wizard to use the xmlextract function to apply an XML query to an XML document and return the selected results.
    Evaluate XML Query Expression Select this wizard to use the xmltest function to apply an XML query to an XML document and return a boolean result.
    Parse XML to Image Select this wizard to use the xmlparse function to parse and index an XML document to improve processing efficiency.
    Examine Parsed Images Select this wizard to use the xmlrepresentation function to determine whether a given image column contains a parsed XML document.
  5. Modify the appropriate options for the function you selected.
    Option Description
    XML Document (all) Select one of the following:
    • Variable - Enter a variable in the text field, or choose an existing variable from the menu drop-down. Variable names begin with "@".

    • Column name - Enter a table name and column name in the text fields, 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 in the text field, or choose Browse to point to an existing XML document.

    • Embedded expression - Enter an embedded expression in the text field.

    XPath Expression (xmlextract, xmltest) Enter an XPath expression in the text field.
    XML Error Handling (xmlextract, xmlparse, xmltest) Select an error-handling option: exception, null, and message. The default is exception.
    Return Type (xmlextract) Enter a return type in the text field, or choose a return type from the menu dropdown.
    Expected Value Is False (xmltest) Insert "not" into the query between the XPath expression and the XML document expression.

    The SQL for invoking the command with your specified options is displayed in the Preview field.

  6. 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

Send your feedback on this help topic to Sybase Technical Publications: pubs@sybase.com

Your comments will be sent to the technical publications staff at Sybase, Inc. For product-related issues or technical support, contact Sybase Technical Support at 1-800-8SYBASE.