Looking for a quick well-formedness tool for Linux

Discussion in 'XML' started by Cambridge Ray, Jul 27, 2011.

  1. I have found all kinds of nice tools, freebies and commercial (Stylus
    Studio) for the Windows side, but find myself uploading and
    downloading XML files between Windows and Linux. I do my development
    (Xerces-C++) on the latter.

    Could really use a SIMPLE Linux app that tells me whether an XML file
    is well-formed, period. I don't even use schemas and all that fancy
    stuff.

    TIA,

    -RFH
    Cambridge Ray, Jul 27, 2011
    #1
    1. Advertising

  2. Cambridge Ray wrote:
    >
    > I have found all kinds of nice tools, freebies and commercial (Stylus
    > Studio) for the Windows side, but find myself uploading and
    > downloading XML files between Windows and Linux. I do my development
    > (Xerces-C++) on the latter.
    >
    > Could really use a SIMPLE Linux app that tells me whether an XML file
    > is well-formed, period. I don't even use schemas and all that fancy
    > stuff.


    Doesn't
    xmllint file.xml
    do what you want? I thought libxml2 and its tool are part of LINUX these
    days.


    --

    Martin Honnen --- MVP Data Platform Development
    http://msmvps.com/blogs/martin_honnen/
    Martin Honnen, Jul 27, 2011
    #2
    1. Advertising

  3. On Jul 27, 11:56 am, Martin Honnen <> wrote:
    > Cambridge Ray wrote:
    >
    > > I have found all kinds of nice tools, freebies and commercial (Stylus
    > > Studio) for the Windows side, but find myself uploading and
    > > downloading XML files between Windows and Linux. I do my development
    > > (Xerces-C++) on the latter.

    >
    > > Could really use a SIMPLE Linux app that tells me whether an XML file
    > > is well-formed, period. I don't even use schemas and all that fancy
    > > stuff.

    >
    > Doesn't
    >    xmllint file.xml
    > do what you want? I thought libxml2 and its tool are part of LINUX these
    > days.


    Great!

    (and I didn't have to download & compile anything)

    Thx,

    -Ramon
    Cambridge Ray, Jul 27, 2011
    #3
  4. Cambridge Ray

    Luuk Guest

    On 27-07-2011 18:22, Cambridge Ray wrote:
    >
    > I have found all kinds of nice tools, freebies and commercial (Stylus
    > Studio) for the Windows side, but find myself uploading and
    > downloading XML files between Windows and Linux. I do my development
    > (Xerces-C++) on the latter.
    >
    > Could really use a SIMPLE Linux app that tells me whether an XML file
    > is well-formed, period. I don't even use schemas and all that fancy
    > stuff.
    >
    > TIA,
    >
    > -RFH
    >


    http://xmlstar.sourceforge.net/

    --
    Luuk
    Luuk, Jul 27, 2011
    #4
  5. Cambridge Ray

    Peter Flynn Guest

    On 27/07/11 17:22, Cambridge Ray wrote:
    >
    > I have found all kinds of nice tools, freebies and commercial (Stylus
    > Studio) for the Windows side, but find myself uploading and
    > downloading XML files between Windows and Linux. I do my development
    > (Xerces-C++) on the latter.
    >
    > Could really use a SIMPLE Linux app that tells me whether an XML file
    > is well-formed, period. I don't even use schemas and all that fancy
    > stuff.


    Any of the standard commandline parsers will do this.
    I use onsgmls (from the OpenSP package) and rxp, but there are many others.

    ///Peter
    --
    XML FAQ: http://xml.silmaril.ie/
    Peter Flynn, Jul 27, 2011
    #5
  6. On 7/27/2011 12:22 PM, Cambridge Ray wrote:
    > Could really use a SIMPLE Linux app that tells me whether an XML file
    > is well-formed, period. I don't even use schemas and all that fancy
    > stuff.


    Any of the nonvalidating Xerces sample programs could be trivially
    adapted for this purpose. Parse the document, discard the DOM (or the
    SAX events), and report success or failure of the parse.


    --
    Joe Kesselman,
    http://www.love-song-productions.com/people/keshlam/index.html

    {} ASCII Ribbon Campaign | "may'ron DaroQbe'chugh vaj bIrIQbej" --
    /\ Stamp out HTML mail! | "Put down the squeezebox & nobody gets hurt."
    Joe Kesselman, Jul 28, 2011
    #6
  7. El 27/07/2011 18:22, Cambridge Ray escribió:
    >
    > I have found all kinds of nice tools, freebies and commercial (Stylus
    > Studio) for the Windows side, but find myself uploading and
    > downloading XML files between Windows and Linux. I do my development
    > (Xerces-C++) on the latter.
    >
    > Could really use a SIMPLE Linux app that tells me whether an XML file
    > is well-formed, period. I don't even use schemas and all that fancy
    > stuff.


    The expat parser includes the 'xmlwf' utility that do just that.

    --
    Manuel Collado - http://lml.ls.fi.upm.es/~mcollado
    Manuel Collado, Jul 28, 2011
    #7
  8. On Jul 27, 1:51 pm, Luuk <> wrote:
    > On 27-07-2011 18:22, Cambridge Ray wrote:
    >
    >
    >
    > > I have found all kinds of nice tools, freebies and commercial (Stylus
    > > Studio) for the Windows side, but find myself uploading and
    > > downloading XML files between Windows and Linux. I do my development
    > > (Xerces-C++) on the latter.

    >
    > > Could really use a SIMPLE Linux app that tells me whether an XML file
    > > is well-formed, period. I don't even use schemas and all that fancy
    > > stuff.

    >
    > > TIA,

    >
    > > -RFH

    >
    > http://xmlstar.sourceforge.net/
    >
    > --
    > Luuk


    "Dear XMLStarlet users,
    you may have noticed that the development of xmlstarlet has somewhat
    stalled. To get the submitted patches applied I volunteered to co-
    admin the project and at least do some maintenance work. Unfortunetaly
    my time is limited and I would like to call for participation."

    -RFH
    Cambridge Ray, Jul 29, 2011
    #8
  9. Cambridge Ray

    Luuk Guest

    On 29-07-2011 19:51, Cambridge Ray wrote:
    > On Jul 27, 1:51 pm, Luuk <> wrote:
    >> On 27-07-2011 18:22, Cambridge Ray wrote:
    >>
    >>
    >>
    >>> I have found all kinds of nice tools, freebies and commercial (Stylus
    >>> Studio) for the Windows side, but find myself uploading and
    >>> downloading XML files between Windows and Linux. I do my development
    >>> (Xerces-C++) on the latter.

    >>
    >>> Could really use a SIMPLE Linux app that tells me whether an XML file
    >>> is well-formed, period. I don't even use schemas and all that fancy
    >>> stuff.

    >>
    >>> TIA,

    >>
    >>> -RFH

    >>
    >> http://xmlstar.sourceforge.net/
    >>
    >> --
    >> Luuk

    >
    > "Dear XMLStarlet users,
    > you may have noticed that the development of xmlstarlet has somewhat
    > stalled. To get the submitted patches applied I volunteered to co-
    > admin the project and at least do some maintenance work. Unfortunetaly
    > my time is limited and I would like to call for participation."
    >
    > -RFH
    >


    But it stil can check for well-formedness ..... ;)

    --
    Luuk
    Luuk, Jul 29, 2011
    #9
  10. Swiping from one of the many examples on DeveloperWorks
    (http://www.ibm.com/xml):

    public class TestSAXParsing {
    public static void main(String[] args) {
    try {
    if (args.length != 1) {
    System.err.println(
    "Usage: java TestSAXParsing [filename]");
    System.exit (1);
    }
    // Get SAX Parser Factory
    SAXParserFactory factory = SAXParserFactory.newInstance();

    // Turn off validation, and turn on namespaces
    // (the latter, at least, is probably the default)
    factory.setValidating(falsee);
    factory.setNamespaceAware(true);

    // Parse the file, discard via a no-op SAX handler
    SAXParser parser = factory.newSAXParser();
    parser.parse(new File(args[0]), new MyHandler());
    } catch (ParserConfigurationException e) {
    System.out.println("Underlying parser does not support" +
    " the requested features.");
    } catch (FactoryConfigurationError e) {
    System.out.println("Error obtaining SAX Parser Factory.");
    } catch (Exception e) {
    e.printStackTrace();
    }
    System.out.println(
    "Parsing completed; XML document well-formed.");
    }
    }

    class MyHandler extends DefaultHandler {
    // No-op implementation of ContentHandler, ErrorHandler, etc.
    }

    --
    Joe Kesselman,
    http://www.love-song-productions.com/people/keshlam/index.html

    {} ASCII Ribbon Campaign | "may'ron DaroQbe'chugh vaj bIrIQbej" --
    /\ Stamp out HTML mail! | "Put down the squeezebox & nobody gets hurt."
    Joe Kesselman, Jul 29, 2011
    #10
  11. Cambridge Ray

    Peter Flynn Guest

    On 29/07/11 20:23, Joe Kesselman wrote:
    > Swiping from one of the many examples on DeveloperWorks
    > (http://www.ibm.com/xml):
    >
    > public class TestSAXParsing {
    > public static void main(String[] args) {
    > try {
    > if (args.length != 1) {
    > System.err.println(
    > "Usage: java TestSAXParsing [filename]");
    > System.exit (1);
    > }
    > // Get SAX Parser Factory
    > SAXParserFactory factory = SAXParserFactory.newInstance();
    >
    > // Turn off validation, and turn on namespaces
    > // (the latter, at least, is probably the default)
    > factory.setValidating(falsee);
    > factory.setNamespaceAware(true);
    >
    > // Parse the file, discard via a no-op SAX handler
    > SAXParser parser = factory.newSAXParser();
    > parser.parse(new File(args[0]), new MyHandler());
    > } catch (ParserConfigurationException e) {
    > System.out.println("Underlying parser does not support" +
    > " the requested features.");
    > } catch (FactoryConfigurationError e) {
    > System.out.println("Error obtaining SAX Parser Factory.");
    > } catch (Exception e) {
    > e.printStackTrace();
    > }
    > System.out.println(
    > "Parsing completed; XML document well-formed.");
    > }
    > }
    >
    > class MyHandler extends DefaultHandler {
    > // No-op implementation of ContentHandler, ErrorHandler, etc.
    > }
    >


    I'll stick with
    $ rxp filename.xml
    thanks :)

    ///Peter
    Peter Flynn, Jul 30, 2011
    #11
    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. Gustaf Liljegren
    Replies:
    0
    Views:
    1,337
    Gustaf Liljegren
    Jun 24, 2003
  2. sylvain.loiseau
    Replies:
    0
    Views:
    401
    sylvain.loiseau
    Oct 29, 2003
  3. Urs Muntwyler
    Replies:
    2
    Views:
    1,809
    Martin SChukrazy
    Mar 5, 2004
  4. Uwe Ziegenhagen
    Replies:
    3
    Views:
    397
    Pavel Lepin
    Oct 26, 2007
  5. Stanimir Stamenkov
    Replies:
    5
    Views:
    2,739
    Stanimir Stamenkov
    Apr 10, 2009
Loading...

Share This Page