Saravanan666/pypi-org huggingface dataset:
Package: xmlsq
The utilityxmlsqperforms simple and full XPath 1.0 queries on an XML document.>>> import xmlsq
>>> xml = r"<a><b foo='baz'>hello</b><b>world</b><e /></a>"
>>> xmlsq.get_text(xml, "//b")
'hello'
>>> xmlsq.get_text(xml, "//b[2]")
'world'
>>> xmlsq.full_query(xml, "//b")
'<b foo="baz">hello</b>\n<b>world</b>\n'
>>> xmlsq.get_text(xml, "//b/@foo")
'baz'
>>> xmlsq.full_query(xml, "//b/@foo")
'foo="baz"\n'
>>> xmlsq.full_query(xml, "/a", xmlsq.Opts.RAW)
'<a><b foo="baz">hello</b><b>world</b><e/></a>'
>>> xmlsq.count(xml, "//b")
2
>>> xmlsq.count(xml, "//notthere")
0
>>> xmlsq.count(xml, "//e")
1
>>> xmlsq.full_query(xml, "2+3.5")
'5.500000'xmlsq.get_text()extracts the text value of thefirstnode found selected by the query.xmlsq.full_query()outputs the result of the full XPath 1.0 query as a string.xmlsq.count()computes the integer value ofcount(query).Forxmlsq.get_text()andxmlsq.count()the querymustevaluate to a node.xmlsq.full_query()accepts any valid XPath 1.0 expression and returns the result as a string.For full details of all available methods and options, please see thedocumentation.System requirementsWindows platform with Python 3.
Requires the Windows native librarydiXmlsq.dllto be installed on your system, available fromhttps://www.cryptosys.net/xmlsq/.AcknowledgmentThis software is based on the pugixml library (https://pugixml.org). Pugixml is Copyright (C) 2006-2019 Arseny Kapoulkine.ContactFor more information or to make suggestions, please contact us athttps://cryptosys.net/contact/David IrelandDI Management Services Pty LtdAustralia5 June 2020
Package: xmlstarlet
XMLStarlet CFFIXMLStarlet Toolkit: Python CFFI bindingsFree software: MIT licenseDocumentation (this package):https://xmlstarlet.readthedocs.io.Original XMLStarlet Documentation:http://xmlstar.sourceforge.net/doc/UG/FeaturesSupports all XMLStarlet commands from Python, justimport xmlstarlet:edit(*args): Edit/Update XML document(s)select(*args): Select data or query XML document(s) (XPATH, etc)transform(*args): Transform XML document(s) using XSLTvalidate(*args): Validate XML document(s) (well-formed/DTD/XSD/RelaxNG)format(*args): Format XML document(s)elements(*args): Display element structure of XML documentcanonicalize(*args): XML canonicalizationlistdir(*args): List directory as XML (NOTsupported on Windows)escape(*args): Escape special XML charactersunescape(*args): Unescape special XML characterspyx(*args): Convert XML into PYX format (based on ESIS - ISO 8879)depyx(*args): Convert PYX into XMLFor some examples, have a look attests/test_xmlstarlet.py.CreditsKudos to XMLStarlet and its maintainers and users (original sources onSourceForge)!This package was created withCookiecutterand theaudreyr/cookiecutter-pypackageproject template.Binary wheels built via GitHub Actions bycibuildwheelHistory1.6.8 (2022-04-30)Added Python 3.10 support.Fixed issue #199 (pending confirmation) - upgraded libxml2 and libxslt versions to fix CVEsUpgraded development and build-time dependencies.Now using latestcibuildwheel2.5.0, which supports more architectures and builds.Started to improve the documentation - added better usage examples.Formatting and linting fixes1.6.7 (2020-12-24)Fixed MacOS binary wheel builds1.6.6 (2020-10-04)Simplified and automated building source and binary wheels for Linux, MacOS, and Windows via GitHub actions +cibuildwheel.Improved documentation and local development workflow.Fixes issue #51 (previously closed as “hard to fix”, but now reopened).Completely rewritten native Windows build process, based on libxslt.Windows port does not supportls(and converselylistdir()).1.6.5 (2020-09-29)No changes from previous release except up-to-date dependencies and some build fixes.Fixes issue #118 (awaiting confirmation).1.6.3 (2019-10-29)First working release on PyPI, based on xmlstarlet-1.6.1 source tarball.1.6.2 (2019-10-28)Second (failed) release on PyPI, based on XMLStarlet master branch.1.6.1 (2019-10-23)First (incomplete) release on PyPI, based on XMLStarlet master branch.
Package: xml-subsetter
Xml Subsetterdecimate data while keeping others intactbefore#bulk.xml<r><meta>somemetadata</meta><something>thingthingthingthing</something><e>e0</e><e>e1</e><e>e2</e><e>e3</e><some-annoying-non-data-you-have-to-keep-1>ahyahyah</some-annoying-non-data-you-have-to-keep-1><some-annoying-non-data-you-have-to-keep-2>ahyahyah</some-annoying-non-data-you-have-to-keep-2><some-annoying-non-data-you-have-to-keep-3>ahyahyah</some-annoying-non-data-you-have-to-keep-3><e>e4</e><e>e5</e><e>e6</e><e>e7</e><e>e8</e><e>e9</e><e>e10</e>...<e>e99</e></r>subset_head("bulk.xml", target_file='/tmp/small.xml', data_tag='e',ratio=0.05)after#small.xml<r><meta>somemetadata</meta><something>thingthingthingthing</something><e>e0</e><e>e1</e><e>e2</e><e>e3</e><some-annoying-non-data-you-have-to-keep-1>ahyahyah</some-annoying-non-data-you-have-to-keep-1><some-annoying-non-data-you-have-to-keep-2>ahyahyah</some-annoying-non-data-you-have-to-keep-2><some-annoying-non-data-you-have-to-keep-3>ahyahyah</some-annoying-non-data-you-have-to-keep-3><e>e4</e></r>
Package: xml-template
Introduction to XML::Template (name suggestions welcome)XML::Template is a templating system; there are already many others, so if
you do not like it, look into a different one (its design is inspired by
at least Template Toolkit and Kid, probably also including elements from
others). XML::Template is (like Kid or TAL) designed to guarantee that your
output is well-formed XML, which is a good step on the road to give you
valid XHTML.You can get the latest version of XML::Template with bzr; get bzr from your
favourite distribution and do “bzr get http://bzr.sesse.net/xml-template/”
to check out the code and this documentation.
Package: xml-thunder
XML ThunderInstallationpip install xml_thunderUsageXML Thunder provides a class called 'Lightning'.
The Lightning class's primary purpose is used for creating an XML parser.
The Lightning class provides the following methods:__init__(self)Initializes an empty private dictionary__repr__(self)Returns the string of the private dictionary__str__(self)Returns the string of the private dictionary__contains__(self, route: String)Returns a bool if the route is in the keys of the private dictionary__getitem__(self, route: String)Returns None or a Callable from the private dictionary__setitem__(self, route: String, function: Callable)Maps a route to the functionReturns None__delitem__(self, route: String)Deletes the specified routeReturns None__len__(self)Returns the length of a private dictionary__bool__(self)Returns True if the private dictionary is emptyget_all_routes(self)Returns all registered routes in the private dictionaryroute(self, path: String)Creates a route for the provided 'path''path' is any valid xPathNote that this method is a decorator and should be used as suchparse(self, xml_like_document: String | FileObject)The entrypoint for parsing xml strings/filesReturns None
Package: xmltocd
xml-to-chain-dictAn effective, powerful, fast and simple XML Python parsing tool.online tutorial：http://101.34.219.31:8001/注：0.2.2.2 版本（包含）之前的代码为测试版，不稳定；
0.2.3.1 版本（包含）往后的代码为正式版，提供稳定的解析引擎。
0.2.3.2：修复使用 tag 搜索时双倍结果的 BUG；修复新增属性时整型赋值问题。若您有意参与本工具的开发，请直接联系：jiyangj@foxmail.com，期待您的意见。
Package: xml-to-df
XML to Pandas DataframeFlattens out nested xml to individual columns in dataframeSample input.xml<bookstore>
<book category="COOKING">
    <title lang="en">Everyday Italian</title>
    <author>Giada De Laurentiis</author>
    <year>2005</year>
    <price>30.00</price>
    <values>
      <value id="300">1</value>
      <value id="100">5</value>
      <value id="200">2</value>
    </values>
  </book>
  <book category="CHILDREN">
    <title lang="en" language="hello">Harry Potter</title>
    <author>J K. Rowling</author>
    <cricketers>
        <cricketer1>Praveen</cricketer1>
        <cricketer2>Pathan</cricketer2>
        <country>india</country>
        <country>india1</country>
      </cricketers>
    <year>2005</year>
    <price>29.99</price>
    <values>
      <value></value>
      <value></value>
    </values>
  </book>
  <book category="WEB">
    <title lang="en">Learning XML</title>
    <author>Erik T. Ray</author>
    <year>2003</year>
    <price>39.95</price>
  </book>
