Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re^4: Why XML not well formed?

by graff (Chancellor)
on Jul 03, 2005 at 05:33 UTC ( #471990=note: print w/replies, xml ) Need Help??


in reply to Re^3: Why XML not well formed?
in thread Why XML not well formed?

I think the proper way to control this sort of operation -- and keep it from screwing up other entity references (like è and <, etc) is something like this:
s/&(?!\w+;)/&/;
This is just assuming that every valid entity reference that might exist in the original text is limited to alphanumerics and underscores between the initial ampersand and the final semi-colon, which is probably a safe-enough assumption.

But keep a backup of the original. If the data still causes parse errors after this simple edit, they might be different problems you haven't fixed yet, or they might be problems created by this simple edit. Careful diagnosis would be needed in that case.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (4)
As of 2023-02-08 07:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I prefer not to run the latest version of Perl because:







    Results (40 votes). Check out past polls.

    Notices?