implementation of xpath in ruby?



Dear Friends,

i need to implement xpath in my parser class. I have implemented a new
parser which parses xml document. I have used token types to parse xml
like,

while parser.next

if parser.token_type == tag_start
parser.tag
end

if parser.token_type == tag_end
parser.tag_end
end
end

so a token_type method returns token types like tag_start, tag_end,
comment, pi etc and tag method returns the tag start and tag_end method
returns the tag end of an xml document.

now i need to implement xpath in my parser class. I need to navigate the
xml document using xpath like,

while parser.next!

parser.path( 'book/book-name' ) do

end

end

could anyone help me with some solution to implement xpath in my parser
class.I don't want to use REXML or HPRICOT. i want to create my own
methods which does the above.

Thanks in advance

Regards,
Martin
--
Posted via http://www.ruby-forum.com/.

.



Relevant Pages

  • Re: implementation of xpath in ruby?
    ... i need to implement xpath in my parser class. ... I have used token types to parse xml ... returns the tag end of an xml document. ... now i need to implement xpath in my parser class. ...
    (comp.lang.ruby)
  • Using XPath to copy nodes
    ... private Element getAnswers(Element root, String queID) throws ... XPath xpath = factory.newXPath; ... //Design the query to search through the XML Document ...
    (comp.lang.java.programmer)
  • Using XPath to copy nodes
    ... private Element getAnswers(Element root, String queID) throws ... XPath xpath = factory.newXPath; ... //Design the query to search through the XML Document ...
    (comp.lang.java.programmer)
  • Re: Using XPath Against A Node
    ... top parent? ... Or is the entire xml document sent with it. ... In terms of the XPath implementation with SelectSingleNode and SelectNodes if the node is not inserted in the owning document then it looks like the XPath / evaluates to the node itself. ...
    (microsoft.public.dotnet.languages.vb)
  • [REVS] Blind XPath Injection
    ... The following security advisory is sent to the securiteam mailing list, and can be found at the SecuriTeam web site: http://www.securiteam.com ... The linked paper at the bottom describes a Blind XPath Injection attack ... that enables an attacker to extract a complete XML document used for XPath ...
    (Securiteam)