Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / October 2007

Tip: Looking for answers? Try searching our database.

JNLP xsd schema

Thread view: 
Roedy Green - 23 Jul 2007 04:24 GMT
I have a JNLP 1.0 xsd schema on my website which can be used to
validate JNLP files.
http://mindprod.com/jgloss/javawebstart.html#VALIDATION

I would like to update that with a JNLP 1.5+ schema.  Google seems to
think nobody but me has a schema.  Is here one? I could I suppose
write one, but I would be nervous since I don't have language lawyer
genes, and I would hate to send people astray misinterpreting the
spec.
Signature

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

Andrew Thompson - 23 Jul 2007 09:21 GMT
>I have a JNLP 1.0 xsd schema on my website which can be used to
>validate JNLP files.
>http://mindprod.com/jgloss/javawebstart.html#VALIDATION
>
>I would like to update that with a JNLP 1.5+ schema.  

Not to my knowledge.  Sun provides a DTD with the JNLP
Spec. documents.. umm.. where-is-it..
<http://www.google.com/search?as_filetype=dtd&as_sitesearch=java.sun.com>
U-yup, there.. 6th link..
<http://java.sun.com/dtd/JNLP-6.0.dtd>
though technically that is for 6, not 5.

>..Google seems to
>think nobody but me has a schema.  

Google also finds my two XSD files at JavaSaver.
<http://www.google.com/search?q=+site%3Ajavasaver.com+filetype%3Axsd>

Maybe there are no logical links (as parsed by Google)
to other 'naked' DTD's and XSD's (vague shrug).

>..Is here one? I could I suppose
>write one, but I would be nervous since I don't have language lawyer
>genes, and I would hate to send people astray misinterpreting the
>spec.

..issue a version with 'all disclaimers - use at own risk'
in the comments at the top, and be done with it - is
my 'IANAL response'.

As an aside, I had also been thinking of making an XSD
of the JNLP DTD, since I know there are tools which will
convert a DTD to a simple XSD (I don't know off-hand
what they are).  I developed a DTD for the XScreenSaver
GUI config. files, somebody converted it to a XSD, and
we quickly abandoned the DTD and instead refined the
XSD.

Signature

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

Roedy Green - 23 Jul 2007 20:13 GMT
>As an aside, I had also been thinking of making an XSD
>of the JNLP DTD, since I know there are tools which will
>convert a DTD to a simple XSD (I don't know off-hand
>what they are)
Perhaps you might create a tool that takes an EXAMPLE XML file with
all possible options, and it creates an XSD you then polish by hand.
Signature

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

Andrew Thompson - 24 Sep 2007 12:09 GMT
...
>As an aside, I had also been thinking of making an XSD
>of the JNLP DTD, ...

Version 1.0 of a Java 6.0 JNLP schema
<http://www.physci.org/JNLP-6.0.xsd>

Comments, failure reports & suggestions for
improvement welcome.

Signature

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

Andrew Thompson - 25 Sep 2007 16:29 GMT
>...
>Version 1.0 of a Java 6.0 JNLP schema
><http://www.physci.org/JNLP-6.0.xsd>
>
>Comments, failure reports & suggestions for
>improvement welcome.

Update - apparently the homepage element is not
correctly defined in the XSD, validators report a
homepage element as invalid.  

I have not yet figured what is wrong with the definition
of the homepage element.

Signature

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

Thomas Fritsch - 23 Jul 2007 10:50 GMT
> I have a JNLP 1.0 xsd schema on my website which can be used to
> validate JNLP files.
> http://mindprod.com/jgloss/javawebstart.html#VALIDATION
Roedy, you probably mean this link:
http://mindprod.com/jgloss/jnlp.html#VALIDATION

Signature

Thomas

Roedy Green - 23 Jul 2007 15:24 GMT
On Mon, 23 Jul 2007 09:50:58 GMT, Thomas Fritsch
<i.dont.like.spam@invalid.com> wrote, quoted or indirectly quoted
someone who said :
>> http://mindprod.com/jgloss/javawebstart.html#VALIDATION
>Roedy, you probably mean this link:
>http://mindprod.com/jgloss/jnlp.html#VALIDATION
I changed the link shortly after I posted.. I have moved the JNLP
stuff out of the java webstart.html link.  
Signature

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

