Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation

Re^7: XML Parsing

by tmharish (Friar)
on Feb 12, 2013 at 14:03 UTC ( #1018369=note: print w/replies, xml ) Need Help??

in reply to Re^6: XML Parsing
in thread XML Parsing


I might be able to clear up things if you can list out all the things you want to extract from the xml that you have provided - or you might even want to provide a more extensive xml.

So something like:

I want to access the "value" based on the attribute "category" and also in case I have multiple parameters with different "instances".

Replies are listed 'Best First'.
Re^8: XML Parsing
by vmallya (Initiate) on Feb 13, 2013 at 07:10 UTC
    Okay. Let me list what exactly I need:

    1. I have to define a config xml file 2. XML file should contain two different types of Parameters a. Special type b. Default type And each parameter under these types can have more than one instances which needs be differentiated by adding an attribute called "instance" in the node "parameter". 3. Later I need to read this config xml, and should extract first parameters under default type, instance wise and get the value for each parameter via a hash or array. 4. Same as above for special type of parameters as well.

    <?xml version="1.0" encoding="UTF-8"?> <list> <feature category="defaultlist"> <parameter instance="0">sampleparameter</parameter> <value>1</value> <parameter instance="0">firstparameter</parameter> <value>1</value> <parameter instance="1">firstparameter</parameter> <value>1</value> </feature> <feature category="speciallist"> <parameter instance="0">splparameter</parameter> <value>1</value> </feature> </list>

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1018369]
Discipulus what? Can I approve one of post on my own? weird..
Discipulus my posts..
[choroba]: It's been reported before
[Discipulus]: ok no big deal anyway..
[Discipulus]: mmh choroba.. my post is not for you, if you do not want your golfing game somehow spoilered for one of the problems. Adviced! ;=)

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (5)
As of 2017-10-22 19:40 GMT
Find Nodes?
    Voting Booth?
    My fridge is mostly full of:

    Results (275 votes). Check out past polls.