in reply to XML::Simple and xmlns attributes

If you are building the document from scratch (ie not from a data structure but as a process output) I strongly suggest XML::Writer.

If you really want to use XML::Simple, read the POD's part relative to options, and specifically KeyAttr and ForceArray options. To obtain your document you should force array folding and generate your data structure so that any node not containing other nodes is an array

Careful with that hash Eugene.

Replies are listed 'Best First'.
Re^2: XML::Simple and xmlns attributes
by Ozeroc (Novice) on Jun 10, 2008 at 11:13 UTC
    Thank you for the reply...
    In this case I'm generating XML that will be sent to a web service using SOAP::Lite versus outputting a file to disk. The XML is generated from data read in from a delimited text file (not columnar csv though).
    ForceArray=1 or 0 has no effect on the output when I toggle it. I'll keep it on and try modifying KeyAttr once again. I assume that every nested element key that gets output as an attribute should be listed as a KeyAttr so that it will be output as an element?

      I think that, to do that with XML::Simple, you should rethink the data structure that you pass to XMLout.

      Try and read XML::Writer POD and you'll see that it is so much easier for your needs...

      Careful with that hash Eugene.