</bookstore>df = xml_to_df.convert_xml_to_df("input.xml")df.head()Output dataframebook_categorybook_title_langbook_titlebook_authorbook_yearbook_pricebook_values_value_idbook_values_valuebook_title_languagebook_cricketers_cricketer1book_cricketers_cricketer2book_cricketers_countryCOOKINGenEveryday ItalianGiada De Laurentiis200530.00[300, 100, 200][1, 5, 2]NaNNaNNaNNaNCHILDRENenHarry PotterJ K. Rowling200529.99NaNNaNhelloPraveenPathan[india, india1]WEBenLearning XMLErik T. Ray200339.95NaNNaNNaNNaNNaNNaN
Package: xml-to-dict
xml_to_dictA simple Python XML to Dictionary parser.The package is based onthis answerfrom Stack Overflow. It parses entities as well as attributes followingthis XML-to-JSON "specification".I just added thefrom_nestfunction, which lets you retrieve a value from the nested dictionaries.Installpip3installxml_to_dict--userUsagefromxml_to_dictimportXMLtoDictsample_xml=('<response>''<results>''<user>''<name>Ezequiel</name>''<age>33</age>''<city>San Isidro</city>''</user>''<user>''<name>Belén</name>''<age>30</age>''<city>San Isidro</city>''</user>''</results>''</response>')parser=XMLtoDict()print(parser.parse(sample_xml))# {'response': {'results': {'user': [{'name': 'Ezequiel', 'age': '33', 'city': 'San Isidro'}, {'name': 'Belén', 'age': '30', 'city': 'San Isidro'}]}}}print(parser.value_from_nest('.*ser',sample_xml))# [{'name': 'Ezequiel', 'age': '33', 'city': 'San Isidro'}, {'name': 'Belén', 'age': '30', 'city': 'San Isidro'}]ContributingContributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make aregreatly appreciated.Fork the ProjectCreate your Feature BranchCommit your ChangesPush to the BranchOpen a Pull RequestLicenseDistributed under the MIT License. SeeLICENSEfor more information.
Package: xmltodict3
An open-source library that is used for converting XML to a python dictionary.This library:can work with namespacecan transform XML value into python object (integer, boolean, datetime & custom transformers) using the "type" attributeInstallation:pip install xmltodict3orpip install git+https://github.com/dart-neitro/xmltodict3Example 1 (Simple case):>>> from xmltodict3 import XmlTextToDict
>>> text = """
...     <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
...         <xs:root attr="attr_value">
...             data
...         </xs:root>
...     </xs:schema>
... """
>>> result = XmlTextToDict(text, ignore_namespace=True).get_dict()
>>> print(result)
{'schema': {'root': {'@attr': 'attr_value', '#text': 'data'}}}Example 2 (with transformers):>>> from xmltodict3 import XmlTextToDict
>>> import xmltodict3.transformers as transformers
>>> text = """
... <root>
...     <values>
...         <int_value type="integer">
...             123
...         </int_value>
...     </values>
... </root>
... """
>>> transformer_list = transformers.DefaultTransformerList
>>> pull_transformers = transformers.PullTransformers(*transformer_list)
>>> pull_transformers.set_removing_types(True)
>>> xml_to_dict = XmlTextToDict(text)
>>> xml_to_dict.use_pull_transformers(pull_transformers)
>>> result = xml_to_dict.get_dict()
>>> print(result)
{'root': {'values': {'int_value': 123}}}More examples
Package: xmltojson
xmltojsonPython library and cli tool for converting XML to JSONInstall$ poetry add xmltojson$ pip install xmltojsonUsageCommand line:Converting an XML file and sending the output to STDOUT$ xmltojson <filename.xml>Send output to a file$ xmltojson <filename.xml> -o <new_filename.json>xmltojson can also read from STDIN$ echo '<name>John</name>' | xmltojson --stdinLibrary:[1]: import xmltojson
[2]: with open('/path/to/file', 'r') as f:
...:     my_xml = f.read()
[3]: xmltojson.parse(my_xml)
'{"name": "John"}'
Package: xmltotabular
xmltotabularPython library for converting XML to tabular data.Current StatusThis library is under periodic development. It is useful as it stands (seesul-cidr/patent_data_extractorfor thede factoreference implementation), but there is still much to be done before a1.0release. Please get in touch if this project could be useful to you, and especially if you'd be interesting in contributing (I would welcome help with documentation and examples for a robust test suite, for example).DevelopmentWith a working version of Python >= 3.6 and Pipenv:Install dependencies.(note that aPipfile.lockis not included in this repository -- this library should work with any dependency versions which satisfy what is listed in thePipfileandsetup.py, and any necessary pinning should be specified in both)$pipenvinstall--devInstall pre-commit hooks.$pipenvrunpre-commitinstallTestingLinting and formatting.$pipenvrunpre-commitrun--all-filesTests$pipenvrunpytestCoverageTo collect coverage execution data, use:$pipenvruncoveragerun-mpytestand to get a report on the data, use:$pipenvruncoveragereport-mor$pipenvruncoveragehtmlto create an HTML report inhtmlcov/.
Package: xmltoxsd
XMLtoXSD LibraryThexmltoxsdlibrary is a Python tool designed to convert XML documents into XSD (XML Schema Definition) schemas automatically. It simplifies the process of generating XSD schemas from XML files, making it easier for developers to validate their XML data.FeaturesAutomatic Type Inference: Automatically determines the data types for XML elements and attributes.Support for Complex XML Structures: Handles nested elements and attributes with ease.CustomizableminOccursAttribute: Allows users to specify default values forminOccursattribute in the generated XSD.InstallationInstallxmltoxsdusing pip:pipinstallxmltoxsdQuick StartHere's how to quickly get started with xmltoxsd:from xmltoxsd import XSDGenerator

