inst2xsd
($instances as element(*)+, $options as element(st-options:inst2xsd-options)?) as document()*
The inst2xsd function takes a set of sample XML instance elements as input and generates a set of sample XMLSchema documents that define the content of the given input. |
xsd2inst
($schemas as element(*)+, $rootElementName as xs:string, $options as element(st-options:xsd2inst-options)?) as document()
The xsd2inst function takes a set of XML Schema elements as input and the local name of the root element and generates a document that represents one sample XML instance of the given input schemas. |
declare function schema-tools:inst2xsd($instances as element(*)+, $options as element(st-options:inst2xsd-options)?) as document()*
import module namespace st = "http://www.zorba-xquery.com/modules/schema-tools"; declare namespace sto = "http://www.zorba-xquery.com/modules/schema-tools/schema-tools-options"; let $instances := (<a><b/><c/></a>, <b/>, <c>ccc</c>) let $options := <sto:inst2xsd-options xmlns:sto= "http://www.zorba-xquery.com/modules/schema-tools/schema-tools-options"> <sto:design>vbd</sto:design> <sto:simple-content-types>smart</sto:simple-content-types> <sto:use-enumeration>10</sto:use-enumeration> </sto:inst2xsd-options> return st:inst2xsd($instances, $options)
declare function schema-tools:xsd2inst($schemas as element(*)+, $rootElementName as xs:string, $options as element(st-options:xsd2inst-options)?) as document()
import module namespace st = "http://www.zorba-xquery.com/modules/schema-tools"; declare namespace sto = "http://www.zorba-xquery.com/modules/schema-tools/schema-tools-options"; let $xsds := ( <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" attributeFormDefault="unqualified" elementFormDefault="qualified"> <xs:element name="a" type="aType"/> <xs:complexType name="aType"> <xs:sequence> <xs:element type="xs:string" name="b"/> <xs:element type="xs:string" name="c"/> </xs:sequence> </xs:complexType> </xs:schema> ) let $options := <sto:xsd2inst-options xmlns:sto= "http://www.zorba-xquery.com/modules/schema-tools/schema-tools-options"> <sto:network-downloads>false</sto:network-downloads> <sto:no-pvr>false</sto:no-pvr> <sto:no-upa>false</sto:no-upa> </sto:xsd2inst-options> return st:xsd2inst($xsds, "a", $options)