ReWrite XML after modifying content

Help
RV2931
2014-05-30
2014-05-30
  • RV2931

    RV2931 - 2014-05-30

    Hello,
    I get the content of my XML according to the XSD structure I've defined
    In my program, I add some elements to my list using the PyXB module generate
    After a test, it looks to add correctly new element to the sequences of my module instance
    Now I would to know if it is possible to write the content of this new structure/elements/sequence in a file ?
    So to sum up :
    I use CreateFromDocument() to fill the structure
    Then I add some elements in the structure
    Then I would to write this new content/structure in a file
    Is there a WriteToDocument() or toXml() function to write the xml result ?
    I didn't find equivalent in the documentation
    EDIT: in fact yes, a toXml() but I ve the error message "MyClass has no attribute toXml()"
    Thank you in advance

    EDIT2:
    MyCode
    import xml
    import exercise
    from exercise import Exercise, Flightplan, FlightplanAction
    f=open("./A1.xml").read()
    exo=exercise.CreateFromDocument(f)

    print "ADDING TEST FPL"
    fplac=FlightplanAction()
    fplac.type="PUSH"
    fplac.time="10:10:25"
    fpl=Flightplan()
    fpl.callsign = "TEST"
    fpl.action.append(fplac)
    exo.flightplan.append(fpl)

    print exo.toXml() # Get error "Exercise has no attribute toXml"

    RV

     
    Last edit: RV2931 2014-05-30
  • RV2931

    RV2931 - 2014-05-30

    Sorry,
    it was toxml and no toXml
    My mistake

     

Log in to post a comment.