Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: XML:Simple read tag value with regex

by mirod (Canon)
on May 07, 2013 at 13:19 UTC ( #1032476=note: print w/ replies, xml ) Need Help??


in reply to XML:Simple read tag value with regex

As said before, you can escape the < by using &lt; or you can use CDATA sections:

<sourcetype> <name>G1</name> <desc>group 1 to decode</desc> <rules> <rule><![CDATA[['^\d(.)','14']]]></rule> <rule><![CDATA[['^(<xyz>)']]]></rule> <rule><![CDATA[['^(</xyz>)']]]></rule> </rules> </sourcetype>

That's still ugly, but a little easier to read than the version with &lt;, and at least you can cut and paste code in the rule elements.

The <![CDATA[...]]> construct prevents everything in the section from being parsed as XML. You still need it to be valid text (unicode by default) and not to include ]]>, but anything else is fine.


Comment on Re: XML:Simple read tag value with regex
Select or Download Code
Replies are listed 'Oldest First'.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (13)
As of 2015-07-07 16:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (91 votes), past polls