XML DTD analysis, diffing ...

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • olive

    #1

    XML DTD analysis, diffing ...

    Hi,

    I have a bunch of similar DTDs written by different coders.

    I would like to normalize, sort elements and attributes by name and
    compare those files.

    Do you know any XML DTD parser/normalizer written in Python ?

    If not, how would you perform that task in Python language ?

    Please,

    Olive.

  • kyosohma@gmail.com

    #2
    Re: XML DTD analysis, diffing ...

    On Apr 3, 7:38 am, "olive" <ocolli...@gmai l.comwrote:
    Hi,
    >
    I have a bunch of similar DTDs written by different coders.
    >
    I would like to normalize, sort elements and attributes by name and
    compare those files.
    >
    Do you know any XML DTD parser/normalizer written in Python ?
    >
    If not, how would you perform that task in Python language ?
    >
    Please,
    >
    Olive.
    Olive,

    Beautiful Soup is usually recommended for parsing XML/HTML.


    You could also use pyXML. See the recipe below for one way to use it:


    xmlproc has a way of parsing DTDs, or so I hear. I think it's a part
    of pyXML.

    I hope this stuff gives you some ideas.

    Mike
    See also the SAX module: http://docs.python.org/lib/module-xml.sax.handler.html

    Comment

    • olive

      #3
      Re: XML DTD analysis, diffing ...

      Mike,

      I know all of these tools and I already suspected xmlproc as a good
      candidate.

      The problem is I can't download it for the moment since Lars website
      is blocked here at my work and PyXML is dead.

      Maybe there is an alternative download link ?

      Thank you for the Cookbook recipe anyway.

      Olivier.

      Comment

      • Paul Boddie

        #4
        Re: XML DTD analysis, diffing ...

        On 3 Apr, 15:52, "olive" <ocolli...@gmai l.comwrote:
        >
        I know all of these tools and I already suspected xmlproc as a good
        candidate.
        >
        The problem is I can't download it for the moment since Lars website
        is blocked here at my work and PyXML is dead.
        >
        Maybe there is an alternative download link ?
        Isn't xmlproc part of PyXML anyway? Detailed public information about
        various PyXML packages suggests that it is. For example:



        Paul

        Comment

        • kyosohma@gmail.com

          #5
          Re: XML DTD analysis, diffing ...

          On Apr 3, 8:52 am, "olive" <ocolli...@gmai l.comwrote:
          Mike,
          >
          I know all of these tools and I already suspected xmlproc as a good
          candidate.
          >
          The problem is I can't download it for the moment since Lars website
          is blocked here at my work and PyXML is dead.
          >
          Maybe there is an alternative download link ?
          >
          Thank you for the Cookbook recipe anyway.
          >
          Olivier.
          When I go to the xmlproc website, it states that it is now a part of
          the PyXML package, which can be found on Soureforge here:



          Mike

          Comment

          • olive

            #6
            Re: XML DTD analysis, diffing ...

            Thanks Paul and Mike,

            I've found the good link and just downloaded pyXML.

            Olive.

            Comment

            • =?ISO-8859-1?Q?St=E9phane_Muller?=

              #7
              Re: XML DTD analysis, diffing ...

              olive a écrit :
              Hi,
              >
              I have a bunch of similar DTDs written by different coders.
              >
              I would like to normalize, sort elements and attributes by name and
              compare those files.
              >
              Do you know any XML DTD parser/normalizer written in Python ?
              Yes, you can try http://c.python.free.fr/dtdnormalize.zip

              Parse a sample XML file with the document type declaration. There are
              XHTML, SVG and MML samples in the zip file.

              The DTDParser is based on the standard xml.parsers.exp at module.


              Stephane.

              Comment

              • olive

                #8
                Re: XML DTD analysis, diffing ...

                Thank you Stephane,

                it is almost what I want.

                I'm going to improve it a little and then provide the code back.
                Where is the best place ?

                Olive.


                Comment

                Working...