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)

If the user wants to preserve header, xmlvalidate() should be used instead of xmlextract().insert into xmldoctab select filename ,xmlvalidate(content)from xmlxfsTab