Problems with ElementTree and ProcessingInstruction

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

    #1

    Problems with ElementTree and ProcessingInstruction

    Howdy,

    I want to generate the following file;

    <?xml version="1.0" encoding="utf-8"?>
    <?xml-stylesheet mystyle?>
    <leo_file>stuff </leo_file>

    How should I be doing this?

    As far as I can tell, ElementTree() requires everything
    to be inside the root element (leo_file)

    Thanks,
    Kent

  • Gabriel Genellina

    #2
    Re: Problems with ElementTree and ProcessingInstr uction

    At Sunday 28/1/2007 11:28, Kent Tenney wrote:
    >I want to generate the following file;
    >
    ><?xml version="1.0" encoding="utf-8"?>
    ><?xml-stylesheet mystyle?>
    ><leo_file>stuf f</leo_file>
    >
    >How should I be doing this?
    open("filename" ,"w").write('<? xml version="1.0" encoding="utf-8"?>\n'
    '<?xml-stylesheet mystyle?>\n'
    '<leo_file>stuf f</leo_file>\n')

    :)
    >As far as I can tell, ElementTree() requires everything
    >to be inside the root element (leo_file)
    Just keep the first two lines on my example...


    --
    Gabriel Genellina
    Softlab SRL






    _______________ _______________ _______________ _____
    Preguntá. Respondé. Descubrí.
    Todo lo que querías saber, y lo que ni imaginabas,
    está en Yahoo! Respuestas (Beta).
    ¡Probalo ya!


    Comment

    • Kent  Tenney

      #3
      Re: Problems with ElementTree and ProcessingInstr uction



      On Jan 28, 7:46 pm, Gabriel Genellina <gagsl...@yahoo .com.arwrote:
      At Sunday 28/1/2007 11:28, Kent Tenney wrote:
      >
      I want to generate the following file;
      >
      <?xml version="1.0" encoding="utf-8"?>
      <?xml-stylesheet mystyle?>
      <leo_file>stuff </leo_file>
      >
      How should I be doing this?open("file name","w").writ e('<?xml version="1.0" encoding="utf-8"?>\n'
      '<?xml-stylesheet mystyle?>\n'
      '<leo_file>stuf f</leo_file>\n')
      Right.

      I can use ElementTree.wri te('filename') and
      prepend the instructions to the resulting file.

      It leaves me curious as to the purpose/usage of
      ProcessingInstr uction()

      Thanks,
      Kent

      >
      :)
      >
      As far as I can tell, ElementTree() requires everything
      to be inside the root element (leo_file)Just keep the first two lines onmy example...
      >
      --
      Gabriel Genellina
      Softlab SRL
      >
      _______________ _______________ _______________ _____
      Preguntá. Respondé. Descubrí.
      Todo lo que querías saber, y lo que ni imaginabas,
      está en Yahoo! Respuestas (Beta).
      ¡Probalo ya!http://www.yahoo.com.ar/respuestas

      Comment

      Working...