Schema Validation Error
Wednesday, 20 November 2013 · 5 messages
PF
Paul Fancher20 Nov 2013 00:46 #
I am trying to get a working schema validation, and I'm hitting a hangup:
Context:
db:open("Test","NewXMLSchema.xsd")
<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:tns="
http://www.example.org/NewXMLSchema" targetNamespace="
http://www.example.org/NewXMLSchema" elementFormDefault="qualified">
<element name="test" type="tns:test"/>
<complexType name="test">
<sequence>
<element name="item" type="string" maxOccurs="unbounded"
minOccurs="1"/>
</sequence>
</complexType>
</schema>
db:open("Test","NewFile1.xml")
<tns:test xmlns:tns="http://www.example.org/NewXMLSchema" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="
http://www.example.org/NewXMLSchema NewXMLSchema.xsd ">
<tns:item>Poke</tns:item>
<tns:item>Poke</tns:item>
<tns:item>Poke</tns:item>
</tns:test>Test Code:
declare namespace tns = "http://www.example.org/NewXMLSchema";
validate:xsd-info("/tns:test", db:open("Test","NewXMLSchema.xsd"))The error message I get back is
"Fatal: Content is not allowed in prolog."
Any ideas what's going on?
Paul
shoutout to the the people behind eclipse and the Eclipse XML Editors and Tools for some really awesome development software!
ZD
Zachary DeLuca20 Nov 2013 00:55 #
I don't know anything about the actual validation features in BaseX, but as far as your XSD and XML documents are concerned, you appear to missing the prolog statement.
See here: http://www.w3.org/TR/2000/REC-xml-20001006#sec-prolog-dtd
Zach
Quoted text · Paul Fancher · 47 lines
On Tue, Nov 19, 2013 at 5:46 PM, Paul Fancher <fancherpaul at gmail.com> wrote: > I am trying to get a working schema validation, and I'm hitting a hangup: > > Context: > db:open("Test","NewXMLSchema.xsd") > <schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:tns=" > http://www.example.org/NewXMLSchema" targetNamespace=" > http://www.example.org/NewXMLSchema" elementFormDefault="qualified"> > <element name="test" type="tns:test"/> > <complexType name="test"> > <sequence> > <element name="item" type="string" maxOccurs="unbounded" > minOccurs="1"/> > </sequence> > </complexType> > </schema> > > db:open("Test","NewFile1.xml") > <tns:test xmlns:tns="http://www.example.org/NewXMLSchema" xmlns:xsi=" > http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" > http://www.example.org/NewXMLSchema NewXMLSchema.xsd "> > <tns:item>Poke</tns:item> > <tns:item>Poke</tns:item> > <tns:item>Poke</tns:item> > </tns:test> > > Test Code: > declare namespace tns = "http://www.example.org/NewXMLSchema"; > validate:xsd-info("/tns:test", db:open("Test","NewXMLSchema.xsd")) > > The error message I get back is > "Fatal: Content is not allowed in prolog." > > Any ideas what's going on? > > > Paul > > shoutout to the the people behind eclipse and the Eclipse XML Editors and > Tools for some really awesome development software! > > _______________________________________________ > BaseX-Talk mailing list > BaseX-Talk at mailman.uni-konstanz.de > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk > >
PF
Paul Fancher20 Nov 2013 01:16 #
You are right; the prolog was removed during the import process. Any ideas what to do now? If nothing else, I could always convert the node() into a string and concatenate the prolog to the beginning, but I don't know if that would work for large XML files or not...
Paul
Quoted text · Zachary DeLuca · 60 lines
On Tue, Nov 19, 2013 at 4:54 PM, Zachary DeLuca <zadeluca at gmail.com> wrote: > I don't know anything about the actual validation features in BaseX, but > as far as your XSD and XML documents are concerned, you appear to missing > the prolog statement. > > See here: http://www.w3.org/TR/2000/REC-xml-20001006#sec-prolog-dtd > > Zach > > > > On Tue, Nov 19, 2013 at 5:46 PM, Paul Fancher <fancherpaul at gmail.com>wrote: > >> I am trying to get a working schema validation, and I'm hitting a hangup: >> >> Context: >> db:open("Test","NewXMLSchema.xsd") >> <schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:tns=" >> http://www.example.org/NewXMLSchema" targetNamespace=" >> http://www.example.org/NewXMLSchema" elementFormDefault="qualified"> >> <element name="test" type="tns:test"/> >> <complexType name="test"> >> <sequence> >> <element name="item" type="string" maxOccurs="unbounded" >> minOccurs="1"/> >> </sequence> >> </complexType> >> </schema> >> >> db:open("Test","NewFile1.xml") >> <tns:test xmlns:tns="http://www.example.org/NewXMLSchema" xmlns:xsi=" >> http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" >> http://www.example.org/NewXMLSchema NewXMLSchema.xsd "> >> <tns:item>Poke</tns:item> >> <tns:item>Poke</tns:item> >> <tns:item>Poke</tns:item> >> </tns:test> >> >> Test Code: >> declare namespace tns = "http://www.example.org/NewXMLSchema"; >> validate:xsd-info("/tns:test", db:open("Test","NewXMLSchema.xsd")) >> >> The error message I get back is >> "Fatal: Content is not allowed in prolog." >> >> Any ideas what's going on? >> >> >> Paul >> >> shoutout to the the people behind eclipse and the Eclipse XML Editors and >> Tools for some really awesome development software! >> >> _______________________________________________ >> BaseX-Talk mailing list >> BaseX-Talk at mailman.uni-konstanz.de >> https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk >> >> >
ZD
Zachary DeLuca20 Nov 2013 01:36 #
Maybe I'm confused about what you are trying to do. Shouldn't your test code line be:
validate:xsd-info(db:open("Test", "NewFile1.xml"),
db:open("Test","NewXMLSchema.xsd"))Quoted text · Paul Fancher · 78 lines
On Tue, Nov 19, 2013 at 6:16 PM, Paul Fancher <fancherpaul at gmail.com> wrote: > You are right; the prolog was removed during the import process. Any ideas > what to do now? If nothing else, I could always convert the node() into a > string and concatenate the prolog to the beginning, but I don't know if > that would work for large XML files or not... > > Paul > > > > On Tue, Nov 19, 2013 at 4:54 PM, Zachary DeLuca <zadeluca at gmail.com>wrote: > >> I don't know anything about the actual validation features in BaseX, but >> as far as your XSD and XML documents are concerned, you appear to missing >> the prolog statement. >> >> See here: http://www.w3.org/TR/2000/REC-xml-20001006#sec-prolog-dtd >> >> Zach >> >> >> >> On Tue, Nov 19, 2013 at 5:46 PM, Paul Fancher <fancherpaul at gmail.com>wrote: >> >>> I am trying to get a working schema validation, and I'm hitting a hangup: >>> >>> Context: >>> db:open("Test","NewXMLSchema.xsd") >>> <schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:tns=" >>> http://www.example.org/NewXMLSchema" targetNamespace=" >>> http://www.example.org/NewXMLSchema" elementFormDefault="qualified"> >>> <element name="test" type="tns:test"/> >>> <complexType name="test"> >>> <sequence> >>> <element name="item" type="string" maxOccurs="unbounded" >>> minOccurs="1"/> >>> </sequence> >>> </complexType> >>> </schema> >>> >>> db:open("Test","NewFile1.xml") >>> <tns:test xmlns:tns="http://www.example.org/NewXMLSchema" xmlns:xsi=" >>> http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" >>> http://www.example.org/NewXMLSchema NewXMLSchema.xsd "> >>> <tns:item>Poke</tns:item> >>> <tns:item>Poke</tns:item> >>> <tns:item>Poke</tns:item> >>> </tns:test> >>> >>> Test Code: >>> declare namespace tns = "http://www.example.org/NewXMLSchema"; >>> validate:xsd-info("/tns:test", db:open("Test","NewXMLSchema.xsd")) >>> >>> The error message I get back is >>> "Fatal: Content is not allowed in prolog." >>> >>> Any ideas what's going on? >>> >>> >>> Paul >>> >>> shoutout to the the people behind eclipse and the Eclipse XML Editors >>> and Tools for some really awesome development software! >>> >>> _______________________________________________ >>> BaseX-Talk mailing list >>> BaseX-Talk at mailman.uni-konstanz.de >>> https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk >>> >>> >> > > _______________________________________________ > BaseX-Talk mailing list > BaseX-Talk at mailman.uni-konstanz.de > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk > >
PF
Paul Fancher20 Nov 2013 01:46 #
Oops...
Yes, and that fixed it.
Thank you for your time and help, I appreciate it.
Paul
Quoted text · Zachary DeLuca · 89 lines
On Tue, Nov 19, 2013 at 5:36 PM, Zachary DeLuca <zadeluca at gmail.com> wrote: > Maybe I'm confused about what you are trying to do. Shouldn't your test > code line be: > > validate:xsd-info(db:open("Test", "NewFile1.xml"), > db:open("Test","NewXMLSchema.xsd")) > > > On Tue, Nov 19, 2013 at 6:16 PM, Paul Fancher <fancherpaul at gmail.com>wrote: > >> You are right; the prolog was removed during the import process. Any >> ideas what to do now? If nothing else, I could always convert the node() >> into a string and concatenate the prolog to the beginning, but I don't know >> if that would work for large XML files or not... >> >> Paul >> >> >> >> On Tue, Nov 19, 2013 at 4:54 PM, Zachary DeLuca <zadeluca at gmail.com>wrote: >> >>> I don't know anything about the actual validation features in BaseX, but >>> as far as your XSD and XML documents are concerned, you appear to missing >>> the prolog statement. >>> >>> See here: http://www.w3.org/TR/2000/REC-xml-20001006#sec-prolog-dtd >>> >>> Zach >>> >>> >>> >>> On Tue, Nov 19, 2013 at 5:46 PM, Paul Fancher <fancherpaul at gmail.com>wrote: >>> >>>> I am trying to get a working schema validation, and I'm hitting a >>>> hangup: >>>> >>>> Context: >>>> db:open("Test","NewXMLSchema.xsd") >>>> <schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:tns=" >>>> http://www.example.org/NewXMLSchema" targetNamespace=" >>>> http://www.example.org/NewXMLSchema" elementFormDefault="qualified"> >>>> <element name="test" type="tns:test"/> >>>> <complexType name="test"> >>>> <sequence> >>>> <element name="item" type="string" maxOccurs="unbounded" >>>> minOccurs="1"/> >>>> </sequence> >>>> </complexType> >>>> </schema> >>>> >>>> db:open("Test","NewFile1.xml") >>>> <tns:test xmlns:tns="http://www.example.org/NewXMLSchema" xmlns:xsi=" >>>> http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" >>>> http://www.example.org/NewXMLSchema NewXMLSchema.xsd "> >>>> <tns:item>Poke</tns:item> >>>> <tns:item>Poke</tns:item> >>>> <tns:item>Poke</tns:item> >>>> </tns:test> >>>> >>>> Test Code: >>>> declare namespace tns = "http://www.example.org/NewXMLSchema"; >>>> validate:xsd-info("/tns:test", db:open("Test","NewXMLSchema.xsd")) >>>> >>>> The error message I get back is >>>> "Fatal: Content is not allowed in prolog." >>>> >>>> Any ideas what's going on? >>>> >>>> >>>> Paul >>>> >>>> shoutout to the the people behind eclipse and the Eclipse XML Editors >>>> and Tools for some really awesome development software! >>>> >>>> _______________________________________________ >>>> BaseX-Talk mailing list >>>> BaseX-Talk at mailman.uni-konstanz.de >>>> https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk >>>> >>>> >>> >> >> _______________________________________________ >> BaseX-Talk mailing list >> BaseX-Talk at mailman.uni-konstanz.de >> https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk >> >> >
Written for BaseX 7.7. BaseX may have changed since: please check the current documentation.
⚡Generated with XQuery