Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??


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

In reply to Re^5: XML::Simple XML / XMLin / XMLout? or something else? by McA
in thread XML::Simple XML / XMLin / XMLout? or something else? by Roboz

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

    What's my password?
    Create A New User
    and all is quiet...

    How do I use this? | Other CB clients
    Other Users?
    Others romping around the Monastery: (6)
    As of 2018-05-22 10:41 GMT
    Find Nodes?
      Voting Booth?