|We don't bite newbies here... much|
XML::Rules Parsing Orderby feiiiiiiiiiii (Acolyte)
|on Feb 09, 2015 at 19:30 UTC||Need Help??|
feiiiiiiiiiii has asked for the wisdom of the Perl Monks concerning the following question:
Hi! I recently came across a problem about XML::Rules parsing order.
Say I have some code like this
the structure of the xml file is like
Will parent_tag or child_tag be parsed first? i.e. Does the parsing happen when a start tag is met, or when an end tag is met? I don't know why the order seemed to be quite random
Is there a way to always have parent_tag to be parsed first? Thanks!
Thanks for all the replies. You are amazing~~~
The reason why I want to parse the parent tag first is that I need to use the content (attributes) in the parent tag to decide if the content in the child tag should be store into the database. So if I prepend "^" to parent_tag, I can parse the parent tag first, but I cant get the content of the parent_tag but only its attributes, right?
So the only solution is to store in content of the child tag is some buffer, and then analyze it when the ending parent_tag is met and parsed?