The group you are posting to is a
Usenet group . Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
Newsgroups: comp.lang.java.programmer
From:
Roedy Green <see_webs... @mindprod.com.invalid>
Date: Mon, 23 Jul 2007 03:24:01 GMT
Local: Mon, Jul 23 2007 1:24 pm
Subject: JNLP xsd schema
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. -- Roedy Green Canadian Mind Products The Java Glossary http://mindprod.com
You must
Sign in before you can post messages.
You do not have the permission required to post.
Newsgroups: comp.lang.java.programmer
From: "Andrew Thompson" <u32984@uwe>
Date: Mon, 23 Jul 2007 08:21:48 GMT
Local: Mon, Jul 23 2007 6:21 pm
Subject: Re: JNLP xsd 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.
-- Andrew Thompson http://www.athompson.info/andrew/
Message posted via JavaKB.com http://www.javakb.com/Uwe/Forums.aspx/java-general/200707/1
You must
Sign in before you can post messages.
You do not have the permission required to post.
Newsgroups: comp.lang.java.programmer
From:
Thomas Fritsch <i.dont.like.s... @invalid.com>
Date: Mon, 23 Jul 2007 09:50:58 GMT
Local: Mon, Jul 23 2007 7:50 pm
Subject: Re: JNLP xsd schema
You must
Sign in before you can post messages.
You do not have the permission required to post.
Newsgroups: comp.lang.java.programmer
From:
Roedy Green <see_webs... @mindprod.com.invalid>
Date: Mon, 23 Jul 2007 14:24:24 GMT
Local: Tues, Jul 24 2007 12:24 am
Subject: Re: JNLP xsd schema
On Mon, 23 Jul 2007 09:50:58 GMT, Thomas Fritsch <i.dont.like.s... @invalid.com> wrote, quoted or indirectly quoted someone who said : I changed the link shortly after I posted.. I have moved the JNLP stuff out of the java webstart.html link. -- Roedy Green Canadian Mind Products The Java Glossary http://mindprod.com
You must
Sign in before you can post messages.
You do not have the permission required to post.
Newsgroups: comp.lang.java.programmer
From:
Roedy Green <see_webs... @mindprod.com.invalid>
Date: Mon, 23 Jul 2007 18:40:16 GMT
Local: Tues, Jul 24 2007 4:40 am
Subject: Re: JNLP xsd schema
On Mon, 23 Jul 2007 03:24:01 GMT, Roedy Green <see_webs... @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 -- Roedy Green Canadian Mind Products The Java Glossary http://mindprod.com
You must
Sign in before you can post messages.
You do not have the permission required to post.
Newsgroups: comp.lang.java.programmer
From:
Roedy Green <see_webs... @mindprod.com.invalid>
Date: Mon, 23 Jul 2007 19:13:31 GMT
Local: Tues, Jul 24 2007 5:13 am
Subject: Re: JNLP xsd schema
On Mon, 23 Jul 2007 08:21:48 GMT, "Andrew Thompson" <u32984@uwe> wrote, quoted or indirectly quoted someone who said : >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. -- Roedy Green Canadian Mind Products The Java Glossary http://mindprod.com
You must
Sign in before you can post messages.
You do not have the permission required to post.
Newsgroups: comp.lang.java.programmer
From:
Piotr Kobzda <pi... @gazeta.pl>
Date: Tue, 24 Jul 2007 02:11:15 +0200
Local: Tues, Jul 24 2007 10:11 am
Subject: Re: JNLP xsd schema
Roedy Green wrote:
> 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); }
}
You must
Sign in before you can post messages.
You do not have the permission required to post.
Newsgroups: comp.lang.java.programmer
From: "Andrew Thompson" <u32984@uwe>
Date: Tue, 24 Jul 2007 02:27:18 GMT
Local: Tues, Jul 24 2007 12:27 pm
Subject: Re: JNLP xsd schema
Piotr Kobzda wrote:
>> 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> ..
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. -- Andrew Thompson http://www.athompson.info/andrew/
Message posted via JavaKB.com http://www.javakb.com/Uwe/Forums.aspx/java-general/200707/1
You must
Sign in before you can post messages.
You do not have the permission required to post.
Newsgroups: comp.lang.java.programmer
From: "Andrew Thompson" <u32984@uwe>
Date: Tue, 24 Jul 2007 03:33:20 GMT
Local: Tues, Jul 24 2007 1:33 pm
Subject: Re: JNLP xsd schema
Piotr Kobzda wrote:
..
>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 ..
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
-- Andrew Thompson
...
read more »
You must
Sign in before you can post messages.
You do not have the permission required to post.
Newsgroups: comp.lang.java.programmer
From: "Andrew Thompson" <u32984@uwe>
Date: Tue, 24 Jul 2007 03:40:20 GMT
Local: Tues, Jul 24 2007 1:40 pm
Subject: Re: JNLP xsd schema