Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
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 musing on the Monastery: (4)
As of 2015-08-05 02:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The oldest computer book still on my shelves (or on my digital media) is ...













    Results (76 votes), past polls