Hello,
i have problems with the Namespaces and the .Net XML Parser
My XML looks like this:
<query xmlns="jabber:iq:roster">
<item jid="srlee@localhost" name="srlee"
subscription="both"><group>contacts</group></item>
<item jid="tlee@localhost" name="Troy"
subscription="both"><group>contacts</group></item>
<item jid="bglee@localhost" name="Barry"
subscription="both"><group>contacts</group></item>
<item jid="dslee@localhost" name="Debbie"
subscription="both"><group>contacts</group></item>
</query>
Now i select nodes with SelectNodes. Sometimes i change or add some
attributes to the selected node. The XML is located in a normal
XmlDocument Object (doc).
XmlNamespaceManager nsmgr = new XmlNamespaceManager(doc.NameTable);
nsmgr.AddNamespace("foo", "jabber:iq:roster" );
XmlNode nItem = doc.SelectSingleNode(
"//foo:item[@jid='srlee@localhost']", nsmgr );
Now when i look at the OuterXml of the selected node i get the
following:
<item jid="srlee@localhost" name="srlee" subscription="both"
xmlns="jabber:iq:roster"><group
xmlns="jabber:iq:roster">contacts</group></item>
The parser adds the Namespace to every tag. Thats very very bad for my
applciation. I wanna have the raw XM here. Is there a way to get this
node without the added namespaces? In the old COM MSXML 2-4 parsers i
never had this problems. Is there a way to tell the parser to handle the
namespaces like normal attribbutes? Or to ignore them? They make me only
trouble. Has anybody a idea or similar problems ?
Thanx Alex
--
AG Software
Alexander Gnauck
Wiesental 3
74182 Obersulm
gnauck(at)ag-software.de
http://www.ag-software.de