• 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

Same old pproblem.. a bit urgent

 
Ranch Hand
Posts: 187
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hello
i have problem , my String(not xml) just a java string is like this String response = "<XArC version="2.0" service="GetHitList" type="response"><folder name='Vermoegensstatus'><document><docid>100000</docid><metainfo> " i want to search this string and get all the values which are between <docid> and </docid > , and if the value is not there then the method should return peacefully
i have started this method pls complete this ..
public String getPat(String response , String "start" , String "end" ) {
.............
.........
......
}
just for sake i have done this pls complete this method.
 
Ranch Hand
Posts: 1492
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Vivek,
Not a very good start ...

How about this for the ending?
Regards,
Manfred.
 
vivek sivakumar
Ranch Hand
Posts: 187
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi Manfred ,
Thanks a lot for ur generosity. i will post my experience with ur snippet as soon as it works.
 
vivek sivakumar
Ranch Hand
Posts: 187
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"<XArC version="2.0" service="GetHitList" type="response"><folder name='Vermoegensstatus'><document><docid>100000</docid><metainfo><docid>5678789457895</docid><docid>5678954</docid> "
hi manfred ur method works perfectly fine but the problem is that sometimes i get number of (more than one) occurence of the pattern <docid></docid> , ur method returns only one value but if more than one value is present its not returning( i mean if there are two tags <docid></docid> with values then it should return the 2 values but only one is returned how can i deal this problem ..how can i intoduce a looping for this stuff, to look for multiple occurences of docids ..pls advice on this
[ April 25, 2002: Message edited by: vivek sivakumar ]
 
Manfred Leonhardt
Ranch Hand
Posts: 1492
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Vivek,
Sure make it hard. To get variable number of return values I would make use of the collection interface. The following program shows how the method would be altered and how to use it and the results it produces.

Enjoy,
Manfred.
 
vivek sivakumar
Ranch Hand
Posts: 187
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
well its returning me a collection but if i want it in terms like separater string values like 10001, 10002,..... then how can i do it .
[ April 30, 2002: Message edited by: vivek sivakumar ]
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic