Sha256: 4478ff35235714f818081153c1250110be7b3a699d528de1d292772b4fd50eca
Contents?: true
Size: 738 Bytes
Versions: 1
Compression:
Stored size: 738 Bytes
Contents
#! /usr/local/bin/ruby ## ID attribute for XPointer test implementation ## 1998 by yoshidam require 'xml/dom/builder' ## create test XML tree doc = XML::DOM::Builder.new.parse(" <test> <section name=\"section1\"> <p id='para1'>test</p> <p id='para2'>test</p> </section> <section name=\"section2\"> </section> </test> ") ## setup ID attribute doc._setIDAttr('id') ## for all element doc._setIDAttr('name', 'section') ## for section element ## find ID attribute p doc.getNodesByXPointer("id(section1)")[0].makeXPointer(false) p doc.getNodesByXPointer("id(section1)")[0].makeXPointer(true) p doc.getNodesByXPointer("id(para1)")[0].makeXPointer(false) p doc.getNodesByXPointer("id(para1)")[0].makeXPointer(true)
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
mame-xmlparser-0.6.81.1 | samples/idattrtest.rb |