Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

Re: •Re: XML::Parser and Invalid XML

by mirod (Canon)
on Jul 17, 2002 at 22:59 UTC ( #182631=note: print w/replies, xml ) Need Help??

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

The proper format might even be closer to:

<settings> <your_name>Your Name</your_name> <his_name>His Name</his_name> <number>324324324</number> </settings>

XML markup should be descriptive. 1, 2 and 3, whether in tag names or as the only piece of information in the node tags are quite useless. And Perl will be just as happy to go through the keys of a hash than to the indexes in an array (BTW this comment is not directed to you merlyn ;--)

The Error Message is GOD - MJD

Replies are listed 'Best First'.
Re: Re: &bull;Re: XML::Parser and Invalid XML
by Flame (Deacon) on Jul 17, 2002 at 23:08 UTC
    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

      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

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://182631]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (2)
As of 2021-09-20 06:16 GMT
Find Nodes?
    Voting Booth?

    No recent polls found