Skip to content

Instantly share code, notes, and snippets.

@sshaw
Created June 15, 2018 23:07
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sshaw/621ea4513a28f2271ee3741415a56d00 to your computer and use it in GitHub Desktop.
Save sshaw/621ea4513a28f2271ee3741415a56d00 to your computer and use it in GitHub Desktop.
Example of Apple Property List (Plist) DTD Validation With xmllint
<?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>A</key>
<key>B</key>
<string>sshaw</string>
<string>DDEX</string>
</dict>
</plist>
<?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>A</key>
<string>sshaw</string>
</dict>
</plist>
~/code/ruby/class2 >xmllint --noout --valid ~/Desktop/good.plist
~/code/ruby/class2 >xmllint --noout --valid ~/Desktop/bad.plist
/Users/sshaw/Desktop/bad.plist:9: element dict: validity error : Element dict content does not follow the DTD, expecting (key , (array | data | date | dict | real | integer | string | true | false))*, got (key key string string )
</dict>
^
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment