Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
It would be helpful to see the error message, then it would be easier to know what the parser is thinking and where/why it is failing.

Also I'm a little confused where you say " one element (called PACKAGE_QUANTITY) is split into two entities (PACK and AGE_QUANTITY) " Do you mean it is split in the hash key or in the printout? You may want to look at what is going on around the line if($data =~ m/age_quantity/i)Why are you matching on "age_quantity"? Is this a typo or some debugging device?

What you are calling an element, I think of as an element value. It might be useful to think about how you are structuring your xml. Right now you have tons of these sort of structures:

<spec> <name>PACKAGE_QUANTITY</name> <value>1</value> </spec> <spec> <name>PREORDER_DATE</name> <value>970415</value> </spec>
It might be useful to try sturcturing the data like this:
<spec> <preorder_date>970415</preorder_date> <package_quantity>1</package_quantity> </spec>
Then you can really use the power of a parser to find certain elements or element values, instead of using regexs. I suspect your problem has more to do with regexs, your counter variables or your control structures than a parser bug.

Get Strong Together!!


In reply to Re: XML::Parser, hashes and lists problem by aardvark
in thread XML::Parser, hashes and lists problem by tinman

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (4)
As of 2024-04-26 01:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found