472,958 Members | 2,373 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,958 software developers and data experts.

xmllint and xsd & how to check dtd/schema/etc

Hello, I have xmllint and xsltproc installed and running on both my
linux and win32 platforms, all seems good.

I have a couple questions though.

1) If I have an external dtd file, which is included in my xml file,
like

<!DOCTYPE userlist SYSTEM "test.dtd">

xmllint automatically uses that dtd when I do

$ xmllint --valid --noout test.xml

But, if I want to use a scheme (xsd), with the declaration in the xml
file as so

<test
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="test.xsd">
...
...
...
</test>

It doesn't seem to use the xsd file (in this case, test.xsd.) I have
to add
`--schema test.xsd` to the command line arguemnts, eg

$ xmllint --valid --noout test.xml --schema test.xsd

Is there a way to make xmllint jsut use what's declared in the xml
document?
2) Just one more question I can't really find any info on. Is there a
way (hopefuly with xmllint) to do a quick check for any errors in a DTD
or XSD file, to make sure I didn't mistype something or otherwise
syntatical blunder?
Thanks for any help.

--
Stan
Jun 8 '06 #1
4 7678
Stan R. wrote:
2) Just one more question I can't really find any info on. Is there a
way (hopefuly with xmllint) to do a quick check for any errors in a DTD
or XSD file, to make sure I didn't mistype something or otherwise
syntatical blunder?


I don't know about checking a DTD, but you can check a schema file like
this:
xmllint --noout -schema http://www.w3.org/2001/XMLSchema.xsd
myschema.xsd

If you're using Emacs as an editor, you can also have it continously
checked while you edit, by using nxml-mode.

Jun 8 '06 #2
Arndt Jonasson wrote:
If you're using Emacs as an editor, you can also have it continously
checked while you edit, by using nxml-mode.


"Master, does Emacs have buddha-nature?"
"... I can't see why not. It has everything else."
--
() ASCII Ribbon Campaign | Joe Kesselman
/\ Stamp out HTML e-mail! | System architexture and kinetic poetry
Jun 8 '06 #3
"Arndt Jonasson" <ar************@gmail.com> wrote in
news:11*********************@f6g2000cwb.googlegrou ps.com:
Stan R. wrote:
2) Just one more question I can't really find any info on. Is there
a way (hopefuly with xmllint) to do a quick check for any errors in
a DTD or XSD file, to make sure I didn't mistype something or
otherwise syntatical blunder?


I don't know about checking a DTD, but you can check a schema file
like this:
xmllint --noout -schema http://www.w3.org/2001/XMLSchema.xsd
myschema.xsd


Thank you, but that doesn't seem to work as expected. While my xsd works
without error against my test xml document, testing the xsd in the manner
you desribe yields a lot of errors in the
http://www.w3.org/2001/XMLSchema.xsd file:

$ xmllint --noout --schema test.xsd test.xml
test.xml validates

$ xmllint --noout --schema http://www.w3.org/2001/XMLSchema.xsd test.xsd

Unimplemented block at xmlschemas.c:1934
Unimplemented block at xmlschemas.c:1934
Unimplemented block at xmlschemas.c:1934
Unimplemented block at xmlschemas.c:1934
Unimplemented block at xmlschemas.c:1934
Unimplemented block at xmlschemas.c:1934
Unimplemented block at xmlschemas.c:1934
compilation error: file http://www.w3.org/2001/XMLSchema.xsd line 234
element xs:element
Content model of schema is not determinist:
Unimplemented block at xmlschemas.c:3246
Unimplemented block at xmlschemas.c:3246
compilation error: file http://www.w3.org/2001/XMLSchema.xsd line 308
element xs:enumeration
Schemas: type restriction 46 enumeration value unbounded invalid
compilation error: file http://www.w3.org/2001/XMLSchema.xsd line 2148
element xs:maxInclusive
Schemas: type restriction 372 facet value 65535 invalid
compilation error: file http://www.w3.org/2001/XMLSchema.xsd line 2089
element xs:minInclusive
Schemas: type restriction 367 facet value -32768 invalid
compilation error: file http://www.w3.org/2001/XMLSchema.xsd line 2090
element xs:maxInclusive
Schemas: type restriction 367 facet value 32767 invalid
compilation error: file http://www.w3.org/2001/XMLSchema.xsd line 2126
element xs:maxInclusive
Schemas: type restriction 370 facet value 18446744073709551615 invalid
compilation error: file http://www.w3.org/2001/XMLSchema.xsd line 630
element xs:enumeration
Schemas: type restriction 142 enumeration value #all invalid
compilation error: file http://www.w3.org/2001/XMLSchema.xsd line 895
element xs:enumeration
Schemas: type restriction 230 enumeration value 0 invalid
compilation error: file http://www.w3.org/2001/XMLSchema.xsd line 896
element xs:enumeration
Schemas: type restriction 230 enumeration value 1 invalid
compilation error: file http://www.w3.org/2001/XMLSchema.xsd line 1009
element xs:enumeration
Schemas: type restriction 251 enumeration value ##targetNamespace invalid
compilation error: file http://www.w3.org/2001/XMLSchema.xsd line 1010
element xs:enumeration
Schemas: type restriction 251 enumeration value ##local invalid
compilation error: file http://www.w3.org/2001/XMLSchema.xsd li
..
..
..
[more similar errors]

