NAKAMURA, Hiroshi
6/8/2007 1:15:00 PM
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi,
Vikash Kumar wrote:
> I have a xml file
Save this file to foo.xml and;
require 'xsd/mapping'
obj = XSD::Mapping.xml2obj(File.read("foo.xml"))
obj.xmlattr_billerName #=> "Vikash"
obj.bill.each do |bill|
p bill.xmlattr_accountId
end
#=> "1"
#=> "OAQ"
#=> "dOAQ"
#=> "ab"
#=> "eb"
An element can be accessed via the method which name is as same as the
element name. An attribute can be accessed via the method "xmlattr_" +
attribute name.
Regards,
// NaHi
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Cygwin)
iQEVAwUBRmlWHh9L2jg5EEGlAQLCRAf/XdXTE2anttIuxQFQQaoWZAgeDC2Gw0MM
XvSwJMFibW8PAev+nJTuMExEV2v1oDbyNIn3KBK96Q0A5CZgMIUTwd7HTdM/Owsr
wRqyFlKcf8L34PsLTCwmQ4T0AlQuMyLiPi32I4lXodNu+htGWTRA3wbfd4Qcfg66
vPqQUI5kd9bOnRZ0CONbHKfN4bVbj6bZd3RFaSbfOEzVAgSovAxP/foWKvATOnfN
X64MdT11u5bmUUN30Xun/M+Y9RFZv6frk2LkkBQ5AcCy7dAN/j0uATc4f2kUdItZ
SxsfOKy4eYsPVNyLHvfNTXb4TWoPUZGyd6NK7BJ5aE45EA56ZMCo9A==
=mBbL
-----END PGP SIGNATURE-----