Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

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

by choroba (Abbot)
on Jul 20, 2012 at 11:52 UTC ( #982799=note: print w/ replies, xml ) Need Help??


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

Please, be more specific. Does your XML contain unquoted characters < or &? If yes, it is not a valid XML. Maybe you can show a sample of the problematic data?


Comment on Re: How can I use XML::Simple parser to read and parse greater then (>), less then (<) and ampersand (&) symbol..
Select or Download Code
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
    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>

      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.

      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://982799]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (6)
As of 2014-08-21 11:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (134 votes), past polls