$ xmllint --version
xmllint: using libxml version 20511
compiled with: FTP HTTP HTML C14N Catalog DocBook XPath XPointer
XInclude Iconv Unicode Regexps Automata Schemas

Strange thing is,
`xmllint --noout --schema http://www.w3.org/2001/XMLSchema.xsd test.xsd`
works just fine on my windows system (the errors I get are on my linux
system, where I need this to work:

D:\xml> xmllint --noout --schema test.xsd test.xml
test.xml validates

D:\xml> xmllint --noout --schema http://www.w3.org/2001/XMLSchema.xsd
test.xsd
test.xsd validates

D:\xml> xmllint --version
xmllint: using libxml version 20623CVS2717
compiled with: Threads Tree Output Push Reader Patterns Writer SAXv1 FTP
HTTP DTDValid HTML Legacy C14N Catalog XPath XPointer XInclude Iconv
Unicode Regexps Automata Expr Schemas Schematron Modules Debug

---

So why does it work on one but not the other? (And yes the Linux system has
full access to the internet.)

--
Stan
Jun 8 '06 #4
"Arndt Jonasson" <ar************@gmail.com> wrote in
news:11*********************@f6g2000cwb.googlegrou ps.com:
Stan R. wrote:
2) Just one more question I can't really find any info on. Is there
a way (hopefuly with xmllint) to do a quick check for any errors in
a DTD or XSD file, to make sure I didn't mistype something or
otherwise syntatical blunder?


I don't know about checking a DTD, but you can check a schema file
like this:
xmllint --noout -schema http://www.w3.org/2001/XMLSchema.xsd
myschema.xsd


Thank you, but that doesn't seem to work as expected. While my xsd works
without error against my test xml document, testing the xsd in the
manner
you desribe yields a lot of errors in the
http://www.w3.org/2001/XMLSchema.xsd file:

$ xmllint --noout --schema test.xsd test.xml
test.xml validates

$ xmllint --noout --schema http://www.w3.org/2001/XMLSchema.xsd test.xsd

