Most common XML/XSD validations?

A

Andrew Thompson

I have just uploaded the first version of YAX-V,
(Yet Another) XML Validator, my latest little
project.*

It is a freeware tool that validates XML against
XML Schema Definitions (XSD). It can be found here.
<http://www.physci.org/xml/xmltools.html#yaxv>

The drop-down list on the right below the
Document Definition text area (see screenshots),
is intended to offer a variety of 'hard wired'
URLs to existing XSDs, but at the moment it
contains just two, both of which I developed.*

I am after suggestions for inclusions in the
list, of common XSD files.

My major interest is in XML files related to
Sun/Java, but other formats will be considered.
Something that would make me tend to sway away
from including an XML format is that the XML in
question is commonly validated by other tools
(such as whatever consumes it, or builds the
deployment/project files).

A rundown of the XSD files offered by Sun
related to Java, can be seen in this quick search..
<http://www.google.com/search?as_filetype=xsd&as_sitesearch=java.sun.com>

What are the best XSDs to look at for inclusion?

And while I have your attention, bug reports for
YAX-V, as well as either of the existing XSDs, are
most welcome.

* Shamelessly self-promoting plug.
 
L

Lew

, quoted or indirectly quoted someone who said:
Roedy said:
what Java folk most commonly need are validation of JNLP files at the
various levels.

I use Java Server Faces - the faces-config.xml and web.xml are pretty
important there.

You got the web.xml one in your google:

<web-app version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"

That uses the XMLSchema-instance schema, also very important.

OK, it's a DTD for JSF, but still important:

<!DOCTYPE faces-config
PUBLIC
"-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN"
"http://java.sun.com/dtd/web-facesconfig_1_1.dtd"

Struts' configuration XMLs.

XHTML.

<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.0">
 
R

Roedy Green

I have just uploaded the first version of YAX-V,
(Yet Another) XML Validator, my latest little
project.*

The post where Andrew talked about his new XSD validator just
surfaced again.

I tried it out and it died immediately with a null pointer exception.

I pasted in my JNLP text and selected JNLP.

Some thoughts on how to make it easier to use:

1. make the link to start the program be a button and say "LAUNCH" or
something similar. The launch link is disguised as a simple text link.
The well formedness checker has a similar problem.

2. put a watermark over the sample screenshot. It looks too much like
the app itself already running.

3. If you need to provide your own JNLP XSD, instructions need to
guide you on the screen.

Whatever is causing this exception needs a better error message.

Error: null
java.lang.NullPointerException
at
org.physci.xml.tool.validate.XMLValidator.parse(XMLValidator.java:324)
at
org.physci.xml.tool.validate.XMLValidator.validateContent(XMLValidator.java:363)
at
org.physci.xml.tool.validate.XMLValidator$ValidateWorker.doInBackground(XMLValidator.java:477)
at
org.physci.xml.tool.validate.XMLValidator$ValidateWorker.doInBackground(XMLValidator.java:471)
at javax.swing.SwingWorker$1.call(Unknown Source)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown
Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at javax.swing.SwingWorker.run(Unknown Source)
at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown
Source)
at java.lang.Thread.run(Unknown Source)

I'm glad Andrew has tackled this problem. I had it about #4 on my to
do list.
 
R

Roedy Green

what Java folk most commonly need are validation of JNLP files at the
various levels.

would it be possible to invent an XSD for JNLP 1.0, 1.5 and 6.0. that
when you used a feature improperly from a more advanced version, did
not treat it as a syntax error, but instead put out a warning message
the feature required version 1.5+ or 1.6+?

Perhaps you might create such a beast by validating under all 3 and
diffing the results.
 
A

Andrew Thompson

Roedy said:
would it be possible to invent an XSD for JNLP 1.0, 1.5 and 6.0. that
when you used a feature improperly from a more advanced version, did
not treat it as a syntax error, but instead put out a warning message
the feature required version 1.5+ or 1.6+?

Perhaps you might create such a beast by validating under all 3 and
diffing the results.

Interesting thought. The entire current code would need
to be redesigned to achieve that though, so much so that
it would probably warrant a separate project.

I will leave YAX-V as it is - a one-to-one validator. It is
elegantly/stupidly short* in the simplicity** of how it
validates.

