New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

enhancedminidom

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

enhancedminidom

Enhance minidom in order to have ordered (instead of sorted) attributes, and a 'getElementsByAttributeName' method

  • 0.2
  • PyPI
  • Socket score

Maintainers
1

This module enhances minidom and will allow you to have ordered attributes instead of having them sorted automaticaly.

It is relevent in the fact that you may want to script the loading/modification/saving of xml files and then print out a diff. with the normal minidom since attributes are sorted automaticaly you can have an unwanted diff for each unchaged line just because the order of the attributes changed.

once you load this module, just use minidom normaly.

example::

>>> from xml.dom import minidom
>>> import enhancedminidom

then use minidom normaly except that:

  • Document and Element classes have a 'getElementsByAttributeName' method which can be verry handy.
  • 'toxml' and 'toprettyxml' will print attributes in the order they are created/loaded if 'minidom.SORTEDATTRIBUTES = False' (default)

example to get all nodes having a "foo" attribute::

>>> document = minidom.parse('yourfile.xml')
>>> nodes_with_foo = document.getElementsByAttributeName('foo')

example to get all nodes having a "foo" attribute if they are in a "fum" tag::

>>> document = minidom.parse('yourfile.xml')
>>> nodes_with_foo = document.getElementsByAttributeName('foo', 'fum')

=============== Release Notes :

Release 0.1:

First Version

Release 0.2:

Fixed a typo in this doc

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc