Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here


Non-java techie needs help please!

Non-java techie needs help please!

Non-java techie needs help please!

Trying to modify code that I inherited. I'm an xml/xsl/sql person and this just has me stumped.

xml data behind a form containing customer information. I need to get the value from a field id two nodes down.


<Field Id="CUST.CITY" Value="New Orleans" UIRequired="0" UIDisabled="0" UIHidden="0" UpdatedBy="User"/> 

Purpose is to pull the value out and incorporate it into a query string to pass through to a URL. I can't pull it using SelectSingleNode.

This is the code that's in the current file. Need to get city out of code above instead of the App Key / ID Number.


var application_number = '';
      var key = null;
      var type = '';

      var keynode = opener.pageXML.documentElement.selectSingleNode('//AppKey');
	  var key = '';

      if(key.length > 0){        
        application_number = key;
          application_number = $('body', opener.document).html().match(/"OTH_KEY" [vV]alue\="([\d\.\d]+)"/)[1];          
        if(typeof application_number === 'undefined' || application_number == ''){
          application_number = $("input[onchange*=updateOtherKeyValue]", opener.document).val();
			window.location = 'http://thatcompanysurl.com/ourfolder/ourSystem/show/SummaryFlowA?auth_token=ourtokencode&query="' + type + '":"' + application_number + '"'; 

Help please? Thanks!

RE: Non-java techie needs help please!

this should do it


var parser = new DOMParser();
var xmlDoc = parser.parseFromString(xml,'text/xml');
var nodes = xmlDoc.querySelectorAll('Field[Id="CUST.CITY"]');
for (var i = 0; i < nodes.length; i++) {
	var city = nodes[i].getAttribute('Value');

fiddle here

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close