I have some XML that has a namespace..
<batch xmlns="http://www.mydomain.uk/batch" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="applications.xsd">
    <header>
        ...
    </header>
    <applications>
        <application>
            <details>
                <Title>MR</Title>
                <Forename>Jonathh</Forename>
                <Middlenames>
                    <Middlename>on</Middlename>
                    <Middlename>ath</Middlename>
                </Middlenames>
                <PresentSurname>H</PresentSurname>
            </details>
        </application>
    </applications>
</batch>
I am need to pull out the applications.. which I am able to do - but only by specifying the namespace..
var namespaceManager = new XmlNamespaceManager(doc.NameTable);
namespaceManager.AddNamespace("eb", "http://www.mydomain.uk/batch");
var protectedElement = doc.SelectSingleNode("/eb:batch/eb:applications", namespaceManager);
The problem for me is that the namespace then propagates down to the selected node E.G.
<applications xmlns="http://www.mydomain.uk/batch">
    <application>
        <details>
            <Title>MR</Title>
            <Forename>Jonathh</Forename>
            <Middlenames>
                <Middlename>on</Middlename>
                <Middlename>ath</Middlename>
            </Middlenames>
            <PresentSurname>H</PresentSurname>
        </details>
    </application>
</applications>
Note the sneaky little xmlns in the applications tag now.. that wasn't there before.. I've tried all sorts of things to remove..
I am so desperate I am considering a regular expression instead (I know!) - which I actually don't think would be too awful here....
Anyone got any suggestions?