Python and XML?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Leonard J. Reder

    #1

    Python and XML?

    Hello,

    What is the best way to process a Relax NG Schema and auto generate XML
    Python parser/generator code?
    Any suggestions?

    Thanks for all replies,

    Len
    --
    =============== =============== =====
    Leonard J. Reder
    Home office email : reder@ieee.org
    Lab email : reder@jpl.nasa. gov
    Lab web page : http://reder.jpl.nasa.gov
    =============== =============== =====
  • Stefan Behnel

    #2
    Re: Python and XML?

    Leonard J. Reder wrote:
    What is the best way to process a Relax NG Schema and auto generate XML
    Python parser/generator code?
    Any suggestions?
    Not sure what you mean with "XML Python parser/generator code", but regarding
    RNG, you should definitely give lxml a try. It may already be what you were
    looking for anyway.



    Have fun,
    Stefan

    Comment

    • Leonard J. Reder

      #3
      Re: Python and XML?

      Thanks for the response. This package does look interesting.
      What I as really after though was other possible solutions
      like JAX in the Java world or Gnosis in the Python world.

      Something that can take a Relax NG Schema and compile
      it into a bunch of parser/generator objects for handling
      an XML format. Guess I am going to just have try out
      Gnosis since it seems like the only game in town.

      Len

      Stefan Behnel wrote:
      Leonard J. Reder wrote:
      >What is the best way to process a Relax NG Schema and auto generate XML
      >Python parser/generator code?
      >Any suggestions?
      >
      Not sure what you mean with "XML Python parser/generator code", but regarding
      RNG, you should definitely give lxml a try. It may already be what you were
      looking for anyway.
      >

      >
      Have fun,
      Stefan

      --
      =============== =============== =====
      Leonard J. Reder
      Home office email : reder@ieee.org
      Lab email : reder@jpl.nasa. gov
      Lab web page : http://reder.jpl.nasa.gov
      =============== =============== =====

      Comment

      • Stefan Behnel

        #4
        Re: Python and XML?

        Leonard J. Reder wrote:
        What I as really after though was other possible solutions
        like JAX in the Java world or Gnosis in the Python world.
        >
        Something that can take a Relax NG Schema and compile
        it into a bunch of parser/generator objects for handling
        an XML format.
        That's why I was asking why you need this. Validation is provided by RNG
        itself, so all you would need is some kind of mapping that outputs and parses
        it for you? What's your target format? Python objects?



        Stefan

        Comment

        • Leonard J. Reder

          #5
          Re: Python and XML?

          Stefan Behnel wrote:
          Leonard J. Reder wrote:
          >What I as really after though was other possible solutions
          >like JAX in the Java world or Gnosis in the Python world.
          >>
          >Something that can take a Relax NG Schema and compile
          >it into a bunch of parser/generator objects for handling
          >an XML format.
          >
          That's why I was asking why you need this. Validation is provided by RNG
          itself, so all you would need is some kind of mapping that outputs and parses
          it for you? What's your target format? Python objects?
          >

          >
          Stefan
          My target format are Python objects. What I want to do is
          auto-covert the Relax NG Schema into Python API objects
          that can be used to intelligently read in an XML file.

          Our XML files specify interfaces to flight software
          but in the future I have an interest in using XMI to do more
          complete modeling of software. Hopefully the OMG publishes
          a stand XMI schema.

          Looks like this stuff might do what I want. Need to work through the
          example.

          Are you the author? Why is this better then using gnossis?

          Thanks,

          Len

          --
          =============== =============== =====
          Leonard J. Reder
          Home office email : reder@ieee.org
          Lab email : reder@jpl.nasa. gov
          Lab web page : http://reder.jpl.nasa.gov
          =============== =============== =====

          Comment

          • Stefan Behnel

            #6
            Re: Python and XML?

            Hi,

            Leonard J. Reder wrote:
            Stefan Behnel wrote:>
            Looks like this stuff might do what I want. Need to work through the
            example.
            >
            Are you the author?
            Yup! :)

            Why is this better then using gnossis?
            lxml is faster and supports more XML standards. It's also more flexible in
            that it allows you to replace element classes at basically any granularity and
            thus add things to the Element API or even replace it as you see fit, without
            loosing the standard XML features. You can even do that at the C-level, in
            case you really need high-performance.

            See the "extending lxml" section in the side menu at

            especially:


            Stefan

            Comment

            • Leonard J. Reder

              #7
              Re: Python and XML?

              Stefan,

              This package is looking better I tried the validation example, but it
              did not work
              with 1.3beta so I grabbed 1.2. If objectify works well I think this is a
              great pick for anyone using xml. Please post to me and the python announce
              when 1.3 is released.

              thanks,
              Len
              Stefan Behnel wrote:
              Hi,
              >
              Leonard J. Reder wrote:
              >Stefan Behnel wrote:>Looks like this stuff might do what I want. Need to work through the
              >example.
              >>
              >Are you the author?
              >
              Yup! :)
              >
              >
              >Why is this better then using gnossis?
              >
              lxml is faster and supports more XML standards. It's also more flexible in
              that it allows you to replace element classes at basically any granularity and
              thus add things to the Element API or even replace it as you see fit, without
              loosing the standard XML features. You can even do that at the C-level, in
              case you really need high-performance.
              >
              See the "extending lxml" section in the side menu at

              especially:

              >
              Stefan

              --
              =============== =============== =====
              Leonard J. Reder
              Home office email : reder@ieee.org
              Lab email : reder@jpl.nasa. gov
              Lab web page : http://reder.jpl.nasa.gov
              =============== =============== =====

              Comment

              Working...