webmasterbeta
New Member
Hello!
Ive got a configfile looking something like this:
name="test"
host="164.9.193.32"
protocol="1.2.3.4" port="89"
application="c:\test\test.exe"
useDefaultCredentials="false"
Im trying to update the config with this:
XmlNode node = null;
XmlNode attrNode = null;
for (int i = 0; i < nodeList.Count; i++)
{
node = nodeList.Item(i);
attrNode = node.Attributes.GetNamedItem("host", "");
attrNode.Value = NewHostValue;
attrNode = node.Attributes.GetNamedItem("port", "");
attrNode.Value = NewPortValue;
attrNode = node.Attributes.GetNamedItem("protocol", "");
attrNode.Value = NewProtocolValue;
attrNode = node.Attributes.GetNamedItem("application", "");
attrNode.Value = NewApplicationValue;
}
But after this is run the data comes out in a single row without newlines.
<assembly name="test" host="164.9.193.32" protocol="1.2.3.4" port="89" application="c:\test\test.exe" useDefaultCredentials="false" />
Im having a hard time coming up with a good way to keep the old look, anyone got an idea?
/regards
Ive got a configfile looking something like this:
name="test"
host="164.9.193.32"
protocol="1.2.3.4" port="89"
application="c:\test\test.exe"
useDefaultCredentials="false"
Im trying to update the config with this:
XmlNode node = null;
XmlNode attrNode = null;
for (int i = 0; i < nodeList.Count; i++)
{
node = nodeList.Item(i);
attrNode = node.Attributes.GetNamedItem("host", "");
attrNode.Value = NewHostValue;
attrNode = node.Attributes.GetNamedItem("port", "");
attrNode.Value = NewPortValue;
attrNode = node.Attributes.GetNamedItem("protocol", "");
attrNode.Value = NewProtocolValue;
attrNode = node.Attributes.GetNamedItem("application", "");
attrNode.Value = NewApplicationValue;
}
But after this is run the data comes out in a single row without newlines.
<assembly name="test" host="164.9.193.32" protocol="1.2.3.4" port="89" application="c:\test\test.exe" useDefaultCredentials="false" />
Im having a hard time coming up with a good way to keep the old look, anyone got an idea?
/regards