Java Forum / General / November 2007
Most common XML/XSD validations?
Andrew Thompson - 29 Sep 2007 18:27 GMT 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.
 Signature Andrew Thompson http://www.athompson.info/andrew/
Roedy Green - 01 Oct 2007 00:23 GMT >What are the best XSDs to look at for inclusion? what Java folk most commonly need are validation of JNLP files at the various levels.
 Signature Roedy Green Canadian Mind Products The Java Glossary http://mindprod.com
Lew - 01 Oct 2007 00:42 GMT "Andrew Thompson" wrote, quoted or indirectly quoted someone who said:
>> What are the best XSDs to look at for inclusion?
> 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">
 Signature Lew
Andrew Thompson - 01 Oct 2007 02:58 GMT >"Andrew Thompson" wrote, quoted or indirectly quoted someone who said: >>> What are the best XSDs to look at for inclusion? ...
>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.
>XHTML. (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.
 Signature Andrew Thompson http://www.athompson.info/andrew/
Mike Schilling - 01 Oct 2007 20:52 GMT >> XHTML. > > (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.
Andrew Thompson - 03 Oct 2007 17:17 GMT >>> XHTML. ...
>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! ;-)
 Signature Andrew Thompson http://www.athompson.info/andrew/
Roedy Green - 01 Oct 2007 02:01 GMT On Sun, 30 Sep 2007 23:23:32 GMT, Roedy Green <see_website@mindprod.com.invalid> wrote, quoted or indirectly quoted someone who said :
>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.
 Signature Roedy Green Canadian Mind Products The Java Glossary http://mindprod.com
Andrew Thompson - 01 Oct 2007 02:57 GMT >On Sun, 30 Sep 2007 23:23:32 GMT, Roedy Green ><see_website@mindprod.com.invalid> wrote, quoted or indirectly quoted [quoted text clipped - 10 lines] >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.
 Signature Andrew Thompson http://www.athompson.info/andrew/
Roedy Green - 01 Oct 2007 04:53 GMT >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.
 Signature Roedy Green Canadian Mind Products The Java Glossary http://mindprod.com
Roedy Green - 01 Oct 2007 01:49 GMT >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.
 Signature Roedy Green Canadian Mind Products The Java Glossary http://mindprod.com -- Roedy Green Canadian Mind Products The Java Glossary http://mindprod.com
Andrew Thompson - 29 Nov 2007 04:52 GMT ...
>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. I am trialling two different alternate ways to link to JNLP files. The ways are a 'styled link'* and standard 'button'**. While the button is better for end users, I suspect programmers*** would prefer the styled link.
* <http://www.physci.org/jws/launch.html#styledlink> ** <http://www.physci.org/jws/launch.html#button> *** it is easier to see/grab the direct link to the JNLP file.
Thoughts?
 Signature Andrew Thompson http://www.physci.org/
Roedy Green - 01 Oct 2007 10:35 GMT >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.
 Signature Roedy Green Canadian Mind Products The Java Glossary http://mindprod.com
Andrew Thompson - 03 Oct 2007 16:33 GMT >>It is a freeware tool that validates XML against >>XML Schema Definitions (XSD). It can be found here. [quoted text clipped - 4 lines] >an old JNLP xsd, >http://mindprod.com/jgloss/snippet/jnlp-xml-schema.xsd 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.
 Signature Andrew Thompson http://www.athompson.info/andrew/
Piotr Kobzda - 01 Oct 2007 17:13 GMT > 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
Andrew Thompson - 03 Oct 2007 14:56 GMT ...
>So the 'memorySizeType' in current version of XSD seams to be incorrect. Yep. It was.
> It likely should be defined as: > [quoted text clipped - 3 lines] > </xs:restriction> ></xs:simpleType> Done. The *new* version has been uploaded.
(Other replies as time/answers permit!)
 Signature Andrew Thompson http://www.athompson.info/andrew/
Andrew Thompson - 03 Oct 2007 15:04 GMT ... (JNLP 6.0 XSD)
>...The *new* version has been uploaded. (..or at least, it is now..) Version 2007/10/04 - 0.4 <http://www.physci.org/JNLP-6.0.xsd>
 Signature Andrew Thompson http://www.athompson.info/andrew/
Andrew Thompson - 19 Oct 2007 04:11 GMT ...
> I am after suggestions for inclusions in the > list, of common XSD files. <http://www.physci.org/lib.html> <http://www.physci.org/lib.html#xsd-url> <http://www.physci.org/lib.html#dtd-url> <http://www.physci.org/lib.html#namedlink>
Note that neither of the first two 'demos' works at the moment, but can be seen in the lasyt demo. I will look into it when I have time. More discussion later.
Andrew T.
Andrew Thompson - 19 Oct 2007 12:59 GMT >... >> I am after suggestions for inclusions in the >> list, of common XSD files. > ><http://www.physci.org/lib.html> 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.
><http://www.physci.org/lib.html#xsd-url> 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.
><http://www.physci.org/lib.html#dtd-url> 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?
><http://www.physci.org/lib.html#namedlink> 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.
 Signature Andrew Thompson http://www.athompson.info/andrew/
Free MagazinesGet these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...
|
|
|