Roedy Green - 23 Jul 2007 19:40 GMT
On Mon, 23 Jul 2007 03:24:01 GMT, Roedy Green
<see_website@mindprod.com.invalid> wrote, quoted or indirectly quoted
someone who said :

>I would like to update that with a JNLP 1.5+ schema.  Google seems to
>think nobody but me has a schema.  Is here one? I could I suppose
>write one, but I would be nervous since I don't have language lawyer
>genes, and I would hate to send people astray misinterpreting the
>spec.
I got an email from Sun. They said they post a DTD for 1.5 and 6, but
no xsd or other advanced schemas. I have the URLS at
http://mindprod.com/jgloss/jnlp.html
Signature

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

Piotr Kobzda - 24 Jul 2007 01:11 GMT
> I got an email from Sun. They said they post a DTD for 1.5 and 6, but
> no xsd or other advanced schemas. I have the URLS at
> http://mindprod.com/jgloss/jnlp.html

Interestingly, theirs DTD for 6 seems to be invalid (in both, Sun site,
and in Appendix C of JNLP specification).

Corrections needed (my guess):

<!ELEMENT update>
should be:
<!ELEMENT update EMPTY>

and:

<!ELEMENT shortcut (desktop? menu?)>
should be:
<!ELEMENT shortcut (desktop?, menu?)>

DTD for 1.5 seems to be correct.

If you want convert them automatically to XSD (as Andrew suggested
earlier) some tools you can find there:
http://www.w3.org/XML/Schema#Tools

(about a year ago I successfully used XMLSpy for that)

However, instead of validating against XSD, there is also possibility to
validate JNLP file against DTD directly.  That usually requires an
addition (or rewriting) of DTD in that file.  But hopefully, we can
perform that on the fly -- an example using StAX (from Java 6) is below.

piotr

import java.io.*;

import javax.xml.parsers.*;
import javax.xml.stream.*;
import javax.xml.stream.events.*;

import org.xml.sax.*;
import org.xml.sax.helpers.*;

public class ValidateJNLP {

    public static void main(String[] args) throws Exception {
        File input_file = new File(args[0]);
        File dtd_file = new File("JNLP-6.0.dtd");

        // rewrite input file...

        StringWriter rewrite_out = new StringWriter();

        XMLInputFactory xif = XMLInputFactory.newInstance();
        XMLOutputFactory xof = XMLOutputFactory.newInstance();
        XMLEventFactory xef = XMLEventFactory.newInstance();

        XMLEventReader er = xif.createXMLEventReader(
                new FileReader(input_file));
        XMLEventWriter ew = xof.createXMLEventWriter(rewrite_out);

        while (er.hasNext()) {
            XMLEvent e = er.nextEvent();

            if (e.isStartElement()) {
                // creatre new DTD
                DTD dtd = xef.createDTD("<!DOCTYPE jnlp"
                        + " SYSTEM \"" + dtd_file.toURI() + "\">");
                ew.add(dtd);
                ew.add(e);
                break;
            } else if (e instanceof DTD) {
                // skip original DTD
                System.err.println("original DTD skipped!");
            } else {
                // write event as is
                ew.add(e);
            }
        }
        // write all left input events...
        ew.add(er);
        ew.flush();
        ew.close();

     // System.out.println(rewrite_out.toString());
        StringReader rewritten_in
                = new StringReader(rewrite_out.toString());

        // validate...

        SAXParserFactory spf = SAXParserFactory.newInstance();
        spf.setValidating(true);

        SAXParser sp = spf.newSAXParser();

        InputSource is = new InputSource(rewritten_in);
        sp.parse(is, new JNLPErrorHandler());
    }

}

class JNLPErrorHandler extends DefaultHandler {

    @Override
    public void warning(SAXParseException exception) throws SAXException {
        System.err.println(exception);
    }

