Win a copy of Microservices Testing (Live Project) this week in the Spring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

Urgent Help! How to get attributes value using xalan parser

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How to get attributes value of an xml file.
I would like to use XPATH API.
I am new to XML Parser.
If anybody knows this pl. advice asap.
My xml file sample.xml is as under:
<xdb>
<password xmlns='jabber:iq:auth' xdbns='jabber:iq:auth'>pass</password>
<query xmlns='jabber:iq:register' xdbns='jabber:iq:register'>
<name>myName</name>
<email>email@domain.com</email>
<x xmlns='jabber:x elay' stamp='20030624T06:22:04'>registered</x>
</query>
<foo xdbns='jabber:xdb:nslist' xmlns='jabber:xdb:nslist'>
<ns type='private'>jabberim refs</ns>
</foo>
<query xmlns='jabber:iq:last' last='1056440297' xdbns='jabber:iq:last'>Disconnected</query>
<zerok xmlns='jabber:iq:auth:0k' xdbns='jabber:iq:auth:0k'>
<token>3EF7EE0C</token>
<sequence>497</sequence>
<hash>a25666ffc749159471e4b85e9887182af20f87bf</hash>
</zerok>
<foo xmlns='jabber:x ffline' xdbns='jabber:x ffline'/>
<query xmlns='jabber:iq:roster' xdbns='jabber:iq:roster'>
<item jid='radha@shiv.com' name='radha' subscription='both'>
<group>Dost</group>
</item>
<item jid='hari@shiv.com' name='hari' subscription='both'>
<group>Dost</group>
</item>
<item jid='sonal@shiv.com' name='sonal' subscription='both'>
<group>Dost</group>
</item>
</query>
</xdb>
The last element before </xdb>, there is <item> tag. I need to read its attribute jid value.
<item jid="radha@shiv.com".....>
There r 3 <item> tags in the sample file.
I need to store these attributes' value in a string array.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic