Peter,

You are correct. Once I made the change as you recommended it seem to
work great.

Thanks, I didn't notice that missing '.' in the second statement. I
assumed from the command reference that once you get starting point,
it would use from that point forward. Well, you learn something new
every day.

Thanks for your help,

-Drew


On Sep 29, 7:11 pm, "Peter J. Farrell" <[email protected]> wrote:
>   Drew said the following on 09/29/2010 02:03 PM:
>
> > <cfset step1 = XMLSearch(returnXML, 
> > "//*[local-name()='StringBarCodes']").get(0)>
> > <cfset step2 = XMLSearch(step1, "//*[local-name()='Type']").get(0).XmlText>
>
> Your XPath isn't quite right.  The XPath/XML is case sensitive so:
>
> "//*[local-name()='StringBarCodes']"
>
> Needs to be (notice the lowercase "c") or it won't match anything in
> your XML package:
>
> "//*[local-name()='StringBarcodes']"
>
> Also, this expression:
>
> "//*[local-name()='Type']"
>
> Uses the local-name() XPath function. This returns the first node found
> which in this case is the COMMON_2D (it's the first node with v9:Type
> from the root of document).  This XPath is *not* searching from the
> point found in step1.  This is the case because you use the root //*
> directive which means it searches from the base node of the XML.  XML
> structures in CFML are passed by reference because they are underlaid by
> Java classes.  At this point, step1 is merely a pointer / reference to a
> section in the main XML node.  You'll need to use the current node
> directive of "." before your //* in order to reference from the match
> found in step1 or XPath looks from the root of the XML pacet.
>
> This works:
> <cfhttp url="http://www.technicalsynergy.com/XMLSample/fedExSample.xml"; />
>
> <cfset returnXml = XmlParse(cfhttp.fileContent) />
>
> <cfset step1 = XMLSearch(returnXML,
> "//*[local-name()='StringBarcodes']").get(0) />
> <cfset step2 =
> XMLSearch(step1,".//*[local-name()='Type']").get(0).xmlText />
>
> <cfdump var="#variables.step1#"/>
> <cfdump var="#variables.step2#"/>
>
> HTH,
> .Peter

-- 
Open BlueDragon Public Mailing List
 http://www.openbluedragon.org/   http://twitter.com/OpenBlueDragon
 official manual: http://www.openbluedragon.org/manual/
 Ready2Run CFML http://www.openbluedragon.org/openbdjam/

 mailing list - http://groups.google.com/group/openbd?hl=en

Reply via email to