    @Override
    public void error(SAXParseException exception) throws SAXException {
        System.err.println(exception);
    }

    @Override
    public void fatalError(SAXParseException exception) throws
SAXException {
        System.err.println(exception);
    }
}
Andrew Thompson - 24 Jul 2007 03:27 GMT
>> I got an email from Sun. They said they post a DTD for 1.5 and 6, but
>> no xsd or other advanced schemas. I have the URLS at
>> http://mindprod.com/jgloss/jnlp.html
>
>Interestingly, theirs DTD for 6 seems to be invalid (in both, Sun site,
>and in Appendix C of JNLP specification).

<grumble>Unfortunate, but not that surpsising for Sun.</grumble>
...
>If you want convert them automatically to XSD ... some tools you can find there:
>http://www.w3.org/XML/Schema#Tools

Thanks.  I never look forward to the initial work of
transforming DTD -> XSD.

>(about a year ago I successfully used XMLSpy for that)
>
>However, instead of validating against XSD, there is also possibility to
>validate JNLP file against DTD directly.  

Sure there is, but why would you bother?
XSD can check eveything specified in a DTD,
plus a whole lot more besides.

Signature

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

Piotr Kobzda - 24 Jul 2007 10:13 GMT
>> However, instead of validating against XSD, there is also possibility to
>> validate JNLP file against DTD directly.  
>
> Sure there is, but why would you bother?

Because DTD is only officially available definition?

> XSD can check eveything specified in a DTD,
> plus a whole lot more besides.

Yes, XSD can do a lot more than DTD can, but unfortunately, not all what
DTD can do, is possible with XSD.  For example, there is internal and
external DTD, and a lot of tricky features of DTD possible, e.g.
entities, definitions overriding, etc., which by design are not a
features of XSD.  DTD is tightly bound into XML document parsing, and,
in general, can not be converted into fully equivalent XSD.  Of course,
as we know, there is nothing tricky in DTD for JNLP, and assuming
non-tricky use of it, we can easily convert it into equivalent XSD.  But
since JNLP is defined using DTD only, we do not need any extra features
that XSD offer (using them, we could possibly change the definition).
Moreover, to use XSD, we must in our own risk convert the original DTD
(there is no support for that in standard Java), which puts additional
layer, possibly error prone, into validation process.  As the result,
making the validation less trust-worthy than direct use of the definition.

piotr
Andrew Thompson - 24 Jul 2007 04:33 GMT
...
>Interestingly, theirs DTD for 6 seems to be invalid (in both, Sun site,
>and in Appendix C of JNLP specification).
>
>Corrections needed (my guess):

Your guesses seem pretty solid to me.

><!ELEMENT update>
>should be:
><!ELEMENT update EMPTY>

xss2dtd would not parse the file before I added that, and..

><!ELEMENT shortcut (desktop? menu?)>

..leads to..
<xs:sequence>
<xs:element minOccurs="0" ref="desktop? menu"/>
</xs:sequence>

..which appears completely bogus to me, and
more like an error on the part of xss2dtd.

>should be:
><!ELEMENT shortcut (desktop?, menu?)>

<xs:sequence>
<xs:element minOccurs="0" ref="desktop"/>
<xs:element minOccurs="0" ref="menu"/>
</xs:sequence>

..that looks more like it  
...
>..some tools you can find there:
>http://www.w3.org/XML/Schema#Tools

I clicked the link to ..

>(about a year ago I successfully used XMLSpy for that)

..XMLSpy but while waiting for the page to load, saw
dtd2xss, looked at their page, 'liked the price', and had
it mostly donwloaded before I decided I could not be
bothered waiting any longer for the other page to arrive.  ;-)

Here is the XSD that xss2dtd produces, based on Piotr's
corrections, above - with a comment in the header
.. It's only 270 odd lines..

<!--
Adapted from Sun's DTD..
jnlp PUBLIC "-//Sun Microsystems, Inc//DTD JNLP Discriptor 6.0//EN"
"http://java.sun.com/dtd/JNLP-6.0.dtd"

