All Projects → scrapinghub → Js2xml

scrapinghub / Js2xml

Licence: mit
Convert Javascript code to an XML document

Programming Languages

javascript
184084 projects - #8 most used programming language
python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Js2xml

Configurate
A simple configuration library for Java applications providing a node structure, a variety of formats, and tools for transformation
Stars: ✭ 148 (+19.35%)
Mutual labels:  hacktoberfest, xml
Home
A configurable and eXtensible Xml serializer for .NET.
Stars: ✭ 208 (+67.74%)
Mutual labels:  hacktoberfest, xml
Woodstox
The gold standard Stax XML API implementation. Now at Github.
Stars: ✭ 145 (+16.94%)
Mutual labels:  hacktoberfest, xml
Horaires Ratp Api
Webservice pour les horaires et trafic RATP en temps réel
Stars: ✭ 232 (+87.1%)
Mutual labels:  hacktoberfest, xml
Zek
Generate a Go struct from XML.
Stars: ✭ 451 (+263.71%)
Mutual labels:  hacktoberfest, xml
Sirix
SirixDB is a temporal, evolutionary database system, which uses an accumulate only approach. It keeps the full history of each resource. Every commit stores a space-efficient snapshot through structural sharing. It is log-structured and never overwrites data. SirixDB uses a novel page-level versioning approach called sliding snapshot.
Stars: ✭ 638 (+414.52%)
Mutual labels:  hacktoberfest, xml
Xbmc
Kodi is an award-winning free and open source home theater/media center software and entertainment hub for digital media. With its beautiful interface and powerful skinning engine, it's available for Android, BSD, Linux, macOS, iOS and Windows.
Stars: ✭ 13,175 (+10525%)
Mutual labels:  hacktoberfest, xml
Dita Ot
DITA Open Toolkit — the open-source XML publishing engine for content authored in the Darwin Information Typing Architecture.
Stars: ✭ 279 (+125%)
Mutual labels:  hacktoberfest, xml
Htmlparser2
The fast & forgiving HTML and XML parser
Stars: ✭ 3,299 (+2560.48%)
Mutual labels:  hacktoberfest, xml
Parsel
Parsel lets you extract data from XML/HTML documents using XPath or CSS selectors
Stars: ✭ 628 (+406.45%)
Mutual labels:  hacktoberfest, xml
Sdformat
Simulation Description Format (SDFormat) parser and description files.
Stars: ✭ 51 (-58.87%)
Mutual labels:  hacktoberfest, xml
Cloudnet V3
CloudNet v3 is the next generation of Minecraft Java and Bedrock cloud systems
Stars: ✭ 124 (+0%)
Mutual labels:  hacktoberfest
Youtubeexplode
The ultimate dirty YouTube library
Stars: ✭ 1,775 (+1331.45%)
Mutual labels:  hacktoberfest
Tuist
🚀 Create, maintain, and interact with Xcode projects at scale
Stars: ✭ 2,234 (+1701.61%)
Mutual labels:  hacktoberfest
Colore
A powerful C# library for Razer Chroma's SDK
Stars: ✭ 121 (-2.42%)
Mutual labels:  hacktoberfest
Labgrid
embedded systems control library for development, testing and installation
Stars: ✭ 124 (+0%)
Mutual labels:  hacktoberfest
Care
Care is a single point to link Hospitals, Corona Care Centers and Volunteers to the unified Corona Safe Network so that the Kerala Chief Minister's Office has direct access to live reports of health data v/s our total. healthcare capacity
Stars: ✭ 124 (+0%)
Mutual labels:  hacktoberfest
Ros1 bridge
ROS 2 package that provides bidirectional communication between ROS 1 and ROS 2
Stars: ✭ 123 (-0.81%)
Mutual labels:  hacktoberfest
Invoke Msbuild
Invoke-MsBuild PowerShell module to make building projects and solutions with MsBuild.exe easy.
Stars: ✭ 123 (-0.81%)
Mutual labels:  hacktoberfest
Ortelius
Ortelius simplifies the implementation of microservices. By providing a central catalog of services with their deployment specs, application teams can easily consume and deploy services across cluster. Ortelius tracks application versions based on service updates and maps their service dependencies eliminating confusion and guess work.
Stars: ✭ 123 (-0.81%)
Mutual labels:  hacktoberfest

js2xml

