How do I produce XML with Perl's XML::Simple? -


I'm just trying to create an XML

  XML :: Simple; My% element = ("a" =>, "10", "b" =>, "20",); My $ xs = New XML :: Simple (); My $ ref = $ xs- & gt; XMLin (% element); My $ xml = $ xs- & gt; XMLout ($ ref); Print $ xml;  

What's wrong with this code? (It has been solved)

  XML :: Simple; My% element = ("a" =>, "10", "b" =>, "20",); My $ xs = New XML :: Simple (); My $ xml = $ xs- & gt; XMLout (\% element); Print $ xml;  

This generates the following output:

  & lt; Opt a = "10" b = "20" />  

But I really want to get it:

  & lt; A & gt; 10 & lt; / A & gt; & Lt; P & gt; 20 & lt; / B & gt;  

How can I get it?

XML XML and convert it into a Pearl data structure.

The XMLout takes a Perl data structure and it changes to XML.

You are trying to feed the XMLin to a Perl data structure and to feed the results XMLout.

Have you considered reading?


Update: Documentation (yes, we know that it is boring) offers a lot of options which you can get from XML :: Simple :: New () . One of them is NoAttr = & gt; 1 . You want but do not hurt to see others (some of which are marked "important").


Comments

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -