Example: parsing XML and non-XML documents with the 'xmlerror=message' option  Appendix D: The Java-Based XQL Processor

Appendix C: XML Services and External File System Access

Example: using the option 'xmlerror=null' for non-XML documents

The following code sample specifies the 'xmlerror = null' option with a File Access table:

select filename , xmlextract("//book/title", content
     option 'xmlerror = null') 
from xmlxfsTab 
filename
----------------------------
picture.jpg
NULL
bookstore.1.xml 
<title>Seven Years in Trenton</title>

bookstore.2.xml
<title>Modern Database Management</title>
nonxmldoc.txt    
NULL  

(4 rows affected)

The following code sample selects the list of non-XML documents names with 'xmlerror = null' option.

select filename from xmlxfsTab 
where '/' not xmltest content
     option 'xmlerror = null'
filename         
-----------------------------
picture.jpg
nonxmldoc.txt

(2 rows affected)




Copyright © 2005. Sybase Inc. All rights reserved. Appendix D: The Java-Based XQL Processor

View this book as PDF