Note that there are some explanatory texts on larger screens.

plurals
  1. POXML Element with Variable Attributes
    primarykey
    data
    text
    <p>I"m pulling down data from GetListItems using SP Web Services. I want as much data as possible since I'm storing that off into a local XML document. I'm also trying to create a TSV from the data.</p> <p>The returned XML is something like this:</p> <pre><code>&lt;rs:data ItemCount="896" xmlns:rs="urn:schemas-microsoft-com:rowset"&gt; &lt;z:row ows_A="1" ows_B="2" xmlns:z="#RowsetSchema" /&gt; </code></pre> <p>There's actually closer to 60+ attributes per row, and the problem is the returned attributes per "row" aren't consistent (e.g. some have 60, some have 67, some have 59, etc).</p> <p>If I explicitly ask for the attributes by name, it's not a big deal:</p> <pre><code>foreach (System.Xml.XmlNode listItem in nodeListItems) { if (listItem.Name == "rs:data") { for (int i = 0; i &lt; listItem.ChildNodes.Count; i++) { if (listItem.ChildNodes[i].Name == "z:row") { wtSr.Append(listItem.ChildNodes[i].Attributes["ows_Title"].Value); wtSr.Append("\t"); </code></pre> <p>etc, etc.</p> <p>I tried parsing through all the attributes using something like </p> <pre><code>for (int k = 0; k &lt; listItem.ChildNodes[i].Attributes.Count; k++) { tmpWtCol = listItem.ChildNodes[i].Attributes[k].Name.ToString().Replace("ows_", string.Empty).Replace("_", string.Empty); wtSr.Append(tmpWtCol + "\t"); wtDidHeaders = true; } </code></pre> <p>to get the possible attributes, but I realized it would only pick up the first row, which may or may not have the maximum attributes possible. I thought about parsing through the entire thing. Though it's unlikely, I also have no real way of knowing if the "biggest count" row contains every combination. </p> <p>Is there a more elegant solution to with "null" (missing) attributes and determining all the attributes to create an acceptable "column list"?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload