Beefy Boxes and Bandwidth Generously Provided by pair Networks vroom
Perl Monk, Perl Meditation
 
PerlMonks  

Re^3: Parsing XML with XML::Simple

by ferreira (Chaplain)
on Dec 17, 2006 at 20:14 UTC ( [id://590371]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


in reply to Re^2: Parsing XML with XML::Simple
in thread Parsing XML with XML::Simple

The big issue is that if you have First Last <this@that.com> within your XML, you have bad XML. (It should be First Last &lt;this@that.com&gt;.) It is better to fix these files. I am not sure how you came into this, because XML::Simple usually escapes these things:
$ perl -MXML::Simple -e "print XMLout({ a => 'a <b>' })" <opt a="a &lt;b&gt;" />

It could be the version you're using. The example above used

$ which_pm XML::Simple XML::Simple 2.13 c:/tools/apache/Perl/site/lib/XML/Simple.pm

Replies are listed 'Best First'.
Re^4: Parsing XML with XML::Simple
by madbombX (Hermit) on Dec 17, 2006 at 20:22 UTC
    I am using XML::Simple version 2.14. I came into this because part of my company policy requires us, in our CVS headers to have that line as part of the template for documents/scripts/etc that go into CVS. Therefore, the XML files that are turned into articles all have those within the top 5 lines. Neither XML::Simple or XML::Twig handle this properly.

      So you are suggesting that the XML::Simple file is post-processed in some fashion to insert extra information? The fix in that case is to pre-process the file at the other end to remove said extra information. Alternatively the code using XML::Simple to generate the file might be modified to insert the extra information in a compliant fashion. At this point it depends rather on your data flow and processes.


      DWIM is Perl's answer to Gödel

      If you need the CSV info accessible to the programs you need to enclose the content in <[CDATA[...]]> to make sure the <, > and & characters do not break the XML, if you don't it would be best to use comments:

      <!-- CVS $Id: File_Find.pl,v 1.1 2006-12-17 19:25:03 eric Exp $ This That <this@that.com> Desc: Test file --> <root> ...

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://590371]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.