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

Re^2: XMLin question

by stryda42 (Novice)
on Feb 15, 2013 at 17:58 UTC ( #1018931=note: print w/ replies, xml ) Need Help??


in reply to Re: XMLin question
in thread XMLin question

Ok, thank you

I was curious if there was some way to auto-convert < to < as well as tags like this in general instead of manually doing this, from an end user perspective.


Comment on Re^2: XMLin question
Re^3: XMLin question
by Anonymous Monk on Feb 15, 2013 at 18:19 UTC

    I was curious if there was some way to auto-convert < to < as well as tags like this in general instead of manually doing this, from an end user perspective.

    :| You don't say :/

    perl -pe "%f = qw{ < &lt; > &gt; }; s{[^><]\K([><])([^\w])}{ $f{$1}$2} +g; " < in > out
      naturally, untested, doesn't work :/
        I'm not surprised. \K was added in perl 5.10 but with -e perl won't use any features that are so "recent". Try "-E" instead, at least, if you have perl 5.10 or later.

        But, I don't think it will work, anyway. /([><])([^\w])/ would fix every "</" in your XML, and that just isn't right.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (18)
As of 2015-07-02 13:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (40 votes), past polls