I'm having a similar problem. I've gotten around it by doing an
idiotic string replacement on the namespace declaration, but obviously
I'd like to do it "right."
Here's a sample XML:
<?xml version="1.0" encoding="iso-8859-1"?>
<adc_database xmlns="
http://www.accuweather.com" >
<citylist us="7" intl="1" extra_cities="0">
<location cnt="1" city="Waco" state="GA" location="30182"></
location>
<location cnt="2" city="Waco" state="KY" location="40385"></
location>
<location cnt="3" city="Waco" state="MO" location="64869"></
location>
<location cnt="4" city="Waco" state="NC" location="28169"></
location>
<location cnt="5" city="Waco" state="NE" location="68460"></
location>
<location cnt="6" city="Waco" state="TX" location="76701"></
location>
<location cnt="7" city="Waconia" state="MN" location="55387"></
location>
<location cnt="1" city="Waco" state="Canada(Quebec)"
location="NAM|CA|QC|Waco"></location>
</citylist>
<copyright>Copyright 2009 AccuWeather.com</copyright>
<use>This document is intended only for use by authorized licensees
of AccuWeather.com. Unauthorized use is prohibited. All Rights
Reserved.</use>
<product>dudefella</product>
<redistribution>Redistribution Prohibited.</redistribution>
</adc_database>
and here's the XPath:
//citylist/*
When I did this with NSXml, I was able to ignore the namespace --
everything "just worked." Under TouchXML, I had to add the following
commands to map the generic namespace:
NSDictionary * xmlMappings = [[NSDictionary alloc]
initWithObjectsAndKeys:@"
http://www.accuweather.com", @"pre", nil];
NSArray * xmlNodes = [[NSArray alloc] initWithArray:[xmlDoc
nodesForXPath:@"//pre:citylist/*" namespaceMappings:xmlMappings
error:&error] copyItems:NO];
... and of course the XPath had to be changed to address the new
namespace prefix. So.