Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: LibXML doesn't encode single or double quotes

by grantm (Parson)
on Nov 28, 2011 at 21:53 UTC ( [id://940479]=note: print w/replies, xml ) Need Help??


in reply to LibXML doesn't encode single or double quotes

Why do you think single and double quotes need to be escaped?

It is necessary to escape a quote character when it is included in an attribute value delimited by the same type of quote. e.g.:

<person name="Michael &quot;Mickey&quot; Mouse"></person>

XML::LibXML will escape the quotes in this case.

But apart from that case, it's perfectly safe to use unescaped quotes in the text body of XML/HTML elements.

Replies are listed 'Best First'.
Re^2: LibXML doesn't encode single or double quotes
by randonpurcell (Initiate) on Nov 28, 2011 at 22:00 UTC
    Oh, sorry. I left out a small, crucial detail. The clients that will be parsing this XML expect quotes and single quotes to be in entity form. In fact, it is a requirement, and I have no say in that.
      The clients that will be parsing this XML expect quotes and single quotes to be in entity form.

      How would they even know? Any compliant XML parsing library will decode the entities and pass the actual character up to the application layer. Getting the XML content with entities in their raw form would be a bug that could only cause downstream pain. If that really is a requirement then I feel your pain.

        OK, I'm glad you said that. I thought I must just be completely daft and missing something simple. I'm going to throw this back over the fence and see if I can get them to fix things on their side. I've wasted enough time and I don't feel like regex'ing a big mess to try to do this :) Thanks!

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (4)
As of 2024-03-29 01:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found