plist XML parsing error

New Contributor III

Trying to add this to my and set as a config profile:

<key>RegisteredProtocolHandlers</key> <array> <dict> <key>default</key> <true/> <key>protocol</key> <string>mailto</string> <key>url</key> <string></string> </dict> </array>

The problem with the <string> line is that the & is not XML friendly from what I've read.

Running: /usr/bin/plutil -convert xml1 ~/Desktop/

Throws out the error: Property List error: Encountered unknown ampersand-escape sequence at line 27 / JSON error: JSON text did not start with array or object and option to allow fragments not set.

Googling, I came across a reddit post about a similar error. Someone pointed out that the only acceptable & in XML is &amp; &lt; &gt; &quot; &apos. My plist XML file has &url in it. This is the requirement for RegisteredProtocolHandlers ( which I'm trying to accomplish.

So I already have a work file in my JSS. I'm just looking to add the XML code in the start of this post and my JSS is complaining that it wants me to convert the file using plutil. Which I've tried and now I'm here looking for anyone with a workaround.

I think maybe deploying the actual plist file into a directory would work, but I wanted to make this plist a config profile and enforce at the computer level.


Contributor III

I believe wrapping the URL in a CDATA section will tell the parser to ignore it.


Haven't tested it but may work for you!

Contributor III

plist for to set the registered protocol handler.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "">
<plist version="1.0">