How to test for JDOMExceptions in an XML file?

Discussion in 'Java' started by Steve, Sep 18, 2009.

  1. Steve

    Steve Guest

    Hi;

    I'm stuck occasionally making XML files that for various boring
    reasons I can't test before putting it into production.

    The last JDOMException I got complained about an extra (blank, I never
    saw it ) line at the end of the file.

    I tried running my XML file through the syntax checker at w3.org, but
    it didn't catch it.

    Is there a utility where I could feed my XML file into it and it would
    check it as rigourously as the JDOM?

    Thanks in advance

    Steve
    Steve, Sep 18, 2009
    #1
    1. Advertising

  2. "Steve" <> wrote in message
    news:
    > Hi;
    >
    > I'm stuck occasionally making XML files that for various
    > boring reasons I can't test before putting it into
    > production.
    >
    > The last JDOMException I got complained about an extra
    > (blank, I never saw it ) line at the end of the file.
    >
    > I tried running my XML file through the syntax checker at
    > w3.org, but it didn't catch it.
    >
    > Is there a utility where I could feed my XML file into it
    > and it would check it as rigourously as the JDOM?
    >
    > Thanks in advance
    >
    > Steve


    How many lines of Java code would it make to write such a tester using JDOM?

    Just a thought.
    Donkey Hottie, Sep 18, 2009
    #2
    1. Advertising

  3. Steve wrote:
    > Hi;
    >
    > I'm stuck occasionally making XML files that for various boring
    > reasons I can't test before putting it into production.
    >
    > The last JDOMException I got complained about an extra (blank, I
    > never
    > saw it ) line at the end of the file.


    That should not cause a parsing error. See the XML spec at
    http://www.w3.org/TR/REC-xml/

    [1] document ::= prolog element Misc*
    [3] S ::= (#x20 | #x9 | #xD | #xA)+
    [27] Misc ::= Comment | PI | S

    In other words, an XML document can end with an arbitrary amount of
    whitespace.
    Mike Schilling, Sep 18, 2009
    #3
    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. RoyalDutchman
    Replies:
    0
    Views:
    395
    RoyalDutchman
    Dec 17, 2003
  2. jkflens
    Replies:
    2
    Views:
    1,468
    jkflens
    May 30, 2006
  3. Skybuck Flying

    Call oddities: &Test() vs &Test vs Test

    Skybuck Flying, Oct 4, 2009, in forum: C Programming
    Replies:
    1
    Views:
    694
    Skybuck Flying
    Oct 4, 2009
  4. Hunt Jon
    Replies:
    1
    Views:
    102
    Patrick Doyle
    Dec 15, 2008
  5. Erik Wasser
    Replies:
    5
    Views:
    450
    Peter J. Holzer
    Mar 5, 2006
Loading...

Share This Page