Databases Reference
In-Depth Information
Example 2-3 XMLParse function
insert into moviereview(reviewid, review) values(765, xmlparse (
document '<movie id = "567">
<reviews>
<UserReview>
<user name ="Andy">Three is a crowd, yet there is not
enough stars to support this catastrophe.</user>
<user name ="Linda">Three is a crowd, yet there is not enough
stars to support this catastrophe.</user>
</UserReview>
<CriticsReview>
<newspaper name="ABC Times">The best mystery thriller
of the year. </newspaper>
<newspaper name="San Francisco Post">The best mystery thriller
of the year. </newspaper>
</CriticsReview>
</reviews>
</movie>'))
A host variable or parameter of type XML cannot be given as input to the
XMLPARSE function. They are implicitly parsed by the database.
XMLPARSE does not perform validation against a schema and only provides the
parsing functionality to check the correctness of the XML value and how
well-formed the XML value is.
The full syntax for the XMLPARSE is:
XMLPARSE (DOCUMENT <String Value> PRESERVE/STRIP WHITESPACE
XMLPARSE provides two options for extra whitespace processing while parsing
the string value:
PRESERVE WHITESPACE: Preserve the whitespace in the string value.
STRIP WHITEPACE: Remove the extra whitespace. This is the default action
if no option is provided.
The DOCUMENT keyword specifies that the string value is a well-formed XML
document which conforms to XML Version 1.0.
XMLVALIDATE
You can use the XMLVALIDATE function to validate the XML value against a
schema. The schema for an XML value defines the structure of the XML values
including node data types, occurrences, default values, and so on. The schema
document should be registered to the database before using it for the validation.
Search WWH ::




Custom Search