Skip to main content

Software  >  Information Management  >  DB2 Product Family  >  

New SVALIDATE parameter: schemalocation

 Flash (Alert)
 
Abstract
When you use the SVALIDATE function, you can specify the schemalocation parameter to provide namespace pairs to validate XML instance documents.
 
Content
The SVALIDATE UDF supports namespace validation. However, SVALIDATE validates only against schemas that are specified by the schemaLocation attribute in the XML instance document. A third parameter, schemalocation, is required to validate against schemas other than those named in the schemaLocation attribute in the XML instance document.
Schemas that are provided by this new parameter override only those schemas whose matching targetNamespace occur in the XML instance document. First, specify the namespace URI followed by the fully-qualified filename for the schema document that is associated with that namespace. You can specify multiple namespace URI and schema document pairs, separating each pair with a space. For example, specify a schemalocation parameter with two pairs in this manner:

http://www.ibm.com /xsd/example1.xsd http://www.rational.com /xsd/example2.xsd

Here is the full syntax and parameter descriptions for SVALIDATE:


>>-SVALIDATE-------------------------------------------------->

>-(-xmlobj--+----------------+---+---------------------+--)--><
              '-,--schemadoc-'     '-schemalocation---'
Read syntax diagramSkip visual syntax diagram

ParameterDatatypeDescription
xmlobj

Required. Only one xmlobj allowed.
VARCHAR(256)Fully-qualified file name of the XML document to be verified.
CLOB(2G)XML column that contains the document to be verified.
schemadoc

Optional. No default. Only one schemadoc allowed.
VARCHAR(256)Fully-qualified file name of the schema document (with no target namespace) with which to validate the XML document.
CLOB(2G)XML column that contains the schema (with no target namespace) with which to validate the XML document.
schemalocation

Optional. No default. Not allowed if nonamespace schemadoc is data type CLOB.
VARCHAR(256)Namespace URI and fully-qualified schema document file name pairs to use for validation. You can specify one or more pairs separated by a space.

Example 1

This example validates the XML document in CLOB column xml in table a_table against the specified nonamespace schema schema1.xsd and the specified list of namespace schemas, schema2.xsd and schema3.xsd, that are associated with target namespaces http://ns1 and http://ns2:

select db2xml.svalidate(
xml,
'xsd/schema1.xsd',
'http://ns1 /dxxsamples/schema2.xsd
http://ns2 /dxxsamples/schema3.xsd')
from a_table where id=2


Example 2
This example validates test.xml against the specified list of schemas, schema1.xsd and schema2.xsd, that are associated with target namespaces, http://ns1 and /http://ns2.

Linux, UNIX, and Windows:

db2 values db2xml.svalidate(
'/dxxsamples/xml/test.xml',
'',
'http://ns1 /dxxsamples/xsd/schema1.xsd http://ns2 /dxxsamples/xsd/schema2.xsd')


iSeries:

select db2xml.svalidate(
'/dxxsamples/xml/test.xml',
'',
'http://ns1 /dxxsamples/xsd/schema1.xsd http://ns2 /dxxsamples/xsd/schema2.xsd')
from db2xml.onerow

 
Related information
SVALIDATE and DVALIDATE functions
 
 
 

Copyright and trademark information
IBM, the IBM logo and ibm.com are trademarks of International Business Machines Corp., registered in many jurisdictions worldwide. Other product and service names might be trademarks of IBM or other companies. A current list of IBM trademarks is available on the Web at "Copyright and trademark information" at www.ibm.com/legal/copytrade.shtml.
Rate this page
Please take a moment to complete this form to help us better serve you.
This material provides me with the information I need.




This material is clear and easy to understand.




Did the information help you to achieve your goal?
What updates, improvements, or related information would you like to see in this document?
Your response will be used to improve our document content. Requests for assistance, if applicable, should be submitted through your normal support channel as we cannot respond from this site.
Input the verification number to submit feedback:
Document information
 Product categories:
 Software
 Data Management
 Database Management Tools
 DB2 XML Extenders
 General Issues
 Operating system(s):
  AIX, HP-UX, Linux, OS/390, OS/400, Solaris, UNIX, Windows, iSeries, z/OS
 Software version:
  8.1, 8.2
 Reference #:
  1214403
 IBM Group:
 Software Group
 Modified date:
 2009-05-01

Translate My Page
 
 

Rate this page

Help us improve this page. Your response will be used to improve our document content. Requests for assistance, if applicable, should be submitted through your normal support channel as we cannot respond from this site.