Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
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 chanting in the Monastery: (6)
As of 2014-07-24 21:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (167 votes), past polls