Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re^2: Parse with XML::Simple: how to keep some tags "unparsed"?

by dda (Friar)
on Jul 01, 2004 at 10:34 UTC ( [id://371030]=note: print w/replies, xml ) Need Help??


in reply to Re: Parse with XML::Simple: how to keep some tags "unparsed"?
in thread Parse with XML::Simple: how to keep some tags "unparsed"?

No, it is not a matter of time. I need to keep all XHTML contents of <content> tags in a single place, and do not parse it into perl data structures.

--dda

  • Comment on Re^2: Parse with XML::Simple: how to keep some tags "unparsed"?

Replies are listed 'Best First'.
Re^3: Parse with XML::Simple: how to keep some tags "unparsed"?
by exussum0 (Vicar) on Jul 01, 2004 at 10:46 UTC
    If you are embedding data that has >'s and <'s, then you prolly wanna use the CDATA directive/option/thing within your xml to denote, "this is data of the XML document, not part of the XML structure".

    If that's beyond your control, you can always create a SAX parser that does just what you want.

    Or you can write some XSLT that transforms the content nested data into what I described above.

    Bart: God, Schmod. I want my monkey-man.

      Or you can write some XSLT that transforms the content nested data into what I described above.

      Show the XSLT - you know what happens if you don't ;-):

      <?xml version='1.0'?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version='1.0'> <xsl:output cdata-section-elements="content"/> <xsl:template match="/"> <page> <xsl:attribute name="id"><xsl:value-of select="page/@id" / +> </xsl:attribute> <content> <xsl:apply-templates /> </content> </page> </xsl:template> </xsl:stylesheet>

      /J\

        I'll retort with a joke.

        In three places across the country, there fires break out in three bedrooms. The fires aren't large yet, but the smoke wakes up the people inside those rooms. In them, slept a chemist, a physicist and a computer scientist (or mathematician, works both ways).

        The chemist wakes up, measures the fire's dimensions and heat, grabs a large container, measures the water exactly and puts out the fire with a fairly even distribution of water, not wasting a drop.

        The physicist wakes up, grabs a container, fills it as quickly as he can, douses the fire and it's out.

        The computer scientist wakes up, sees the fire, declares it an already solved problem and goes back to sleep.

        Lesson learned? I'm lazy :) (Or the other excuse is, I know it's possible, but there were too many hurdles to go through: finding my xslt book, getting an xslt parser installed etc.. ) Doesn't make it right. bad monk, i know.

        Bart: God, Schmod. I want my monkey-man.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://371030]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (3)
As of 2024-04-24 04:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found