Oh.. and note that should be Descriptor, not (bloody) Discriptor.
-->
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" name="jnlp">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" ref="information"/>
<xs:element minOccurs="0" ref="security"/>
<xs:element minOccurs="0" ref="update"/>
<xs:element maxOccurs="unbounded" minOccurs="0" ref="resources"/>
<xs:choice>
<xs:element ref="application-desc"/>
<xs:element ref="applet-desc"/>
<xs:element ref="component-desc"/>
<xs:element ref="installer-desc"/>
</xs:choice>
</xs:sequence>
<xs:attribute name="spec" type="xs:string"/>
<xs:attribute name="version" type="xs:string"/>
<xs:attribute name="codebase" type="xs:string"/>
<xs:attribute name="href" type="xs:string"/>
</xs:complexType>
<xs:complexType>
<xs:sequence>
<xs:element ref="title"/>
<xs:element ref="vendor"/>
<xs:element minOccurs="0" ref="homepage"/>
<xs:element maxOccurs="unbounded" minOccurs="0" ref="description"/>
<xs:element maxOccurs="unbounded" minOccurs="0" ref="icon"/>
<xs:element minOccurs="0" ref="offline-allowed"/>
<xs:element minOccurs="0" ref="shortcut"/>
<xs:element minOccurs="0" ref="association"/>
<xs:element maxOccurs="unbounded" minOccurs="0" ref="related-content"/>
</xs:sequence>
<xs:attribute name="os" type="xs:string"/>
<xs:attribute name="arch" type="xs:string"/>
<xs:attribute name="platform" type="xs:string"/>
<xs:attribute name="locale" type="xs:string"/>
</xs:complexType>
<xs:complexType>
<xs:attribute name="href" type="xs:string" use="required"/>
</xs:complexType>
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="kind">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="one-line"/>
<xs:enumeration value="short"/>
<xs:enumeration value="tooltip"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:complexType>
<xs:attribute name="href" type="xs:string" use="required"/>
<xs:attribute name="version" type="xs:string"/>
<xs:attribute name="width" type="xs:string"/>
<xs:attribute name="height" type="xs:string"/>
<xs:attribute name="kind" type="xs:string"/>
<xs:attribute name="depth" type="xs:string"/>
<xs:attribute name="size" type="xs:string"/>
</xs:complexType>
<xs:complexType/>
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" ref="all-permissions"/>
<xs:element minOccurs="0" ref="j2ee-application-client-permissions"/>
</xs:sequence>
</xs:complexType>
<xs:complexType/>
<xs:complexType/>
<xs:complexType>
<xs:attribute default="timeout" name="check">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="always"/>
<xs:enumeration value="timeout"/>
<xs:enumeration value="background"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute default="always" name="policy">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="always"/>
<xs:enumeration value="prompt-update"/>
<xs:enumeration value="prompt-run"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:complexType>
<xs:complexType>
<xs:choice maxOccurs="unbounded" minOccurs="0">
<xs:element ref="java"/>
<xs:element ref="j2se"/>
<xs:element ref="jar"/>
<xs:element ref="nativelib"/>
<xs:element ref="extension"/>
<xs:element ref="property"/>
<xs:element ref="package"/>
</xs:choice>
<xs:attribute name="os" type="xs:string"/>
<xs:attribute name="arch" type="xs:string"/>
<xs:attribute name="locale" type="xs:string"/>
</xs:complexType>
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" minOccurs="0" ref="resources"/>
</xs:sequence>
<xs:attribute name="version" type="xs:string" use="required"/>
<xs:attribute name="href" type="xs:string"/>
<xs:attribute name="initial-heap-size" type="xs:string"/>
<xs:attribute name="max-heap-size" type="xs:string"/>
<xs:attribute name="java-vm-args" type="xs:string"/>
</xs:complexType>
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" minOccurs="0" ref="resources"/>
</xs:sequence>
<xs:attribute name="version" type="xs:string" use="required"/>
<xs:attribute name="href" type="xs:string"/>
<xs:attribute name="initial-heap-size" type="xs:string"/>
<xs:attribute name="max-heap-size" type="xs:string"/>
<xs:attribute name="java-vm-args" type="xs:string"/>
</xs:complexType>
<xs:complexType>
<xs:attribute name="href" type="xs:string" use="required"/>
<xs:attribute name="version" type="xs:string"/>
<xs:attribute default="false" name="main">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="true"/>
<xs:enumeration value="false"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute default="eager" name="download">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="eager"/>
<xs:enumeration value="lazy"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="size" type="xs:string"/>
<xs:attribute name="part" type="xs:string"/>
</xs:complexType>
<xs:complexType>
<xs:attribute name="href" type="xs:string" use="required"/>
<xs:attribute name="version" type="xs:string"/>
<xs:attribute default="eager" name="download">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="eager"/>
<xs:enumeration value="lazy"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="size" type="xs:string"/>
<xs:attribute name="part" type="xs:string"/>
</xs:complexType>
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" minOccurs="0" ref="ext-download"/>
</xs:sequence>
<xs:attribute name="version" type="xs:string"/>
<xs:attribute name="name" type="xs:string"/>
<xs:attribute name="href" type="xs:string" use="required"/>
</xs:complexType>
<xs:complexType>
<xs:attribute name="ext-part" type="xs:string" use="required"/>
<xs:attribute default="eager" name="download">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="lazy"/>
<xs:enumeration value="eager"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="part" type="xs:string"/>
</xs:complexType>
<xs:complexType>
<xs:attribute name="name" type="xs:string" use="required"/>
<xs:attribute name="value" type="xs:string" use="required"/>
</xs:complexType>
<xs:complexType>
<xs:attribute name="name" type="xs:string" use="required"/>
<xs:attribute name="part" type="xs:string" use="required"/>
<xs:attribute default="false" name="recursive">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="true"/>
<xs:enumeration value="false"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:complexType>
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" minOccurs="0" ref="argument"/>
</xs:sequence>
<xs:attribute name="main-class" type="xs:string"/>
</xs:complexType>
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" minOccurs="0" ref="param"/>
</xs:sequence>
<xs:attribute name="documentbase" type="xs:string"/>
<xs:attribute name="main-class" type="xs:string" use="required"/>
<xs:attribute name="name" type="xs:string" use="required"/>
<xs:attribute name="width" type="xs:string" use="required"/>
<xs:attribute name="height" type="xs:string" use="required"/>
</xs:complexType>
<xs:complexType>
<xs:attribute name="name" type="xs:string" use="required"/>
<xs:attribute name="value" type="xs:string" use="required"/>
</xs:complexType>
<xs:complexType/>
<xs:complexType>
<xs:attribute name="main-class" type="xs:string"/>
</xs:complexType>
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" ref="desktop"/>
<xs:element minOccurs="0" ref="menu"/>
</xs:sequence>
<xs:attribute default="true" name="online">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="true"/>
<xs:enumeration value="false"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:complexType>
<xs:complexType/>
<xs:complexType>
<xs:attribute name="submenu" type="xs:string"/>
</xs:complexType>
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" ref="description"/>
<xs:element minOccurs="0" ref="icon"/>
</xs:sequence>
<xs:attribute name="extensions" type="xs:string" use="required"/>
<xs:attribute name="mime-type" type="xs:string" use="required"/>
</xs:complexType>
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" ref="title"/>
<xs:element minOccurs="0" ref="description"/>
<xs:element minOccurs="0" ref="icon"/>
</xs:sequence>
<xs:attribute name="href" type="xs:string" use="required"/>
</xs:complexType>
</xs:schema>

