
Signature
thanks - dave
david_at_windward_dot_net
http://www.windwardreports.com
Cubicle Wars - http://www.windwardreports.com/film.htm
> I think the problem is two issues:
>
> 1) There is no default namespace set. I understand the issue if there is a
> default namespace and a name has to be assigned to it. But what of this case
> where there is no default?
You posted
<DaType Version="60.46.0.306">
<DaCustomer>
<Customer xmlns:i="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://ibs.entriq.net/Customers">
so there _is_ a default namespace declaration on Customer.
> 2) The namespace on the Customer element only applies to sub-elements of
> Customer - correct? But if I pass that as a namespace for the entire DOM then
> wouldn't that be incorrect?
If you are using an XmlNamespaceManager then you are simply managing
your XML namespace for the purpose of XPath evaluation. Obviously if
Customer is not the root element but has a default namespace declaration
then that applies only to Customer and its descendants (where xmlns is
not redefined). But for the purpose of the XmlNamespaceManager you need
to bind prefixes for all namespaces of elements you want to select.
Thus if you do
xmlNamespaceManagerInstance.AddNamespace("ic",
"http://ibs.entriq.net/Customers");
you are not hurting your XPath evaluation in general, you just need to
make sure that you use that prefix ic on the elements you are looking
for in that namespace so
//ic:Customer
is fine or
/DaType/DaCustomer/ic:Customer
is fine to select that Customer element
while
/ic:DaType
would not select anything then.
So you will need to find a strategy to generate prefixes and use and
apply them, but XmlNamespaceManager and its AddNamespace method do not
pose a problem in general if you have namespace declarations at various
levels of the XML.

Signature
Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
David Thielen - 27 Aug 2007 18:30 GMT
Ok, I think that makes sense to me.

Signature
thanks - dave
david_at_windward_dot_net
http://www.windwardreports.com
Cubicle Wars - http://www.windwardreports.com/film.htm
> > I think the problem is two issues:
> >
[quoted text clipped - 39 lines]
> pose a problem in general if you have namespace declarations at various
> levels of the XML.