Saturday, November 12, 2011

XML-Motor v0.0.3 ~ mine XML once..... multiple search

released v0.0.3 of xml-motor with following update: http://rubygems.org/gems/xml-motor

Earlier:
  * it just supported one search per every XML data processing
Now:
  * could retrieve processed XML 'Information' once, and search again & again with minimized cost

Now, along-with.....
  * a single method-call search for Tag (w/ or w/o Attribute) in provided XML String or File
You also have the capability to.....
  * fetch the two (or one, depends how you wanna roll) required set of Information mined by providing it XML String
  * then provide that information everytime to search anything, and hence making it way quicker for multiple searches


So, the improved way for multiple searches:

  First, update your 'xml-motor' gem using
    $ gem install xml-motor

  Now, the way to use it
#!/usr/bin/env ruby
require 'xml-motor'

fyl = File.open "myXMLfile.xml"
str = fyl.read
xNodes = XMLMotorEngine._splitter_ str
xTags = XMLMotorEngine._indexify_ xNodes
result1 = XMLMotorEngine.pre_processed_content(
            xNodes, xTags, "h1")

result2 = XMLMotorEngine.pre_processed_content(
            xNodes, xTags, "div", "class='wanted'")

Wednesday, November 9, 2011

[new portable algo] Easy XML Parsing using XML-Motor (currently just in Ruby)

Easy XML Parsing using XML-Motor 
(currently just implemented in Ruby as a Gem)
Using a new, compact algorithm of XML Partsing

===================================================
v 0.0.2
@GitHub: https://github.com/abhishekkr/rubygem_xml_motor

@RubyGems: http://rubygems.org/gems/xml-motor
===================================================

A new short XML Parsing Algorithm implemented in LessThan 200 Ruby lines.
An easy-to-use XML Parser without any Native Dependencies.

[How To Use]

Installing and Loading:
   + $ gem install xml-motor
   + in your ruby code: require 'xml-motor'

Usage:
  + To find values of an xml node from an xml file
      XMLMotor.get_node_from_file [file_name_with_path], [tag_name]
  + To find values of an xml node from an xml string
      XMLMotor.get_node_from_content [xml_data], [tag_name]
  + To find values of an xml node with a tag_name having required attribute
      XMLMotor.get_node_from_content [xml_data], [tag_name], [attr_key=attr_value]

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

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

[Example Code]

require 'xml-motor'

puts XMLMotor.get_node_from_file "eloqjs.htm", "h1"
 
fyl = File.open("elogjs.htm")
XMLData = fyl.read

puts XMLMotor.get_node_from_content XMLData, "div.span"

puts XMLMotor.get_node_from_content XMLData, "div"

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