Skip to main content
Question

plist XML parsing error


Forum|alt.badge.img+6

Trying to add this to my com.google.Chrome.plist 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>https://mail.google.com/mail/?extsrc=mailto&url=%s</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/com.google.Chrome.plist

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 (https://www.chromium.org/administrators/policy-list-3#RegisteredProtocolHandlers) which I'm trying to accomplish.

So I already have a work com.google.Chrome.plist 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.

2 replies

Forum|alt.badge.img+10
  • Contributor
  • 207 replies
  • June 3, 2016

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

<![CDATA[https://mail.google.com/mail/?extsrc=mailto&url=%s]]>

Haven't tested it but may work for you!


Forum|alt.badge.img+14
  • Valued Contributor
  • 131 replies
  • September 19, 2017

plist for com.google.Chrome to set the registered protocol handler.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>RegisteredProtocolHandlers</key>
<array>
  <dict>
    <key>default</key>
    <true/>
    <key>protocol</key>
    <string>mailto</string>
    <key>url</key>
    <string><![CDATA[https://mail.google.com/mail/?extsrc=mailto&amp&url=%s]]></string>
  </dict>
</array>
</dict>
</plist>

Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings