Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

xml-motor

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

xml-motor

  • 0.1.6
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

======================================================================

\// ||/|| || _ ||/|| ||@|| ++ ||@|| ||)) //\ || || ||_ || || |||| || |||| ||\

====================================================================== v 0.1.1

@GitHub: https://github.com/abhishekkr/rubygem_xml_motor @RubyGems: http://rubygems.org/gems/xml-motor

for support contact: mail: abhikumar163@gmail.com http://www.twitter.com/aBionic

the main development for this algo (to be done in other languages too) is handled in https://github.com/abhishekkr/axml-motor and you could find the test-cases in there too, to proceed on your own

A new short XML Parsing Algorithm implemented directly in >500 lines. An easy-to-use XML Parser without any Native Dependencies. [How To Use]:

    Loading:
     + $ gem install xml-motor
     + 'require' the 'xml-motor'

    Usage:
       [[ To Fetch Just Attribute Values ]]
         str = {XML_DATA}
         nodes_ = XMLMotor.splitter str
         tags_ = XMLMotor.splitter nodes_
         XMLMotor.xmlattrib 'attrib_to_fetch_value', nodes_, tags_
         XMLMotor.xmlattrib 'attrib_to_fetch_value', nodes_, tags_, <_TAG_>
         XMLMotor.xmlattrib 'attrib_to_fetch_value', nodes_, tags_, <_TAG_>, "ATTRIB_KEY"
         XMLMotor.xmlattrib 'attrib_to_fetch_value', nodes_, tags_, <_TAG_>, "ATTRIB_KEY="
         XMLMotor.xmlattrib 'attrib_to_fetch_value', nodes_, tags_, <_TAG_>, "ATTRIB_KEY=ATTRIB_VALUE"
         XMLMotor.xmlattrib 'attrib_to_fetch_value', nodes_, tags_, <_TAG_>, "=ATTRIB_VALUE"


       [[ To Search More Than One QUERIES ]]
         str = {XML_DATA}
         nodes_ = XMLMotor.splitter str
         tags_ = XMLMotor.indexify nodes_
         nodes_array = XMLMotor.xmldata nodes_, tags_, "_TAG_"
         nodes_array = XMLMotor.xmldata nodes_, tags_, "_TAG_", "ATTRIB_KEY=ATTRIB_VALUE"
         nodes_array = XMLMotor.xmldata nodes_, tags_, nil, "ATTRIB_KEY=ATTRIB_VALUE"
         nodes_array = XMLMotor.xmldata nodes_, tags_, nil, "ATTRIB_KEY"
         nodes_array = XMLMotor.xmldata nodes_, tags_, nil, "='ATTRIB_VALUE'"
         >>>>> for having root-node-tag also in returned result <<<<<
         nodes_array = XMLMotor.xmldata nodes_, tags_, "_TAG_", nil, true
         nodes_array = XMLMotor.xmldata nodes_, tags_, "_TAG_", "ATTRIB_KEY=ATTRIB_VALUE", true
         nodes_array = XMLMotor.xmldata nodes_, tags_, "_TAG_", ["ATTRIB_KEY=ATTRIB_VALUE"], true
         nodes_array = XMLMotor.xmldata nodes_, tags_, "_TAG_", ["KEY1=VALUE1", "KEY2=VALUE2"...], true
         nodes_array = XMLMotor.xmldata nodes_, tags_, nil, ["KEY1=VALUE1", "KEY2=VALUE2"...], true
         nodes_array = XMLMotor.xmldata nodes_, tags_, nil, "ATTRIB_KEY=ATTRIB_VALUE", true

       [[ To Search Just One QUERY ]]
         nodes_array = XMLMotor.get_node_from_file "_XML_FILE_", "_TAG_"
         nodes_array = XMLMotor.get_node_from_file "_XML_FILE_", "_TAG_", "ATTRIB_KEY=ATTRIB_VALUE"
         nodes_array = XMLMotor.get_node_from_content "_XML_DATA_", "_TAG_"
         nodes_array = XMLMotor.get_node_from_content "_XML_DATA_", "_TAG_", "ATTRIB_KEY=ATTRIB_VALUE"
         nodes_array = XMLMotor.get_node_from_file "_XML_FILE_", nil, "ATTRIB_KEY=ATTRIB_VALUE"
         nodes_array = XMLMotor.get_node_from_content "_XML_DATA_", nil, "ATTRIB_KEY=ATTRIB_VALUE"
         >>>>> for having root-node-tag also in returned result <<<<<
         nodes_array = XMLMotor.get_node_from_file "_XML_FILE_", "_TAG_", nil, true
         nodes_array = XMLMotor.get_node_from_content "_XML_DATA_", "_TAG_", "ATTRIB_KEY=ATTRIB_VALUE", true
         nodes_array = XMLMotor.get_node_from_content "_XML_DATA_", "_TAG_", ["ATTRIB_KEY=ATTRIB_VALUE"], true
         nodes_array = XMLMotor.get_node_from_content "_XML_DATA_", "_TAG_", ["KEY1=VALUE1", "KEY2=VALUE2"...], true
         nodes_array = XMLMotor.get_node_from_content "_XML_DATA_", "_TAG_", ["KEY1=VALUE1", "KEY2=VALUE2"...], true
         nodes_array = XMLMotor.get_node_from_content "_XML_DATA_", nil, "ATTRIB_KEY=ATTRIB_VALUE", true
         nodes_array = XMLMotor.get_node_from_content "_XML_DATA_", nil, ["KEY1=VALUE1", "KEY2=VALUE2"...], true

    Example Calls As Code:
     + XMLMotor.get_node_from_content "<A>a</A><B><A>ba</A></B>", "A"
         RETURNS: ["a", "ba"]
     + XMLMotor.get_node_from_content "<A>a</A><B><A>ba</A></B>", "B.A"
         RETURNS: ["ba"]
     + XMLMotor.get_node_from_content "<A i='1'>a</A><B><A i='2'>ba</A></B>", "A", "i='1'"
         RETURNS: ["a"]

To turn on the verbosity for errors in XML-Motor, set an Environment value for 'VERBOSE'.

=====================================================================

FAQs

Package last updated on 20 Aug 2012

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