Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within XML
Search Coderanch
Advance search
Google search
Register / Login
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
Forum:
XML and Related Technologies
Access Xml node values
kamal palia
Greenhorn
Posts: 17
posted 11 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
<form action="http://localhost:7003/MultiMPI/Authenticate" method="post">
<textarea name="xmlData" cols=90 rows=90>
<req-auth>
<request-id>4sS4yV6tQ2</request-id>
<response-id>MTQ0NzY2</response-id>
<req-type>1002</req-type>
<auth-data>
<field name='OTP2' value='360055' />
</auth-data>
</req-auth>
</textarea>
<br><input type="submit" value="Request">
</form>
how can i get value 360055?
K. Tsang
Bartender
Posts: 3648
16
I like...
posted 11 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Using XSLT surely able to get the necessary values. However, does your form data follow a DTD or XML Schema? With such
doc
you can jump to the node or tag you need.
K. Tsang CEng MBCS PMP PMI-ACP OCMJEA OCPJP
kamal palia
Greenhorn
Posts: 17
posted 11 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
I am able to access all the nodes value by using
NodeList requestID = element.getElementsByTagName("request-id");
Element line = (Element) requestID.item(0);
but using same how can i get the value of
<auth-data>
<field name='OTP2' value='360055' />
</auth-data>
360055?
K. Tsang
Bartender
Posts: 3648
16
I like...
posted 11 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
so what element are you on, <auth-data> or <field>? The actual value you need is in the field element with the attribute "value".
You may want to check out
this link
which is similar to what
you should
be getting at.
K. Tsang CEng MBCS PMP PMI-ACP OCMJEA OCPJP
g tsuji
Ranch Hand
Posts: 734
7
posted 11 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
If you know getElementsByTagName well, you can continue to use one step further. Off-hand like this?
NodeList requestID = element.getElementsByTagName("request-id"); Element line = (Element) requestID.item(0); NodeList nlist=line.getElementsByTagName("field"); Element field=null; String value=""; if (nlist.getLength()!=0) { field=(Element)nlist.item(0); value=field.getAttribute("value"); }
With a little knowledge, a
cast iron skillet
is non-stick and lasts a lifetime.
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Unable to update database
Beans and Jsps and Servlets
how to enable a textarea in javascript?
Form Plugin Form Reference On Success callback
Need some help in setting up a url parameter into a form bean
More...