Summary
Compact XML is an alternative syntax for representing XML files. It uses indentation to indicate nesting to give a python like feel, XPath based prefixes to identify nodes, and has a macro system to shorten common XML constructs. It is intended for writing element based XML files, especially those where the XML elements share a common structure such as XSLT files.
This package includes a parser and bidirectional converter for converting from this compact XML syntax to XML, and from XML to this compact XML syntax.
Why Do I Want This?
Unlike most projects to create a shorter XML, compact XML is not designed for compressing XML on the wire. Instead, this syntax is designed to make editing XML easier with common editors, and to provide a convenient, configurable shorthand when authoring XML documents with a common syntax.
If you spend all day writing XSLT files or something similar, this will let you work with source files that look like this:
xsl:stylesheet
xsl:output xml no
xsl:template "@* | node( )"
xsl:copy
xsl:apply-templates "@* | node( )"
Instead of like this:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="no"/>
<xsl:template match="@* | node( )">
<xsl:copy>
<xsl:apply-templates select="@* | node( )"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
If you’re integrating with a python based program, the parser can be built in and parse compact XML files to XML directly. Otherwise a simple command line utility is included that can be used inside make or equivalent to convert to XML as part of your build process.
Install
compactxml is a pure python library, and should be platform independent. It has been developed and tested on python 2.6 on linux, however. As dependencies, it requires that lxml and pyparsing be installed to function.
A normal python setup.py install command should work to install the library.
Usage
There is a compactxml.expand function for converting from compact XML syntax to XML, and a compactxml.compact function for converting from XML to compact XML syntax, with variations on both depending on the output format desired. help( compactxml ) will give better usage instructions, and the included documentation in compactxml.rst provides a comprehensive overview of the compact xml syntax.
Any errors in expansion or compaction are raised as compactxml.ParsingError.
There is also a command line utility compactxml.py in the source distribution which can be used for converting from/to compact xml syntax. See compactxml.py --help for usage information after installation.
Documentation
Detailed documentation of the compact XML format is available through the python package index, including a tutorial for new users.
Metadata
Release files for compactxml 2.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distributions (sdists)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| compactxml-2.1.0.zip | 88.6 kB | Without provenance | Details | |
| compactxml-2.1.0.tar.gz | 73.0 kB | Without provenance | Details |
Built distributions (wheels)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| compactxml-2.1.0.win32.exe | Details | |||
| compactxml-2.1.0-py2.7.egg | Legacy Egg format | - | - | Details |
Total release size: 432.5 kB
Release files / compactxml-2.1.0.zip
| Download URL | compactxml-2.1.0.zip |
|---|---|
| Size | 88.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
cbca2c48fde0ce2fb2ceb4206ba4a08db45887b4c5ed98133b2e3c992032f695
|
|
BLAKE2b-256 checksum How to use checksums |
55afc4ca41c7d55bcd80ed6e89e9b8876f180c2a9c2aeaf3e5962c04823fcd5f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / compactxml-2.1.0.tar.gz
| Download URL | compactxml-2.1.0.tar.gz |
|---|---|
| Size | 73.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
75cf5eac875aa7618eead7365fb505470cb04bbb8d785b725b985f33caf41761
|
|
BLAKE2b-256 checksum How to use checksums |
beef39f4a0fced38afd005a4972c92f5bb97f7b434fe251752bc169033ad334d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / compactxml-2.1.0.win32.exe
| Download URL | compactxml-2.1.0.win32.exe |
|---|---|
| Size | 220.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
dbb54fea9ae3693505ce4876c32e0e7e25e60a5ab9f18ff05244749c446975e3
|
|
BLAKE2b-256 checksum How to use checksums |
8a448cd0559090bd3e1981da96266f591bc22e550bc212846b0118cbd0b5617b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / compactxml-2.1.0-py2.7.egg
| Download URL | compactxml-2.1.0-py2.7.egg |
|---|---|
| Size | 50.3 kB |
| Tags | Egg |
|
SHA-256 checksum How to use checksums |
3027c8afcee8e7c17fb365e402cd45cfeaf23e9a739d990d5ecbb96d6e30e6ec
|
|
BLAKE2b-256 checksum How to use checksums |
9b37e74b22da3a861214991fbe78bcf3713945f89ef776cefea1a8cee88595d5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for compactxml 2.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.