generator = XSDGenerator()
xsd_schema = generator.generate_xsd("path/to/your/xml_file.xml")
print(xsd_schema)UsageTo generate an XSD schema from an XML file:with open("output.xsd", "w") as f:
    f.write(xsd_schema)ContributingWe welcome contributions to the xmltoxsd library. Please read our CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.LicenseThis project is licensed under the MIT License - see the LICENSE file for details.SupportIf you have any questions or encounter issues using the library, please open an issue on my GitHub repository.
Package: xmltramp2
# xmltramp2[![Build Status](https://travis-ci.org/tBaxter/xmltramp2.svg?branch=master)](https://travis-ci.org/tBaxter/xmltramp2)[xmltramp](http://www.aaronsw.com/2002/xmltramp/) was originally created by Aaron Swartzfor simple-yet-powerful parsing of RSS and other xml files.It is a simple, fast, lightweight alternative to more heavyweight parsers such as BeautifulSoup or ElementTree. It won't do all they do, but what it does do it does simply and easily.It has been substantially rewritten for subsequent python versions,including Python3 compatibility. Tests are included.## InstallationThe easiest way is via pip:`pip install xmltramp2`Usage is unchanged from older versions of xmltramp, other than you now import from a package:`from xmltramp2 import xmltramp`## UsageEveryone's got their data in XML these days. You need to read it. You've looked at the other XML APIs and they all contain miles of crud that's only necessary when parsing the most arcane documents. Wouldn't it be nice to have an easy-to-use API for the normal XML documents you deal with? That's xmltramp:```>>> sample_xml = """<doc version="2.7182818284590451"xmlns="http://example.org/bar"xmlns:dc="http://purl.org/dc/elements/1.1/"xmlns:bbc="http://example.org/bbc"><author><name>John Polk</name> and <name>John Palfrey</name></author><dc:creator>John Polk</dc:creator><dc:creator>John Palfrey</dc:creator><bbc:show bbc:station="4">Buffy</bbc:show></doc>""">>> import xmltramp>>> doc = xmltramp.Namespace("http://example.org/bar")>>> bbc = xmltramp.Namespace("http://example.org/bbc")>>> dc = xmltramp.Namespace("http://purl.org/dc/elements/1.1/")>>> d = xmltramp.parse(sample_xml)>>> d<doc version="2.7182818284590451">...</doc>>>> d('version')'2.7182818284590451'>>> d(version='2.0')>>> d('version')'2.0'>>> d._dir[<author>...</author>, <dc:creator>...</dc:creator>, <dc:creator>...</dc:creator>, <bbc:show bbc:station="4">...</bbc:show>]>>> d._name(u'http://example.org/bar', u'doc')>>> d[0]                # First child.<author>...</author>>>> d.author            # First author.<author>...</author>>>> str(d.author)'John Polk and John Palfrey'>>> d[dc.creator]        # First dc:creator.<dc:creator>...</dc:creator>>>> d[dc.creator:]       # All creators.[<dc:creator>...</dc:creator>, <dc:creator>...</dc:creator>]>>> d[dc.creator] = "Me!!!">>> str(d[dc.creator])'Me!!!'>>> d[bbc.show](bbc.station)'4'>>> d[bbc.show](bbc.station, '5')>>> d[bbc.show](bbc.station)'5'```## CreditsMost thanks go to Aaron Swartz, both for writing this in the first place, and just in general, for all he did.Additional thanks to Kristian Glass, for helping get this over the Python3 hump, and for tests.
Package: xmltread
xmltreadxmltrampwas originally created by Aaron Swartz
for simple-yet-powerful parsing of RSS and other xml files.It is a small, fast alternative to heavyweight parsers like BeautifulSoup and ElementTree.It has been mildly rewritten for python 3 compatibility, including bringing the packaging up to date so it can once again be installed via pip.
Sadly, python modules can no longer be built from a single source file, but the tweaked original xmltramp lives inside of xmltread.from xmltread import xmltrampworks, so you don't need to replace xmltramp with xmltread in your code.Installationvia pip:pip install xmltreadUsageEveryone's got their data in XML these days. You need to read it. You've looked at the other XML APIs and they all contain miles of crud that's only necessary when parsing the most arcane documents. Wouldn't it be nice to have an easy-to-use API for the normal XML documents you deal with? That's xmltramp:>>> sample_xml = """<doc version="2.7182818284590451"
  xmlns="http://example.org/bar"
  xmlns:dc="http://purl.org/dc/elements/1.1/"
  xmlns:bbc="http://example.org/bbc">
  <author><name>John Polk</name> and <name>John Palfrey</name></author>
  <dc:creator>John Polk</dc:creator>
  <dc:creator>John Palfrey</dc:creator>
  <bbc:show bbc:station="4">Buffy</bbc:show>
</doc>"""

