in reply to Request for advice. Presenting XML.

You could also use a 2-step process: use a Perl/XML module, probably SAX based, to turn the initial XML into something that can be dislayed properly using CSS1. The initial step could be quite simple, you just have to convert you "arbitrary tags" to a, and maybe a couple more, if you pass the name of the tags as parameters to the transformation process you could even write something generic. Depending on how close the output of the transformation is to the structure of XHTML the CSS could turn out to be pretty simple too.

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

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

Replies are listed 'Best First'.
Re: Re: Request for advice. Presenting XML.
by BrowserUk (Patriarch) on Jul 06, 2002 at 16:12 UTC

    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.

      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.:(