D
DC
Hi,
in the file listed below I have to programmatically changes some
element values.
I am currently reading the document into an xmldocument, and then
locating the element to modify with xpath, then I change the element
in memory and write the entire document back to disk. I did not find a
more elegant way.
But once a default namespace apeared like in the example below,
everything broke. I certainly have to regard namespaces, but I think
there is no automatic handling in .net? I guess since I read and write
the whole document, I must examine all xmlns attributes and declare
them? Or is there maybe an easy way out?
TIA for any hints,
Regards
DC
xml version="1.0" encoding="utf-8"?>
<dataConfiguration>
<xmlSerializerSection>
<enterpriseLibrary.databaseSettings
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
defaultInstance="CmsContent"
xmlns="http://www.microsoft.com/practices/enterpriselibrary/
08-31-2004/data">
<databaseTypes>
<databaseType name="Sql Server" />
</databaseTypes>
<instances>
<instance name="Test" type="Sql Server"
connectionString="TestString" />
</instances>
<connectionStrings>
<connectionString name="TestString">
<parameters>
<parameter name="database" value="TestDB" />
<parameter name="server" value="TestServer" />
</parameters>
</connectionString>
</connectionStrings>
</enterpriseLibrary.databaseSettings>
</xmlSerializerSection>
</dataConfiguration>
in the file listed below I have to programmatically changes some
element values.
I am currently reading the document into an xmldocument, and then
locating the element to modify with xpath, then I change the element
in memory and write the entire document back to disk. I did not find a
more elegant way.
But once a default namespace apeared like in the example below,
everything broke. I certainly have to regard namespaces, but I think
there is no automatic handling in .net? I guess since I read and write
the whole document, I must examine all xmlns attributes and declare
them? Or is there maybe an easy way out?
TIA for any hints,
Regards
DC
xml version="1.0" encoding="utf-8"?>
<dataConfiguration>
<xmlSerializerSection>
<enterpriseLibrary.databaseSettings
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
defaultInstance="CmsContent"
xmlns="http://www.microsoft.com/practices/enterpriselibrary/
08-31-2004/data">
<databaseTypes>
<databaseType name="Sql Server" />
</databaseTypes>
<instances>
<instance name="Test" type="Sql Server"
connectionString="TestString" />
</instances>
<connectionStrings>
<connectionString name="TestString">
<parameters>
<parameter name="database" value="TestDB" />
<parameter name="server" value="TestServer" />
</parameters>
</connectionString>
</connectionStrings>
</enterpriseLibrary.databaseSettings>
</xmlSerializerSection>
</dataConfiguration>