• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Not able to extract XML data got in string format

 
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all


I get a xml data in form of a string(never seen such a xml data) but im stuck wid extracting it.

The data is like,
<ABC ONE="1023814" TWO="1234567892" THREE="INR" FOUR="2012-05-25" FIVE="1" SIX="FAILED" />

When i extract dis i get null.

Can anyone send a snippet of code to achieve this functionality, its bit urgent.

Regards
S V Shetty
 
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

shraddha dsn wrote:

When i extract dis i get null.


How do you extract it and from where? What does your code look like?

 
Deepshan Shetty
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Need to extract it in java..

Please Check my code




Regards
S V Shetty
 
Rancher
Posts: 1776
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please UseCodeTags while posting codes.
 
Deepshan Shetty
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Okay Sir

Regards
S V Shetty
 
John Jai
Rancher
Posts: 1776
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Basic things to troubleshoot -
1. Use printStackTrace() on the Exception to find which line creates Exception, if any.
2. Use System.out.print statements to find if the flow of the program.

If you have the node like - <ABC ONE="someValue" TWO="someValue" /> , then ONE and TWO are not Nodes (or Elements) but attributes of the node ABC.

So the correct way to get the value present in the attribute ONE will be like below -

and hence this won't work.


Make sure it fails there by using some print statements.
 
John Jai
Rancher
Posts: 1776
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

shraddha dsn wrote:Okay Sir

Regards
S V Shetty


You can edit the post and apply code tags.
 
Deepshan Shetty
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Did It Sir.

And Thank You . Will try with these now
 
Deepshan Shetty
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Very thankful to you Sir..

It worked!!!

Regards
S V Shetty
 
John Jai
Rancher
Posts: 1776
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sure and welcome to the Ranch

Please read Javaranch Naming Policy.
 
Deepshan Shetty
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank You
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic