Node Insertion through XQJ and XSD Validation
Greetings, I've just started reading through the materials on XQJ and would like to ask the following: Let's say I have a simple XML file (I'll use the W3Schools Xquery tutorial): 1. Can I have an example query of how I could insert another book node into this file? 2. If I would like to perform schema validation through XSD, how should I change the code? - eg. (if I have set the maxOccurs attribute set as 1), will XQJ throw some exception? <bookstore> <book category="COOKING"> <title lang="en">Everyday Italian</title> <author>Giada De Laurentiis</author> <year>2005</year> <price>30.00</price> </book> </bookstore> Regards, Roy
Hi Ando,
1. Can I have an example query of how I could insert another book node into this file?
XQuery Update will help you here [1]: insert node <book>...</book> into /bookstore
2. If I would like to perform schema validation through XSD, how should I change the code? - eg. (if I have set the maxOccurs attribute set as 1), will XQJ throw some exception?
The functions of the BaseX Validation Module [2] can be used to validate XML documents and nodes. Hope this helps, Christian [1] http://docs.basex.org/wiki/XQuery_Update [2] http://docs.basex.org/wiki/Validation_Module
<bookstore> <book category="COOKING"> <title lang="en">Everyday Italian</title> <author>Giada De Laurentiis</author> <year>2005</year> <price>30.00</price> </book> </bookstore>
Regards, Roy
_______________________________________________ BaseX-Talk mailing list BaseX-Talk@mailman.uni-konstanz.de https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
participants (2)
-
Ando Roy -
Christian Grün