Beefy Boxes and Bandwidth Generously Provided by pair Networks vroom
Welcome to the Monastery
 
PerlMonks  

Re^5: XML::Simple XML / XMLin / XMLout? or something else?

by McA (Deacon)
on Oct 12, 2012 at 15:51 UTC ( #998730=note: print w/ replies, xml ) Need Help??


in reply to Re^4: XML::Simple XML / XMLin / XMLout? or something else?
in thread XML::Simple XML / XMLin / XMLout? or something else?

:-))

Yes, of course! That's why I wrote that I can't resist.

It was just how the initial question was formulated: I couldn't see if xml has to be parsed to work on the parsed data. Then his own approach would have been sufficient. The only problem I could see was the loss of element order. The other thing what I could see is a kind of extraction. But be aware: The resulting xml-snippets concatenated together don't form valid XML. XML mandates that you have to have one starting and ending tag containing all other tags. So the wished output is not valid XML. So, what is it good for? (He gave the answer meanwhile. This little add on let all others know the intention.)

So, if you don't need real XML parsing and you know the structure and layout of incoming XML you can do many things without parsing. To your example of having NO newlines:

xmllint --format data1.xml | perl -ne 'print unless /booklist|\?xml /'

Not perl related, but probably useful for Roboz while debugging his SOAP stuff: xmllint is an excellent command line tool (commonly in package libxml2). I hope that this last hint will be valueable at least :-))

Best regards
McA


Comment on Re^5: XML::Simple XML / XMLin / XMLout? or something else?
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (17)
As of 2014-04-16 15:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (432 votes), past polls