>>> import xmltramp
>>> doc = xmltramp.Namespace("http://example.org/bar")
>>> bbc = xmltramp.Namespace("http://example.org/bbc")
>>> dc = xmltramp.Namespace("http://purl.org/dc/elements/1.1/")
>>> d = xmltramp.parse(sample_xml)
>>> d
<doc version="2.7182818284590451">...</doc>
>>> d('version')
'2.7182818284590451'
>>> d(version='2.0')
>>> d('version')
'2.0'
>>> d._dir
[<author>...</author>, <dc:creator>...</dc:creator>, <dc:creator>...</dc:creator>, <bbc:show bbc:station="4">...</bbc:show>]
>>> d._name
('http://example.org/bar', 'doc')
>>> d[0]                # First child.
<author>...</author>
>>> d.author            # First author.
<author>...</author>
>>> str(d.author)
'John Polk and John Palfrey'
>>> d[dc.creator]        # First dc:creator.
<dc:creator>...</dc:creator>
>>> d[dc.creator:]       # All creators.
[<dc:creator>...</dc:creator>, <dc:creator>...</dc:creator>]
>>> d[dc.creator] = "Me!!!"
>>> str(d[dc.creator])
'Me!!!'
>>> d[bbc.show](bbc.station)
'4'
>>> d[bbc.show](bbc.station, '5')
>>> d[bbc.show](bbc.station)
'5'CreditsBased on the original by Aaron Swartz.
Package: xmlunittest
Anyone uses XML, for RSS, for configuration files, for… well, we all use XML
for our own reasons (folk says one can not simply uses XML, but still…).So, your code generates XML, and everything is fine. As you follow best
practices (if you don’t, I think you should), you have written some good
unit-tests, where you compare code’s result with an expected result. I mean you
compare string with string. One day, something bad might happen.XML is not a simple string, it is a structured document. One can not simply
compare two XML string and expect everything to be fine: attributes’s order can
change unexpectedly, elements can be optional, and no one can explain simply
how spaces and tabs works in XML formatting.Here comes XML unittest TestCase: if you want to use the built-in unittest
package (or if it is a requirement), and you are not afraid of using xpath
expression withlxml, this library is made for you.You will be able to test your XML document, and use the power of xpath and
various schema languages to write tests that matter.LinksDistribution:https://pypi.python.org/pypi/xmlunittestDocumentation:http://python-xmlunittest.readthedocs.org/en/latest/Source:https://github.com/Exirel/python-xmlunittestHow toExtendsxmlunittest.XmlTestCaseWrite your tests, using the function or method that generate XML documentUsexmlunittest.XmlTestCase‘s assertion methods to validateKeep your tests readableExample:fromxmlunittestimportXmlTestCaseclassCustomTestCase(XmlTestCase):deftest_my_custom_test(self):# In a real case, data come from a call to your function/method.data="""<?xml version="1.0" encoding="UTF-8" ?>
        <root xmlns:ns="uri">
            <leaf id="1" active="on" />
            <leaf id="2" active="on" />
            <leaf id="3" active="off" />
        </root>"""# Everything starts with `assertXmlDocument`root=self.assertXmlDocument(data)# Check namespaceself.assertXmlNamespace(root,'ns','uri')# Checkself.assertXpathsUniqueValue(root,('./leaf/@id',))self.assertXpathValues(root,'./leaf/@active',('on','off'))
Package: xmlunittestbetter
Python XML-Unittest===================[![Build Status](https://travis-ci.org/richardasaurus/python-xmlunittest-better.png?branch=master)](https://travis-ci.org/richardasaurus/python-xmlunittest-better)[![Downloads](https://pypip.in/d/xmlunittestbetter/badge.png)](https://crate.io/packages/xmlunittestbetter/)This is a spork of [https://github.com/Exirel/python-xmlunittest](https://github.com/Exirel/python-xmlunittest).With wider lxml support and Python 2.7, 3.4 & 3.4 support.Examples======- Extend xmlunittest.XmlTestCase- Write your tests, using the function or method that generate XML document- Use xmlunittest.XmlTestCase‘s assertion methods to validate- Keep your test readableExample:```from xmlunittest import XmlTestCaseclass CustomTestCase(XmlTestCase):def test_my_custom_test(self):# In a real case, data come from a call to your function/method.data = """<?xml version="1.0" encoding="UTF-8" ?><root xmlns:ns="uri"><leaf id="1" active="on" /><leaf id="2" active="on" /><leaf id="3" active="off" /></root>"""# Everything starts with `assert_xml_document`root = self.assert_xml_document(data)# Check namespaceself.assert_xml_namespace(root, 'ns', 'uri')# Checkself.assert_xpaths_unique_value(root, ('./leaf@id', ))self.assert_xpath_values(root, './leaf@active', ('on', 'off'))```Running the tests======To run the unit tests for this package::```pip install toxtox```
Package: xmlutil
Programming Language :: Python
Programming Language :: Python :: 2
Programming Language :: Python :: 2.7
Programming Language :: Python :: 3
Programming Language :: Python :: 3.3
Programming Language :: Python :: 3.4
Programming Language :: Python :: 3.5
Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.7
Topic :: Software Development :: Libraries :: Python Modules
Description: Convenience wrappers for working with XML data
Platform: UNKNOWN
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers