Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

RE: RE: RE: XML::Parser

by btrott (Parson)
on Jun 20, 2000 at 23:57 UTC ( [id://19090]=note: print w/replies, xml ) Need Help??


in reply to RE: RE: XML::Parser
in thread XML::Parser

You can keep a stack of the current level where you are in the XML file. When you get a start tag, push the tag onto the stack; when you get to the end of that tag, pop the tag off the stack. You can use this to define a tree structure of sorts.

Another option would be to use the "Tree" Style of XML::Parser. Read the docs for that.

A final option, and a good one, is to use XML::Simple, which may work for you:

use XML::Simple; XMLin("foo.xml");
It loads the data into a tree structure, which may or may not work exactly how you want it.

Or (finally again) you could look into some of the other tree-processing XML modules, like XML::DOM and XML::Twig. They may be overkill for your purposes, though.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (3)
As of 2025-06-22 00:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.