Solved

responseXML.getElementsByTagName("z:row")

Posted on 2011-09-02
6
1,390 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
  • 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
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 
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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

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

These days socially coordinated efforts have turned into a critical requirement for enterprises.
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…
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…

813 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now