Skip to main content

validate_plist_xml

This python module will validate Apple XML Plist files.

This is pure python and runs on any operating system, tested on Windows, Mac, and Linux.

Currently targets Python 3 only but would like to add Python 2 support.

By default configured to check files with the following extensions: ('.recipe', '.plist', '.profile')

By default, runs in the current working directory against all files in that directory and all subdirectories.

This module depends upon the lxml module. (which is handled by pip automatically)

The code is found within src/validate_plist_xml/validate_plist_xml.py within the git repo.

This module checks that the plist is valid XML and meets the Apple Plist DTD here: https://www.apple.com/DTDs/PropertyList-1.0.dtd

Install with pip:

pip install validate-plist-xml

This will install lxml if not already installed.

Usage Examples:

Run as Python Script:

The python script can be called directly:

$ python3 src/validate_plist_xml/validate_plist_xml.py 
XML Syntax Error in: ./tests/bad/example-bad-xml-tags.recipe
Opening and ending tag mismatch: BAD_TAG line 4 and dict, line 15, column 8 (example-bad-xml-tags.recipe, line 15)
Failed DTD Validation: ./tests/bad/example-bad-dtd.recipe
Element dict content does not follow the DTD, expecting (key , (array | data | date | dict | real | integer | string | true | false))*, got (key astring key string key dict key string key array ), line 4
2 errors found in 3 plist xml files

Run as module:

If installed through pip as a module, then it can be run like this:

$ python3 -m validate_plist_xml
XML Syntax Error in: ./tests/bad/example-bad-xml-tags.recipe
Opening and ending tag mismatch: BAD_TAG line 4 and dict, line 15, column 8 (example-bad-xml-tags.recipe, line 15)
Failed DTD Validation: ./tests/bad/example-bad-dtd.recipe
Element dict content does not follow the DTD, expecting (key , (array | data | date | dict | real | integer | string | true | false))*, got (key astring key string key dict key string key array ), line 4
2 errors found in 3 plist xml files

Use as GitHub Action:

---
name: plistlint

on:
  push:
    paths:
      - "**.plist"
      - "**.recipe"
      - ".github/workflows/plistlint.yaml"
  pull_request:
    paths:
      - "**.plist"
      - "**.recipe"
      - ".github/workflows/plistlint.yaml"

jobs:
  plistlint:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2

      - name: Set up Python
        uses: actions/setup-python@v2
        with:
          python-version: 3.8

      - name: Install validate-plist-xml
        run: pip install validate-plist-xml

      - name: Lint Plist files
        run: python3 -m validate_plist_xml

Use in another Python script:

import validate_plist_xml

# The default folder is `.` but could be any folder
validate_plist_xml.validate_plist_xml.main('.')

Use as Python command:

python3 -c "import validate_plist_xml; validate_plist_xml.validate_plist_xml.main('.')"

Metadata

Release files for validate-plist-xml 1.0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for validate-plist-xml 1.0.4
File Size Uploaded
validate-plist-xml-1.0.4.tar.gz 4.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for validate-plist-xml 1.0.4
File Interpreter ABI Platform
validate_plist_xml-1.0.4-py3-none-any.whl Python 3 none any Details

Total release size: 10.5 kB

Release files / validate-plist-xml-1.0.4.tar.gz

Download URL validate-plist-xml-1.0.4.tar.gz
Size 4.9 kB
Tags Source
SHA-256 checksum
How to use checksums
49ae49b676d83280de48064fe8041bcbe621690bb4e2c0db584a7e321df189a4
BLAKE2b-256 checksum
How to use checksums
d3a1056cc0e4680d86cc6ff262a24fa738e75dbe2407e5ee39d87c2926fbbb52
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.6

Release files / validate_plist_xml-1.0.4-py3-none-any.whl

Download URL validate_plist_xml-1.0.4-py3-none-any.whl
Size 5.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a27e536823277c328953c5feebaa308c3aa25f14aa29f9918edc17eaf9b99e73
BLAKE2b-256 checksum
How to use checksums
4850be2abcc2b485c3556035e8e176cc3eae4dcab21ec0db417f1a084bf20893
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.6

Release history Release notifications | RSS feed

This release

1.0.4 This release

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page