xmlstarlet parse field from file

I have a xmlfile like this:

<?xml version="1.0" encoding="utf-8"?>
<contentlocation xmlns:yahoo="http://www.yahooapis.com/v1/base.rng" xmlns:xml="http://www.w3.org/XML/1998/namespace" xmlns="http://wherein.yahooapis.com/v1/schema" xml:lang="en">
    <processingTime>0.001538</processingTime>
    <version> build 091119</version>
    <documentLength>101</documentLength>
    <document>
        <administrativeScope>
            <woeId>2430456</woeId>
            <type>Town</type>
            <name><![CDATA[Kailua Kona, HI, US]]></name>
            <centroid>
                <latitude>19.6401</latitude>
                <longitude>-155.996</longitude>
            </centroid>
        </administrativeScope>
        <geographicScope>
            <woeId>12798285</woeId>
            <type>Zip</type>
            <name><![CDATA[96740, Kailua Kona, HI, US]]></name>
            <centroid>
                <latitude>19.7118</latitude>
                <longitude>-155.892</longitude>
            </centroid>
        </geographicScope> 
            <extents>
                <center>
                    <latitude>19.7</latitude>
                    <longitude>-155.9</longitude>
                       </center>
                <southWest>
                    <latitude>19.5288</latitude>
                    <longitude>-156.062</longitude>
                       </southWest>
                     <northEast>
                    <latitude>19.8984</latitude>
                    <longitude>-155.725</longitude>
                       </northEast>
            </extents>
               <placeDetails>
            <place>
                <woeId>12798285</woeId>
                <type>Zip</type>
                     <name><![CDATA[96740, Kailua Kona, HI, US]]></name>
                <centroid>
                    <latitude>19.7</latitude>
                    <longitude>-155.9</longitude>
                </centroid>
            </place>
                       <matchType>1</matchType>
                <weight>1</weight>
                <confidence>10</confidence>
               </placeDetails>
        <referenceList>
            <reference>
                <woeIds>12798285</woeIds>
                <start>-1</start>
                <end>-1</end>
                <isPlaintextMarker>0</isPlaintextMarker>
                <text><![CDATA[]]></text>
                <type>xpath</type>
                <xpath><![CDATA[/div[1]/span[2]]]></xpath>
            </reference>
        </referenceList>
    </document>
</contentlocation>

which is valid xml, according to xmlstarlet val xmfile, I'm trying to run a query like this:

xmlstarlet sel -t -m "//geographicScope" -v "name" -n xmlfile

but it's returning nothing, what am I doing wrong? I try a similar query on another type of xml file I have on this machine and it returns the right results.

---------- Post updated at 04:47 PM ---------- Previous update was at 02:35 PM ----------

got it working by piping to xml2, definitely not the best way I guess, but this works:

url=`curl --silent -X POST -ddocumentContent='<div class="geo">GEO: \
                <span class="latitude">'${lat}'</span>, <span class="longitude">'${lon}'</span></div>' \
                -ddocumentType='text/html' -dappid='myidat@yahoo.com' http://wherein.yahooapis.com/v1/document`
address=`echo $url | xml2 | grep contentlocation | grep document | grep geographicScope | grep name | cut -c48-`

had to get something working quick.

Remove the null prefix namespace declaration, i.e. xmlns="http://wherein.yahooapis.com/v1/schema", and your xmlstarlet query will work as expected.

By definition, a null prefix namespace declaration becomes the default namespace which means that the XPATH expressions generated by xmlstarlet will not work. This is not an xmlstarlet issue, you would also get no results if you wrote a XSL stylesheet to transform the XML document.