I can't seem to validate content (It says the .xsd file does not exist). Here is some test code:
let $xsd := <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"> <xs:element name="root"> <xs:complexType mixed="false"> <xs:choice minOccurs="1" maxOccurs="unbounded"> <xs:element name="leaf">xs:complexType<xs:attribute name="value" type="xs:string"></xs:attribute></xs:complexType></xs:element> </xs:choice> </xs:complexType> </xs:element> </xs:schema>
let $xml := <root><leaf value="test"></leaf></root>
let $xsd-path := 'xsd-test.xsd' let $xsd-file := file:write($xsd-path, $xsd)
return validate:xsd-info($xml, $xsd-path)
Hi France,
the example works for me (it returns nothing, as I would have expected). Maybe you’ll need to work with absolute paths, or with file:base-dir() or file:current-dir()?
Christian
On Tue, Jul 26, 2016 at 11:04 PM, France Baril france.baril@architextus.com wrote:
I can't seem to validate content (It says the .xsd file does not exist). Here is some test code:
let $xsd := <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"> <xs:element name="root"> <xs:complexType mixed="false"> <xs:choice minOccurs="1" maxOccurs="unbounded"> <xs:element name="leaf">xs:complexType<xs:attribute name="value" type="xs:string"></xs:attribute></xs:complexType></xs:element> </xs:choice> </xs:complexType> </xs:element> </xs:schema>
let $xml := <root><leaf value="test"></leaf></root>
let $xsd-path := 'xsd-test.xsd' let $xsd-file := file:write($xsd-path, $xsd)
return validate:xsd-info($xml, $xsd-path)
-- France Baril Architecte documentaire / Documentation architect france.baril@architextus.com
Ok, file:current-dir() on the validation did the trick. I assumed that file:write and xsd:validate-info would default to the same location as they used to. Assumptions are a killer!
basex-talk@mailman.uni-konstanz.de