Unimplemented block at xmlschemas.c:1934
Unimplemented block at xmlschemas.c:1934
Unimplemented block at xmlschemas.c:1934
Unimplemented block at xmlschemas.c:1934
Unimplemented block at xmlschemas.c:1934
Unimplemented block at xmlschemas.c:1934
Unimplemented block at xmlschemas.c:1934
compilation error: file http://www.w3.org/2001/XMLSchema.xsd line 234
element xs:element
Content model of schema is not determinist:
Unimplemented block at xmlschemas.c:3246
Unimplemented block at xmlschemas.c:3246
compilation error: file http://www.w3.org/2001/XMLSchema.xsd line 308
element xs:enumeration
Schemas: type restriction 46 enumeration value unbounded invalid
compilation error: file http://www.w3.org/2001/XMLSchema.xsd line 2148
element xs:maxInclusive
Schemas: type restriction 372 facet value 65535 invalid
compilation error: file http://www.w3.org/2001/XMLSchema.xsd line 2089
element xs:minInclusive
Schemas: type restriction 367 facet value -32768 invalid
compilation error: file http://www.w3.org/2001/XMLSchema.xsd line 2090
element xs:maxInclusive
Schemas: type restriction 367 facet value 32767 invalid
compilation error: file http://www.w3.org/2001/XMLSchema.xsd line 2126
element xs:maxInclusive
Schemas: type restriction 370 facet value 18446744073709551615 invalid
compilation error: file http://www.w3.org/2001/XMLSchema.xsd line 630
element xs:enumeration
Schemas: type restriction 142 enumeration value #all invalid
compilation error: file http://www.w3.org/2001/XMLSchema.xsd line 895
element xs:enumeration
Schemas: type restriction 230 enumeration value 0 invalid
compilation error: file http://www.w3.org/2001/XMLSchema.xsd line 896
element xs:enumeration
Schemas: type restriction 230 enumeration value 1 invalid
compilation error: file http://www.w3.org/2001/XMLSchema.xsd line 1009
element xs:enumeration
Schemas: type restriction 251 enumeration value ##targetNamespace
invalid
compilation error: file http://www.w3.org/2001/XMLSchema.xsd line 1010
element xs:enumeration
Schemas: type restriction 251 enumeration value ##local invalid
compilation error: file http://www.w3.org/2001/XMLSchema.xsd li
..
..
..
[more similar errors]

$ xmllint --version
xmllint: using libxml version 20511
compiled with: FTP HTTP HTML C14N Catalog DocBook XPath XPointer
XInclude Iconv Unicode Regexps Automata Schemas

Strange thing is,
`xmllint --noout --schema http://www.w3.org/2001/XMLSchema.xsd
test.xsd`
works just fine on my windows system (the errors I get are on my linux
system, where I need this to work:

D:\xml> xmllint --noout --schema test.xsd test.xml
test.xml validates

D:\xml> xmllint --noout --schema http://www.w3.org/2001/XMLSchema.xsd
test.xsd
test.xsd validates

D:\xml> xmllint --version
xmllint: using libxml version 20623CVS2717
compiled with: Threads Tree Output Push Reader Patterns Writer SAXv1
FTP
HTTP DTDValid HTML Legacy C14N Catalog XPath XPointer XInclude Iconv
Unicode Regexps Automata Expr Schemas Schematron Modules Debug

---

So why does it work on one but not the other? (And yes the Linux system
has
full access to the internet.)

--
Stan
Jun 8 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Birahim FALL | last post by:
Hi, I was an oracle dev/admin and I'm quite new to postgresql. Postgresql is great, but something bothers me. It seems that there's no concept of PACKAGE in PL/pgSQL as in Oracle PL/SQL. Is is...
6
by: Mark Jerde | last post by:
We have developed about 80 XML documents, each probably 150 lines long, that are all supposed to conform to a schema. My understanding is the way to show that an XML document conforms to a schema...
1
by: Nathan Alden | last post by:
I have an XSD defined as the following: <?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"...
2
by: DeadlyTedly | last post by:
Hi, I'm attempting to make use of nested object tags (in HTML) as per the w3c standard here: http://www.w3.org/TR/REC-html40/struct/objects.html#h-13.3.1 This details the HTML 4.01...
5
by: Arvind P Rangan | last post by:
Hi, i like to read an existing xml file which has a schema defined to it, and then write or add data to the existing xml file using vb.net/c#. May be this Question has been answered earlier....
1
by: Le Tubs | last post by:
Hi I am wondering if anybody has come accross this problem before, basically I have to validate a xml schema (not the data, this is done at a later stage). The only problem is that there are...
2
by: Arpan | last post by:
I came across the following statement at http://windowssdk.msdn.microsoft.com/en-us/library/hdf992b8.aspx: Although an XML document is considered to be well formed if it meets all the...
2
by: Geoff | last post by:
Hello, I have three files: ~~~~~~~~~ people.xml ~~~~~~~~~ <?xml version="1.0"?> <people xmlns:xi="http://www.w3.org/2001/XInclude" > <xi:include href="AlanTuring.xml"/>
2
by: maxwell | last post by:
I'm trying to write a schema, and test it by running an xml file of test data based on that schema through xmllint. I'm having a problem, because xmllint ( --version reports "using libxml version...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.