* As opposed to the GUI code I wrapped around it.

** The validation part comes to around 40 lines of code
(I would estimate without checking).

Thanks for the bug report/suggestions - I will look into them
further and respond on that post when I have further analysed
(and hopefully solved!) the bug, as well as reviewed your other
suggestions.

--
Andrew Thompson
http://www.athompson.info/andrew/

Message posted via JavaKB.com
http://www.javakb.com/Uwe/Forums.aspx/java-general/200710/1
 
A

Andrew Thompson

Lew said:
, quoted or indirectly quoted someone who said: ...
I use Java Server Faces - the faces-config.xml and web.xml are pretty
important there.

You got the web.xml one in your google:

I will include it in the list.
That uses the XMLSchema-instance schema, also very important.

OK, it's a DTD for JSF, but still important:

Ahh.. yes (pained expression) I had originally intended
to include validation against DTDs (which would open
up many other possibilities, like plain old HTML), but
my early attempts to create validation objects from DTDs
were woefully inadequate (exceptions, as I recall).

Perhaps I should revisit that.

(slaps forehead) Of course! That would have to be one
of the 'big ones', at least in terms of the the sheer volume
of documents - I will include it as well.

--
Andrew Thompson
http://www.athompson.info/andrew/

Message posted via JavaKB.com
http://www.javakb.com/Uwe/Forums.aspx/java-general/200710/1
 
R

Roedy Green

Interesting thought. The entire current code would need
to be redesigned to achieve that though, so much so that
it would probably warrant a separate project.
I love sending bugs and RFEs to Andrew. He treats them as precious
gifts. I wish other vendors had his attitude.
 
R

Roedy Green

It is a freeware tool that validates XML against
XML Schema Definitions (XSD). It can be found here.
<http://www.physci.org/xml/xmltools.html#yaxv>

I have a problem using this. Try validating
http://mindprod.com/webstart/replicator.jnlp with
an old JNLP xsd,
http://mindprod.com/jgloss/snippet/jnlp-xml-schema.xsd

When you click on the bottom left panel in order to home in on an
error, you get a brief flash in the upper left panel, the JNLP file
being verified. Then the cursor disappears and you can't see what it
is accompanying about. Perhaps you could select the offending text or
in some other way make it more obvious what code is causing the
trouble -- even matching lines numbers would do.
 
P

Piotr Kobzda

Andrew said:
What are the best XSDs to look at for inclusion?

Hope that those listed there are most interesting from Sun/Java point of
view:
<http://java.sun.com/xml/ns/javaee/#2>

(Follow a bottom links on the page, there is link to commonly used DTDs
also.)

And while I have your attention, bug reports for
YAX-V, as well as either of the existing XSDs, are
most welcome.

My short "wish list" for YAX-V:

* Editable XSD pane. (That would be helpful in quick
writing/correcting/testing XSD files.)

* Possibility to specify the XML/XSD file also as URL. (It would
prevent us from downloading temporary test files, which may be annoying
when for instance .jnlp is associated with JWS launcher.)

* Support for DTD. (Embedded DTD -> XSD Converter would be great,
but also simple validation of "rewritten XML" against a given DTD would
be useful.)


BTW -- regarding "our" JNLP schema ;), note the following quote form the
JNLP spec.:
The modifiers m and k can be used for megabytes and kilobytes,
respectively. For example, "128m" will be the same as specifying
"134217728" (128*1024*1024). The modifiers are not case-sensitive.

That means a size modifiers are optional, and if present, should be in
lower-case.

So the 'memorySizeType' in current version of XSD seams to be incorrect.
It likely should be defined as:

<xs:simpleType name="memorySizeType">
<xs:restriction base="xs:token">
<xs:pattern value="[0-9]+[km]?"/>
</xs:restriction>
</xs:simpleType>



P.S.

Andrew, I've also revised again our discussions on a subjects "JNLP xsd
schema", and "Problem with .jar file", and I realized that there is my
mistake in the latter thread. I'm sure, that I've seen one of the
earlier versions of the JNLP XSD from you, but now I see that it was not
from the post you linked there -- possibly I've seen it pointed from one
of your previous post, no matter... That is to say only, that none of
the NNTP servers used by me feeds better than GG -- your post with
announcement of the XSD, and the one next to it asking for comments, are
both not available from my servers. Which is simply, the "nature of
Usenet" to me...


