OK, so we will believe the schema location on the document instance, but you have to be very, very careful about using relative URIs there, because they will be resolved relative to the URI of the document. So unless you have your schema at /path/TLela.xsd in the schemas database, we will not locate it, and will then fall back to looking up the schema by namespace. Since you have two schemas with that (no-namespace) namespace, it is essentially random which one would be used.
Best practice is to use absolute paths for schema locations. //Mary On Fri, 04 Oct 2013 15:58:53 -0700, Andres Felipe Restrepo Pino <[email protected]> wrote: > I'm referring the XSD file with the attributes on the root node of the > XML: xsi:schemaLocation="TLela.xsd" xmlns:xsi=" > http://www.w3.org/2001/XMLSchema-instance", using this the It doesn't > work > all the way, I mean, The validator returns empty, so It validates but no > with all the xsd specifications. > the script from the qconsole is: > > xquery version "1.0-ml"; > let $file := fn:doc("/path/TLela.xml") > return > try{ > validate strict { $file }} > catch ($e) { > "failed: ",$e/error:format-string/text() > } > > Thanks > > > On 4 October 2013 17:11, Mary Holstege <[email protected]> > wrote: > >> As an addendum, I'd say that more than there being no namespace, there >> are multiple schema documents per namespace, so exactly how you >> reference the schemas makes a difference. What it's the query you use >> to validate? //mary >> >> Danny Sokolsky <[email protected]> wrote: >> >> >> Below are the schema and XML files (sent off-list, along with the fact >> that he is running 6.0-2.3). >> >> >> >> Andres, 3 things to think about here: 1) I don’t see a target namespace >> in your schema documents. 2) your XML document is in no namespace. 3) >> have you tried this on 6.0-4? There were a lot of schema issues fixed >> between 6.0-2 and 6.0-4. >> >> >> >> If you are using schemas, you should really not use no namespace, as it >> becomes very difficult to work out what is going on. >> >> >> >> Here is childs_declaration.xsd: >> >> >> >> <?xml version="1.0" encoding="UTF-8"?> >> >> <xs:schema attributeFormDefault="unqualified" >> elementFormDefault="unqualified" >> >> xmlns:xs="http://www.w3.org/2001/XMLSchema"> >> >> <!--elements--> >> >> <xs:element name="TermList"/> >> >> <xs:element name="TermInfo" type="child_elements"/> >> >> <!--end elements--> >> >> <!--complexTypes--> >> >> <xs:complexType name="text_elements" mixed="true"> >> >> <xs:choice minOccurs="0" maxOccurs="unbounded"> >> >> <xs:group ref="text_elements"/> >> >> </xs:choice> >> >> </xs:complexType> >> >> <!--*********************************--> >> >> <xs:complexType name="child_elements" mixed="true"> >> >> <xs:choice> >> >> <xs:sequence maxOccurs="1"> >> >> <xs:element name="T" type="text_elements"/> >> >> <xs:choice minOccurs="0" maxOccurs="unbounded"> >> >> <xs:group ref="child_elements"/> >> >> </xs:choice> >> >> <xs:element name="ID" type="text_elements"/> >> >> <xs:sequence minOccurs="0" maxOccurs="unbounded"> >> >> <xs:group ref="child_elements"/> >> >> </xs:sequence> >> >> </xs:sequence> >> >> <xs:sequence maxOccurs="1"> >> >> <xs:element name="ID" type="text_elements"/> >> >> <xs:choice minOccurs="0" maxOccurs="unbounded"> >> >> <xs:group ref="child_elements"/> >> >> </xs:choice> >> >> <xs:element name="T" type="text_elements"/> >> >> <xs:sequence minOccurs="0" maxOccurs="unbounded"> >> >> <xs:group ref="child_elements"/> >> >> </xs:sequence> >> >> </xs:sequence> >> >> </xs:choice> >> >> </xs:complexType> >> >> <!--complexTypes--> >> >> <!--groups--> >> >> <xs:group name="child_elements"> >> >> <xs:choice> >> >> <xs:element ref="TermInfo" minOccurs="1" maxOccurs="unbounded"/> >> >> <xs:element ref="TermList"/> >> >> <xs:element name="QC" type="text_elements" minOccurs="0" >> maxOccurs="unbounded"/> >> >> <xs:element name="Status" type="text_elements" minOccurs="0" >> maxOccurs="unbounded"/> >> >> <xs:element name="UF" type="text_elements" minOccurs="0" >> maxOccurs="unbounded"/> >> >> <xs:element name="RT" type="text_elements" minOccurs="0" >> maxOccurs="unbounded"/> >> >> <xs:element name="ttm" type="text_elements" minOccurs="0" >> maxOccurs="unbounded"/> >> >> <xs:element name="RS" type="text_elements" minOccurs="0" >> maxOccurs="unbounded"/> >> >> <xs:element name="TLID" type="text_elements" minOccurs="0" >> maxOccurs="unbounded"/> >> >> <xs:element name="CCSSMathText" type="text_elements" minOccurs="0" >> maxOccurs="unbounded"/> >> >> <xs:element name="CCSSELAText" type="text_elements" minOccurs="0" >> maxOccurs="unbounded"/> >> >> <xs:element name="Student-facing_Skill" type="text_elements" >> minOccurs="0" >> >> maxOccurs="unbounded"/> >> >> <xs:element name="Teacher-facing_Skill" type="text_elements" >> minOccurs="0" >> >> maxOccurs="unbounded"/> >> >> <xs:element name="SN" type="text_elements" minOccurs="0" >> maxOccurs="unbounded"/> >> >> <xs:element name="CCSS" type="text_elements" minOccurs="0" >> maxOccurs="unbounded"/> >> >> <xs:element name="FN" type="text_elements" minOccurs="0" >> maxOccurs="unbounded"/> >> >> <xs:element name="EN" type="text_elements" minOccurs="0" >> maxOccurs="unbounded"/> >> >> <xs:element name="NN" type="text_elements" minOccurs="0" >> maxOccurs="unbounded"/> >> >> <xs:element name="Shortened_Version" type="text_elements" >> minOccurs="0" maxOccurs="unbounded" >> >> /> >> >> </xs:choice> >> >> </xs:group> >> >> <!--**********************************--> >> >> <xs:group name="text_elements"> >> >> <xs:choice> >> >> <xs:element name="i" type="xs:string" minOccurs="0" >> maxOccurs="unbounded"/> >> >> <xs:element name="br" type="xs:string" minOccurs="0" >> maxOccurs="unbounded"/> >> >> <xs:element name="p" type="xs:string" minOccurs="0" >> maxOccurs="unbounded"/> >> >> <xs:element name="u" type="xs:string" minOccurs="0" >> maxOccurs="unbounded"/> >> >> <xs:element name="b" type="xs:string" minOccurs="0" >> maxOccurs="unbounded"/> >> >> <xs:element name="ul" type="xs:string" minOccurs="0" >> maxOccurs="unbounded"/> >> >> <xs:element name="li" type="xs:string" minOccurs="0" >> maxOccurs="unbounded"/> >> >> </xs:choice> >> >> </xs:group> >> >> <!--end groups--> >> >> </xs:schema> >> >> >> >> Here is TLele.xsd: >> >> <?xml version="1.0" encoding="UTF-8"?> >> >> <xs:schema attributeFormDefault="unqualified" >> elementFormDefault="unqualified" xmlns:xs=" >> http://www.w3.org/2001/XMLSchema"> >> >> <xs:include schemaLocation="childs_declaration.xsd"/> >> >> <!--elements--> >> >> <xs:element name="TLela"> >> >> <xs:complexType> >> >> <xs:choice minOccurs="0" maxOccurs="unbounded"> >> >> <xs:element ref="TermInfo"/> >> >> <xs:element ref="TermList"/> >> >> </xs:choice> >> >> </xs:complexType> >> >> </xs:element> >> >> </xs:schema> >> >> >> >> And here is TLela.xml: >> >> >> >> <?xml version="1.0" encoding="UTF-8"?> >> >> <TLela> >> >> <TermInfo> >> >> <T>English Language Arts</T> >> >> <Status>Accepted</Status> >> >> <QC>Y</QC> >> >> <NN>1</NN> >> >> <ID>ela-737</ID> >> >> <TermList> >> >> <TermInfo> >> >> >> <T>Alphabet</T> >> >> >> <RT>Alphabetical order</RT> >> >> >> <Status>Accepted</Status> >> >> <QC>Y</QC> >> >> >> <NN>1.2.1</NN> >> >> >> <ID>ela-426</ID> >> >> <TermList> >> >> >> <TermInfo> >> >> >> <T>Consonants</T> >> >> >> <Status>Accepted</Status> >> >> >> <QC>Y</QC> >> >> >> <NN>1.2.1.1</NN> >> >> >> <ID>ela-655</ID> >> >> >> </TermInfo> >> >> >> <TermInfo> >> >> >> <T>Letters</T> >> >> >> <Status>Accepted</Status> >> >> >> <QC>Y</QC> >> >> >> <NN>1.2.1.2</NN> >> >> >> <ID>ela-4121</ID> >> >> >> </TermInfo> >> >> >> <TermInfo> >> >> >> <T>Vowels</T> >> >> >> <Status>Accepted</Status> >> >> >> <QC>Y</QC> >> >> >> <NN>1.2.1.3</NN> >> >> >> <ID>ela-4834</ID> >> >> >> </TermInfo> >> >> </TermList> >> >> </TermInfo> >> >> </TermList> >> >> </TermInfo> >> >> </TLela> >> >> >> >> -Danny >> >> >> >> >> >> >> >> *From:* [email protected] [mailto: >> [email protected]] *On Behalf Of *Danny Sokolsky >> *Sent:* Friday, October 04, 2013 1:48 PM >> *To:* MarkLogic Developer Discussion >> *Subject:* Re: [MarkLogic Dev General] Schema Validation problem >> >> >> >> Hi Andres, >> >> >> >> I don’t see any schema or xml files attached, so it is hard to comment >> on >> it. >> >> >> >> Also, what version of MarkLogic are you using (xdmp:version() )? >> >> >> >> -Danny >> >> >> >> *From:* [email protected] [mailto: >> [email protected]] *On Behalf Of *Andres Felipe >> Restrepo Pino >> *Sent:* Friday, October 04, 2013 1:06 PM >> *To:* [email protected] >> *Subject:* [MarkLogic Dev General] Schema Validation problem >> >> >> >> Good day, >> >> >> >> I'm trying to validate an XML file using an XSD made in Oxygen Editor >> version 14, At the editor the xsd seems to work according to the >> requirement, but when I use the "validate strict{$node}" sentence, this >> is >> what i got: >> >> >> >> 1. I validate the schema against to a valid XML, everything its ok in >> both >> cases, Oxygen and Marklogic. >> >> 2. If I validate against to an invalid XML file using the oxygen editor >> the error is showed in the console, but doing the same validation in the >> marklogic console the XML seems to be valid. >> >> 3. I try again but this time I modify the XML in the initial node (which >> is restricted in the xsd) the results seems to be invaled in both >> consoles. >> >> >> >> My xsd file is created with groups, complexTypes, sequences and choices >> elements. >> >> >> >> According to this, the problem seems to be with the XSD proccessor, >> searching on internet i found that Marklogic only have support for >> schema >> 1.0 and Oxygen is working with Schema 1.1, I'm not sure if the problem >> is >> because of the schema version. >> >> >> >> So, Does Marklogic have problems with this kind of xsd files?, how can I >> create or is there a Editor to create xsd that Marklogic can manage? >> >> >> >> Thanks for the attention, >> >> >> >> I attached the xsd and xml files. >> >> _______________________________________________ >> General mailing list >> [email protected] >> http://developer.marklogic.com/mailman/listinfo/general >> >> -- Using Opera's revolutionary email client: http://www.opera.com/mail/ _______________________________________________ General mailing list [email protected] http://developer.marklogic.com/mailman/listinfo/general
