...I wonder if I still have my patch hanging around for that makes
use of method_missing() to find nodes (pretty cool for XML
configuration foo).
Ah, what's that do?
config = XML::Document...
@version = config.version
bin = config.bin
config.path.each do |path|
p path
end
For a document like:
<myAppConfig>
<version>1.0</version>
<bin>/bin/rm -rf /etc/shadow</bin>
<path>/opt/linux/blows</path>
<path>/usr/local/is/good</path>
<path>/usr/bin</path>
</myAppConfig>
Which really, really kicked ass because it was simple and I was able
to map XML to code easily. If a node is missing, it grabs an
attribute of the same name. So functionally, the above and below XML
docs return the same data to the application.
<myAppConfig version="1.0" bin="/bin/rm -rf /etc/shadow">
<path>/opt/linux/blows</path>
<path>/usr/local/is/good</path>
<path>/usr/bin</path>
</myAppConfig>
Sprinkle a bit of relaxng, and you've got a winner, IMHO.
Purist arguments aside, this was very, very cool to write from a
programmer's perspective. Returning nil or throwing an exception was
the hangup and why I never committed it, iirc (easy enough to recreate
using ruby though). -sc
--
Sean Chittenden
[EMAIL PROTECTED]
_______________________________________________
libxml-devel mailing list
libxml-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/libxml-devel