• 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

parsing data... formatting xml in the JSP?

 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm not sure if this is a JSP question, or a java/class file question? or xml or what, so forgive me if its in the wrong section.

Basically I'm integrating with a web service that returns some form of XML.

This is a snippet of my code from my JSP, this particular snippet is in client side javaScript.
numGuess is my java/class file and getHint processes my request to get the info by running the URL.

document.Search.searchText.value = "<%= numguess.getHint()%>"
alert(document.Search.searchText.value);




When I run this command an alert box pops up that contains the following test:

<xmlRouterResponse><queryAndResponseSet> <queryAndResponse>
<query>gsk</query>
<response>GSK</response>
<response>Glaxo SmithKline</response>
<response>GlaxoSmithKline</response>
</queryAndResponse></queryAndResponseSet></xmlRouterResponse>



which as you can see still contains the <> xml tags.
Is there a way I can yank out just the appropriate response data and query data?
I would like my result set to come back (for this example)
to include (space delimited): gsk GSK Glaxo SmithKline GlaxoSmithKline

Can this be done at the class/java file level? or should I persue doing this at the javascript level or in the server side JSP?
[ August 03, 2004: Message edited by: Geoff Garcia ]
 
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
JSTL contains a full set of XML handling and XSLT processing tags.
 
Geoff Garcia
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I should have mentioned that I'm a complete j2ee noob.
On a scale of 1-10 (10 being expert) I'm about a 1.
So! I've never heard of JSTL, is that something additional I'd have to install?
I'm working on google doing searches trying to find out more about it, but everything dealing with JSTL seems to involve uber complex (to me) things, and nothing basic about what it is, how to install it, or how to use it.
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
JSTL is the JSP Standard Tag Library.

If you are just starting out, the best thing you can do for yourself is to grab a book on JSP 2.0 (make sure it's fairly recent and covers 2.0), and dive in.
 
Geoff Garcia
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Am already looking on google and in books.
Am not looking to learn the in's and out's of java at this time, just how to fix this tiny issue. I have to get it done by friday.
So if anyone has any specific help on how to do it (rather than generic) that would be appreciated.
Thanks
[ August 04, 2004: Message edited by: Geoff Garcia ]
 
Ranch Hand
Posts: 823
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Geoff,

If you get stuck you could adapt the code below for use in your NumGuess class. It does basically what you want.


Not exactly elegant, but perhaps useful.

Rgds

Jules
 
Drove my Chevy to the levee but the levee was dry. A wrung this tiny ad and it was still dry.
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic