On 08/10/2008, Ed <[EMAIL PROTECTED]> wrote: > Thanks again for the reply. > > That's the section I'm referencing. Right after I posted, I tried the > /RootContents/ChildFolder[n]/@assetID syntax n my Xpath Extractor with no > luck, surprisingly. > > I tried using a specific index value [10], just to see if I could reference > one particular line, and still get "NONE", which is the default value if I > have no valid assetID. This seems pretty odd. > > The Loop Controller iterates the correct number of times, but I don't think > it allows any way to pass in the line index to the XPath Extractor. Is there > an automatic variable I can use as an index in the Loop Controller, or is > the For Each Controller the only one that will allow me to reference a > specific iteration index? > > The For Each controller seems like you have to specify a set of variables to > traverse rather then the simple > for (idx = 0; idx < totalResult; idx++) syntax I expected. The number of > iterations is unknown up front, so I'm not sure how I'd handle that one. >
The For Each Controller automatically loops the correct number of times: http://jakarta.apache.org/jmeter/usermanual/component_reference.html#ForEach_Controller Just make sure you use the same variable as the XPath Extractor. > I'm not sure I'm using the the Debug Sampler quite right. I put it in the > loop and it shows the assetID=098ew for each loop iteration which probably > means it's not being initialized in that scope. If I put it out side the > loop it shows one instance of assetID=098ew. Strange. Not strange, that's what you expect if you only match one entry. If it matches 2 entries, you might see something like: assetID=0cc80001 assetID_1=0cc80001 assetID_2=0cc80002 assetID_matchNr=2 which can be used by the For Each controller with input assetID Try it and see. BTW, the Java Request is quite useful for generating test data - just paste it into the ResultData field - or you can load a file using the HTTP sampler, just set the protocol to "file". > Thanks, > > Ed > > > > On Wed, Oct 8, 2008 at 3:12 PM, sebb <[EMAIL PROTECTED]> wrote: > > > On 08/10/2008, Ed <[EMAIL PROTECTED]> wrote: > > > I'm trying to iterate over the elements of an xml file and get the > > assetID > > > of each element. I'm able to get the assetID of the first element > > > "FolderProperties", but none of the rest. > > > > > > How do I get some loop controller to continue down the xml elements and > > > process each "ChildFolder" element? > > > > > > The XML looks like this: > > > > > > <RootContents totalResults="18"> > > > <FolderProperties assetID="0cc80002" barkerSourceID="23071" > > > displayName="Tier3" parentAssetID="0cc80001" parentProviderID="*" > > > providerID="*"/> > > > <ChildFolder assetID="0cc8011f" barkerSourceID="23071" > > displayName="Top > > > Picks" parentAssetID="0cc80002" parentProviderID="*" providerID="*"/> > > > <ChildFolder assetID="0cc80101" barkerSourceID="23071" > > > displayName="Movies & Events" parentAssetID="0cc80002" > > > parentProviderID="*" providerID="*"/> > > > ... > > > <ChildFolder assetID="0cc80a7e" barkerSourceID="23071" > > > displayName="RNG-Level1" parentAssetID="0cc80002" parentProviderID="*" > > > providerID="*"/> > > > <ChildFolder assetID="0cc80bfa" barkerSourceID="23071" > > displayName="All > > > Movies" parentAssetID="0cc80002" parentProviderID="*" providerID="*"/> > > > </RootContents> > > > > > > I'm able to get the first asetID with > > > /RootContents/FolderProperties/@assetID > > > > > > But when I try to get the rest in a Loop Controller with > > > /RootContents/ChildFolder/@assetID > > > > > > I get only the first one "<FolderProperties assetID="0cc800002"... > > > > Either use a loop counter: > > > > /RootContents/ChildFolder[n]/@assetID > > > > or use the XPath For Each feature, see: > > > > > > > http://jakarta.apache.org/jmeter/usermanual/component_reference.html#XPath_Extractor > > > > read the section just after the parameter descriptions. > > > > Use a Debug Sampler to see what variables have been defined. > > > > > Thanks, > > > > > > > > > > > > -- > > > > > > Ed > > > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > -- > > Ed > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

