Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: Poor Man's XML?

by lestrrat (Deacon)
on Jun 26, 2002 at 05:16 UTC ( #177305=note: print w/ replies, xml ) Need Help??


in reply to Poor Man's XML?

I second graff's suggestion. Why not just use XML, if you're going to be marking it up anyways?

Once you put it in XML, you can do bunch of cool things, plus you get the bonus of not having to write yet another parser.

use XML::LibXML; my $parser = XML::LibXML->new(); my $xml = $parser->parse_file( '/path/to/file' ); ## find all <speech>.. foreach my $speech ( $xml->findnodes( '/script/speech' ) { .... } ## find all speech by Romeo (assuming: ## <speech><character>Romeo</character><text>....</text></speech> ## ) foreach my $romeo_speech ( $xml->findnodes( '/script/speech/[charact +er = "Romeo"]' ) ) { .... } ## etc...


Comment on Re: Poor Man's XML?
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (6)
As of 2014-09-16 03:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite cookbook is:










    Results (155 votes), past polls