I might be looking to put some form of this up on my
site in the future, but it has not even been taken for a
test drive, yet.

HTH

Signature

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

Andrew Thompson - 24 Jul 2007 04:40 GMT
...
>xss2dtd would not parse ...

Oh.. and note that every reference to xss2dtd in that
post, should actually have been a reference to dtd2xss
(ya' complete moron, Andrew).

In fact, it seems they've dropped the final 's' - 'dtd2xs'.
Maybe because it sounds 'kewl' (Shop till you drop?
DTD 2 XS!).  Their site is..
<http://www.lumrix.net/dtd2xs.php>

Signature

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

Piotr Kobzda - 24 Jul 2007 10:27 GMT
> Here is the XSD that xss2dtd produces, based on Piotr's
> corrections, above - with a comment in the header
> . It's only 270 odd lines..

Possibly "copying & pasting" it caused loosing of some important parts
of the XSD -- now it's invalid (69 errors :) ).

In addition to the w3c's list of tools, you may find useful the on-line
utilities at:
http://www.hitsw.com/xml_utilites/

The "DTD to XML Schema" tool seems to produce correct XSD equivalents
for all DTDs I tried it with, all in just a few clicks.

piotr
Andrew Thompson - 29 Jul 2007 03:20 GMT
>> Here is the XSD that xss2dtd produces, based on Piotr's
>> corrections, above - with a comment in the header
>> . It's only 270 odd lines..
>
>Possibly "copying & pasting" it caused loosing of some important parts
>of the XSD -- now it's invalid (69 errors :) ).

Perhaps!   Whatever happened, it happened to my local
copy as well.  :-(

>In addition to the w3c's list of tools, you may find useful the on-line
>utilities at:
>http://www.hitsw.com/xml_utilites/
>
>The "DTD to XML Schema" tool seems to produce correct XSD equivalents
>for all DTDs I tried it with, all in just a few clicks.

Spot on!  I'm now working with an XSD developed
using that page* and based upon the corrections you
suggested to Sun's DTD.  It is the first time I've been
able to see a 'valid JNLP' (checking against a valid XSD)
message in a little validator I'm putting together.

Once I've finished checking and refining the XSD, I'll
upload it and give the URL.

* I was also considering trying to download Altova's
'trial ware' packs - but at 100 meg, that blows my
entire month's limit of downloads before being
bandwidth throttled!

Signature

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

Andrew Thompson - 04 Oct 2007 11:25 GMT
>> I got an email from Sun. They said they post a DTD for 1.5 and 6,
...
>Interestingly, theirs DTD for 6 seems to be invalid
...
><!ELEMENT update>
>should be:
><!ELEMENT update EMPTY>
...
><!ELEMENT shortcut (desktop? menu?)>
>should be:
><!ELEMENT shortcut (desktop?, menu?)>

D'Oh - and after you pointed that out to me *again*
in email the other night, I had the /sneaking/ suspicion
somebody had mentioned it before!

...
>However, instead of validating against XSD, there is also possibility to
>validate JNLP file against DTD directly.  
...
>public class ValidateJNLP {

My first take on ValidateJNLP.java, *DTDValidate.java*
<http://www.physci.org/test/xml/DTDValidate.java>

It can pull (xthml, html, xml, jnlp) documents and
(DTD) definitions direct by URL, and parse the former
against the latter - presuming the latter (the DTD)
are themselves valid documents!

Which brings me to the fact that at one stage
I had trouble running the code posted by Piotr,
specifically because I was running it against
Sun's invalid DTD (and not examining the stacktrace
very diligently).

Fortunately, Piotr saw my stacktrace the other day,
made the right conlcusions, and reminded me of the
things he mentioned above, *and* provided the edited
DTD.

In any case, this code shows what he means.  Not
only does it provide drop-downs for a variety of
JNLP documents and the W3C homepage (XHTML),
and some DTDs - starting with Sun's currently invalid
Java 6 DTD for JNLP, but also including a mirror, and
Piotr's valid version at physci, and XHTML, HTML 4.01 ..

The drop-downs are editable, so if your favorite
document or definition is not listed, just type
or paste it.

The third prompt is for the doctype ('jnlp', 'html' etc.),
this was hardcoded to 'jnlp' in the original ValidateJNLP
example.  Perhaps there is some clever way of
retrieving it from the DTD directly?

So.  That settles that the revamped YAX-V will do DTD
checking as well.

This also effectively concludes the thread
 msg. ID: 7922e446136ca@uwe
 Sub: Validate XML against DTD? XSD OK. SSCCE.
But I will mention that on-thread.

Signature

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



Free Magazines

Get 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 ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.