Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re^2: How can I use XML::Simple parser to read and parse greater then (>), less then (<) and ampersand (&) symbol..

by sarf13 (Beadle)
on Jul 20, 2012 at 12:26 UTC ( #982806=note: print w/ replies, xml ) Need Help??


in reply to Re: How can I use XML::Simple parser to read and parse greater then (>), less then (<) and ampersand (&) symbol..
in thread How can I use XML::Simple parser to read and parse greater then (>), less then (<) and ampersand (&) symbol..

hi thank you for your quick reply. well there is no quote present over these symbel. since i have to put validation check for these symbol only. here i am giving sample for my input file.

<query> insert into name (name, age, address) (select from age_tab where age > + 19 ) </query>


Comment on Re^2: How can I use XML::Simple parser to read and parse greater then (>), less then (<) and ampersand (&) symbol..
Download Code
Re^3: How can I use XML::Simple parser to read and parse greater then (>), less then (<) and ampersand (&) symbol..
by Jenda (Abbot) on Jul 20, 2012 at 17:01 UTC

    You might be able to run the file through some filter that'll try to guess which <, > or & belongs to a tag/entity and which one does not, but there's no guarantee it'll guess correctly every time. Fix or get fixed whatever produces this invalid format.

    Jenda
    Enoch was right!
    Enjoy the last years of Rome.

Re^3: How can I use XML::Simple parser to read and parse greater then (>), less then (<) and ampersand (&) symbol..
by amias (Novice) on Dec 12, 2012 at 11:36 UTC

    You should enclose them in a CDATA block to keep them safe from the parser , all parsers should respect this.

     <tag><![CDATA <?>&;]!> ]]></tag>

    the only thing you cannot put in CDATA is ]]> as its the CDATA terminator , however if its essential then you could do something like

    <tag><![CDATA ]]]]><![CDATA >]]></tag>

    for the full info see http://www.w3schools.com/xml/xml_cdata.asp

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (6)
As of 2014-08-02 01:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Who would be the most fun to work for?















    Results (53 votes), past polls