Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

responseXML.getElementsByTagName("z:row")

Posted on 2011-09-02
6
Medium Priority
?
1,596 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 2000 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
What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

 
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

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

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…
In this blog, we’ll look at how improvements to Percona XtraDB Cluster improved IST performance.
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

926 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