Build Status codecov

Convert Javascript code to an XML document.

This makes it easy to extract data embedded in JavaScript code using XPath in a way more robust than just using regular expressions.

Install:

You can install js2xml via PyPI:

pip install js2xml

Example:

>>> import js2xml
>>>
>>> jscode = """function factorial(n) {
...     if (n === 0) {
...         return 1;
...     }
...     return n * factorial(n - 1);
... }"""
>>> parsed = js2xml.parse(jscode)
>>>
>>> parsed.xpath("//funcdecl/@name")  # extracts function name
['factorial']
>>>
>>> print(js2xml.pretty_print(parsed))  # pretty-print generated XML
<program>
  <funcdecl name="factorial">
    <parameters>
      <identifier name="n"/>
    </parameters>
    <body>
      <if>
        <predicate>
          <binaryoperation operation="===">
            <left>
              <identifier name="n"/>
            </left>
            <right>
              <number value="0"/>
            </right>
          </binaryoperation>
        </predicate>
        <then>
          <block>
            <return>
              <number value="1"/>
            </return>
          </block>
        </then>
      </if>
      <return>
        <binaryoperation operation="*">
          <left>
            <identifier name="n"/>
          </left>
          <right>
            <functioncall>
              <function>
                <identifier name="factorial"/>
              </function>
              <arguments>
                <binaryoperation operation="-">
                  <left>
                    <identifier name="n"/>
                  </left>
                  <right>
                    <number value="1"/>
                  </right>
                </binaryoperation>
              </arguments>
            </functioncall>
          </right>
        </binaryoperation>
      </return>
    </body>
  </funcdecl>
</program>

>>>

Changelog

v0.5.0 (2020-NN-NN)

  • Drop Python 2.7 support, remove six dependency

v0.4.0 (2020-06-04)

  • Add Python 3.7 and 3.8 support, drop Python 3.4 support

  • Use calmjs.parse instead of slimit for JavaScript parsing

    calmjs.parse is a well-maintained fork of slimit which solves some of its shortcomings, such as support for JavaScript keywords being used as object keys.

    However, calmjs.parse also introduces slight changes to the output of js2xml, making this change backward-incompatible.

  • Fix unicode surrogate pair handling

  • Code cleanup for Python 3

v0.3.1 (2017-08-03)

  • Fix packaging

v0.3.0 (2017-08-03)

  • Add Python 3.6 support

  • Deprecate js2xml.jsonlike

  • Introduce js2xml.utils.objects module:

    • js2xml.utils.objects.make(node): takes a node in the js2xml-parsed tree and converts to a suitable Python object
    • js2xml.utils.objects.findall(tree, types): used to find the top-most nodes in the js2xml-parsed tree that can be converted to a dict, list, str, bool, int or float
    • js2xml.utils.objects.getall(tree, types): same as .findall() except that it converts what was found to the corresponding Python object, using js2xml.utils.objects.make()
  • Introduce js2xml.utils.vars module:

    • js2xml.utils.vars.get_vars(tree) can be used to turn a JS snippet into a python object where you can access JavaScript variables by name and get the parsed values

v0.2.3 (2017-05-30)

  • Regenerate lextab.py and yacctab.py files with PLY 3.10
  • Properly set logger level to ERROR

v0.2.2 (2016-12-01)

  • Include lextab.py and yacctab.py files to (hopefully) remove write permission warnings (see issue #16)
  • Run tests with tox (locally and on Travis CI)
  • Add code coverage reports (+ codecov.io for Travis CI builds)
  • Run tests with Python 3.6
  • Automatic PyPI deploys from Travis CI

v0.2.1 (2016-06-10)

  • Distribute as universal wheel

v0.2.0 (2016-06-10)

  • Python 3 support (tested with 3.4 and 3.5)
  • Use logger to suppress Yacc warnings
  • require PLY > 3.6
  • Use bumpversion for versioning
  • Pretty-print output is now a Unicode string

v0.1.2 (2015-05-11)

  • Profiling scripts added
  • Updated notes with use-case, installing via pip
  • Force PLY 3.4 (3.6 has issues with slimit)

v0.1.1 (2014-08-13)

  • Fix parsing of objects with integer keys
  • Fix try/catch/finally and named function expressions
  • Add download URL in setup file (for PyPI)

v0.1 (2014-08-12)

Initial release

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].