Solved

responseXML.getElementsByTagName("z:row")

Posted on 2011-09-02
6
1,498 Views
Last Modified: 2012-05-12
Hello All,

I am trying to understand the code below. Especially, the following line
var b=a.responseXML.getElementsByTagName("z:row");

Also, for the following (aryInfo[0] = b[0].getAttribute("ows_OAC");), where is the attribute coming from?

We are using SharePoint 2007.
Any help/explanation would be appreciated.


Thanks!
var aryReturn = new Array();
	var a=SPLISTCOLLECTION.getListItems("ProductList ","",'<Query><Where><Eq><FieldRef Name="Product Abbreviations" /><Value Type="Text">'+bName+'</Value></Eq></Where></Query>',"",1,"");
	var b=a.responseXML.getElementsByTagName("z:row");
    var aryInfo = new Array();
    aryInfo[0] = b[0].getAttribute("ows_OAC");
    aryInfo[1] = '';

Open in new window

0
Comment
Question by:Isaac
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 
LVL 22

Accepted Solution

by:
pivar earned 500 total points
ID: 36476095
Hi,

var b=a.responseXML.getElementsByTagName("z:row");
This will give you a list of all elements with the tag name "z:row".  

aryInfo[0] = b[0].getAttribute("ows_OAC")
This will give you the attribute "ows_OAC" of element b[0].

Example

b will hold a list of all <z:row> in your DOM.
aryinfo[0] will hold the value of attribute "ows_OAC"  of the first <z:row ows_OAC="xxx"> found.

/peter
0
 
LVL 5

Author Comment

by:Isaac
ID: 36478367
>>b will hold a list of all <z:row> in your DOM.<<

Will this be the DOM where my SharePoint list is located?
0
 
LVL 22

Expert Comment

by:pivar
ID: 36478482
It's from a.responseXML which comes from SPLISTCOLLECTION.getListItems
0
Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

 
LVL 5

Author Comment

by:Isaac
ID: 36484040
is there a way to find out what this looks like?
If I went to my list and did a view source and searched on "ows_OAC", would I find it?

Thanks for your help.
0
 
LVL 5

Author Comment

by:Isaac
ID: 36484058
I gues what I'm asking is, how do I view the DOM?
0
 
LVL 22

Expert Comment

by:pivar
ID: 36486768
I'm not a Sharepoint expert, but reading the code I assume you get a xml document from SPLISTCOLLECTION.getListItems (Sharepoint Lists?), and it's this xml you're querying for elements with tag "z:row". If you wan't to view this xml, you'll have to display it in your browser.
0

Featured Post

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question