http://www.perlmonks.org?node_id=182634


in reply to Re: •Re: XML::Parser and Invalid XML
in thread XML::Parser and Invalid XML

I think I see part of the problem... the thing is, both the key and the value has meaning. In this case, I have a list of DID (Division ID) =< Division Name and in this file, DID => UID (Unique Member ID) and the reverse UID => DID to show what divisions a specific member is in. I'm just trying to store it. I've been using XML::Simple for a while now on other types of data, but it falls apart when the key is a number... :(



"Weird things happen, get used to it."

Flame ~ Lead Programmer: GMS

  • Comment on Re: Re: &bull;Re: XML::Parser and Invalid XML

Replies are listed 'Best First'.
•Re: Re: Re: •Re: XML::Parser and Invalid XML
by merlyn (Sage) on Jul 18, 2002 at 00:08 UTC
    As it says in the fine manual:
    Caveats Some care is required in creating data structures which will be passed to "XMLout()". Hash keys from the data structure will be encoded as either XML element names or attribute names. Therefore, you should use hash key names which conform to the relatively strict XML naming rules: Names in XML must begin with a letter. The remaining characters may be letters, digits, hyphens (-), under- scores (_) or full stops (.). It is also allowable to include one colon (:) in an element name but this should only be used when working with namespaces - a facility well beyond the scope of XML::Simple. You can use other punctuation characters in hash values (just not in hash keys) however XML::Simple does not sup- port dumping binary data. If you break these rules, the current implementation of "XMLout()" will simply emit non-compliant XML which will be rejected if you try to read it back in. (A later ver- sion of XML::Simple might take a more proactive approach).

    -- Randal L. Schwartz, Perl hacker