Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Java (http://www.velocityreviews.com/forums/f30-java.html)
-   -   Most common XML/XSD validations? (http://www.velocityreviews.com/forums/t540898-most-common-xml-xsd-validations.html)

Andrew Thompson 09-29-2007 08:27 PM

Most common XML/XSD validations?
 
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.

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

Message posted via http://www.javakb.com


Roedy Green 09-30-2007 11:23 PM

Re: Most common XML/XSD validations?
 
On Sat, 29 Sep 2007 20:27:54 GMT, "Andrew Thompson" <u32984@uwe>
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.
--
Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com

Lew 09-30-2007 11:42 PM

Re: Most common XML/XSD validations?
 
"Andrew Thompson" wrote, quoted or indirectly quoted someone who said:
>> What are the best XSDs to look at for inclusion?


Roedy Green wrote:
> 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">

--
Lew

Roedy Green 10-01-2007 12:49 AM

Re: Most common XML/XSD validations?
 
On Sat, 29 Sep 2007 20:27:54 GMT, "Andrew Thompson" <u32984@uwe>
wrote, quoted or indirectly quoted someone who said :

>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(XM LValidator.java:324)
at
org.physci.xml.tool.validate.XMLValidator.validate Content(XMLValidator.java:363)
at
org.physci.xml.tool.validate.XMLValidator$Validate Worker.doInBackground(XMLValidator.java:477)
at
org.physci.xml.tool.validate.XMLValidator$Validate Worker.doInBackground(XMLValidator.java:471)
at javax.swing.SwingWorker$1.call(Unknown Source)
at java.util.concurrent.FutureTask$Sync.innerRun(Unkn own
Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at javax.swing.SwingWorker.run(Unknown Source)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run Task(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.
--
Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com
--
Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com

Roedy Green 10-01-2007 01:01 AM

Re: Most common XML/XSD validations?
 
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.


--
Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com

Andrew Thompson 10-01-2007 01:57 AM

Re: Most common XML/XSD validations?
 
Roedy Green wrote:
>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.


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.asp...neral/200710/1


Andrew Thompson 10-01-2007 01:58 AM

Re: Most common XML/XSD validations?
 
Lew wrote:
>"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.

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

Message posted via JavaKB.com
http://www.javakb.com/Uwe/Forums.asp...neral/200710/1


Roedy Green 10-01-2007 03:53 AM

Re: Most common XML/XSD validations?
 
>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.
--
Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com

Roedy Green 10-01-2007 09:35 AM

Re: Most common XML/XSD validations?
 
On Sat, 29 Sep 2007 20:27:54 GMT, "Andrew Thompson" <u32984@uwe>
wrote, quoted or indirectly quoted someone who said :

>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.
--
Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com

Piotr Kobzda 10-01-2007 04:13 PM

Re: Most common XML/XSD validations?
 
Andrew Thompson wrote:

> 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


All times are GMT. The time now is 02:29 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.