Most common XML/XSD validations?

Discussion in 'Java' started by Andrew Thompson, Sep 29, 2007.

  1. 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
    Andrew Thompson, Sep 29, 2007
    #1
    1. Advertising

  2. Andrew Thompson

    Roedy Green Guest

    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
    Roedy Green, Oct 1, 2007
    #2
    1. Advertising

  3. Andrew Thompson

    Lew Guest

    "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
    Lew, Oct 1, 2007
    #3
  4. Andrew Thompson

    Roedy Green Guest

    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(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.
    --
    Roedy Green Canadian Mind Products
    The Java Glossary
    http://mindprod.com
    --
    Roedy Green Canadian Mind Products
    The Java Glossary
    http://mindprod.com
    Roedy Green, Oct 1, 2007
    #4
  5. Andrew Thompson

    Roedy Green Guest

    On Sun, 30 Sep 2007 23:23:32 GMT, Roedy Green
    <> 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
    Roedy Green, Oct 1, 2007
    #5
  6. Roedy Green wrote:
    >On Sun, 30 Sep 2007 23:23:32 GMT, Roedy Green
    ><> 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.aspx/java-general/200710/1
    Andrew Thompson, Oct 1, 2007
    #6
  7. 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.aspx/java-general/200710/1
    Andrew Thompson, Oct 1, 2007
    #7
  8. Andrew Thompson

    Roedy Green Guest

    >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, Oct 1, 2007
    #8
  9. Andrew Thompson

    Roedy Green Guest

    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
    Roedy Green, Oct 1, 2007
    #9
  10. Andrew Thompson

    Piotr Kobzda Guest

    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
    Piotr Kobzda, Oct 1, 2007
    #10
  11. Andrew Thompson wrote:
    >> 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.
    Mike Schilling, Oct 1, 2007
    #11
  12. 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!)

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

    Message posted via http://www.javakb.com
    Andrew Thompson, Oct 3, 2007
    #12
  13. Andrew Thompson, Oct 3, 2007
    #13
  14. Roedy Green wrote:
    >>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


    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
    Andrew Thompson, Oct 3, 2007
    #14
  15. Mike Schilling wrote:
    >>> 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! ;-)

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

    Message posted via JavaKB.com
    http://www.javakb.com/Uwe/Forums.aspx/java-general/200710/1
    Andrew Thompson, Oct 3, 2007
    #15
  16. On Sep 30, 6:27 am, "Andrew Thompson" <u32984@uwe> wrote:
    ....
    > 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, Oct 19, 2007
    #16
  17. Andrew Thompson wrote:
    >...
    >> 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.

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

    Message posted via JavaKB.com
    http://www.javakb.com/Uwe/Forums.aspx/java-general/200710/1
    Andrew Thompson, Oct 19, 2007
    #17
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Markus
    Replies:
    1
    Views:
    1,094
    Markus
    Nov 22, 2005
  2. Matt
    Replies:
    3
    Views:
    37,224
    MKNDK
    Sep 11, 2008
  3. stiank81
    Replies:
    4
    Views:
    15,378
    stiank81
    Jun 26, 2005
  4. Rushi
    Replies:
    1
    Views:
    545
  5. Replies:
    0
    Views:
    560
Loading...

Share This Page