piotr
 
M

Mike Schilling

Andrew said:
(slaps forehead) Of course! That would have to be one
of the 'big ones', at least in terms of the the sheer volume
of documents - I will include it as well.

Also WSDL and XMLSchema itself. I know of several tools for parsing each
of those, but none I trust to find all the errors in them.
 
A

Andrew Thompson

Piotr Kobzda wrote:
...
So the 'memorySizeType' in current version of XSD seams to be incorrect.

Yep. It was.
It likely should be defined as:

<xs:simpleType name="memorySizeType">
<xs:restriction base="xs:token">
<xs:pattern value="[0-9]+[km]?"/>
</xs:restriction>
</xs:simpleType>

Done. The *new* version has been uploaded.

(Other replies as time/answers permit!)
 
A

Andrew Thompson

Roedy said:

For the moment, I will restrict* testing to the
simpler validator, XMLValidate. I have added
the two URLs to version 0.5 of..
<http://www.physci.org/test/xml/XMLValidate.java>
The output I get when selecting the two files, is..

Create schema from
'http://mindprod.com/jgloss/snippet/jnlp-xml-schema.xsd'.
Schema created successfully.
Validate content from
'http://mindprod.com/webstart/replicator.jnlp' against schema.
org.xml. ..
...
Total (warning, error, fatal) errors detected: 8

Alternately, when I compare it against the XSD for
the latest 6.0 XSD (off the PhySci site)

Create schema from
'http://www.physci.org/JNLP-6.0.xsd'.
Schema created successfully.
Validate content from
'http://mindprod.com/webstart/replicator.jnlp' against schema.
Total (warning, error, fatal) errors detected: 0

That sounds pretty logical, given the mindprod
XSD is for an older version.

OK - whatever errors remain, are peculiar to YAX-V -
I'll look into it after the rework*.

Thanks for the report.

* At the moment, YAX-V is undergoing a huge rework
that will address most of the bugs and RFEs so
far mentioned. But I'd like to clarify validation
against DTDs, before I go too far with that.

--
Andrew Thompson
http://www.athompson.info/andrew/

Message posted via JavaKB.com
http://www.javakb.com/Uwe/Forums.aspx/java-general/200710/1
 
A

Andrew Thompson

Mike said:
...
Also WSDL ..

Not very familiar with WSDL, but based on
one recommendation, sure thing.
..and XMLSchema itself.

That's a good idea.
.. I know of several tools for parsing each
of those, but none I trust to find all the errors in them.

Well - I am hoping we all understand the difference
between malformed, invalid, and just plain wrong -
as fas as the data/content goes, GIGO! ;-)

--
Andrew Thompson
http://www.athompson.info/andrew/

Message posted via JavaKB.com
http://www.javakb.com/Uwe/Forums.aspx/java-general/200710/1
 
A

Andrew Thompson

Andrew said:

A new physci page. libs availalbe for use by
Java Web Start apps. I intend to include things
like JMF and perhaps JAI, but for the moment it
only includes these (trivial) examples that I wanted
to finish in order to test my understanding of
deploying component extensions.

This comprises the list of XSDs for which I've
currently defined 'named link' pairs.

Have I got the best versions to go with?
Some of the URLs seemed quite arbitrary, when
there were multiple hits for that schema.

I did not originally ask for suggestions of DTDs, but
thanks to Piotr's help I now understand how to validate
against DTDs as well - so I intend to offer DTD validation
in the validator.

Any suggestions for inclusion of DTDs?

Intended as a demo. of the named link bean itself.

This links to ..
- a demo that includes both 'named link' files
previously mentioned.
- The JavaDoc for the NamedLink class (most
of the 'frames' etc. links are broken - I only
uploaded that page)
Note that neither of the first two 'demos'
works at the moment, but can be seen in the
lasyt demo.

All fixed now.

--
Andrew Thompson
http://www.athompson.info/andrew/

Message posted via JavaKB.com
http://www.javakb.com/Uwe/Forums.aspx/java-general/200710/1
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top