in reply to Re: Request for advice. Presenting XML.
in thread Request for advice. Presenting XML.

Note that if your XML includes mixed content you cannot use XML::Simple to process it.

What do you mean by "mixed content"?

So far, all my files work fine with XML::Simple, but I'd like to know what to be looking out for.

  • Comment on Re: Re: Request for advice. Presenting XML.

Replies are listed 'Best First'.
Re: Re: Re: Request for advice. Presenting XML.
by mirod (Canon) on Jul 06, 2002 at 17:11 UTC

    Mixed content is elements with both text and markup children:

    <p>This is <b>mixed</b> content/<p>

    XML::Simple does not keep the order of the children, in this case the 2 contents ('This is ' and ' content') and the b.

    You can try with this:

    perl -MXML::Simple -e'$xml=XMLin( "<p>This is <b>mixed</b> content</p>"); print XMLout( $xml);'

    The output is:

    <opt b="mixed"> <content>This is </content> <content> content</content> </opt>

    Even if you use the noattr option you will still get the 2 contents and the b element in the wrong order.

      Thanks for the explanation Mirod. So far, so good - but I am bound to encounter that before too long.:(