R
raghudr
<?xml version="1.0" standalone="yes" ?>
- <AddressSpace xsi:noNamespaceSchemaLocation="prince.xsd" Name="U2"
ConfigMax="1" xmlns:xsi="http://www.rag.org/2001/XMLSchema-instance">
<Item Name="raj" VALUE="60864"/>
<Item Name="rag" VALUE="60868" />
</AddressSpace>
Hi all,
problem i am struck:- I want to copy only Root element and
put it in another .xml file.
only this i want to copy and put in another .xml file:
<AddressSpace xsi:noNamespaceSchemaLocation="prince.xsd" Name="U2"
ConfigMax="1" xmlns:xsi="http://www.rag.org/2001/XMLSchema-instance">
I can do it this way
XmlDocument xdoc = new XmlDocument();
xdoc.Load(filename);
string strfiletype =
xdoc.DocumentElement.GetAttribute("xsi:noNamespaceSchemaLocation".ToString());
string strName =
xdoc.DocumentElement.GetAttribute("Name".ToString());
string strConfigMax =
xdoc.DocumentElement.GetAttribute("ConfigMax".ToString());
....
and then use setattribute to write to a new .xml file.
XmlDocument docXML = new XmlDocument();
docXML.Load(new file);
docXML .DocumentElement.SetAttribute("ConfigMax", strConfigMax);
But my rootelement keeps changing and all the times i may not
know the attribute name
hence i want to copy only rootelement without using any names and put
it in a new .xml file.
please help me on this
thanks in advance
RAGHU
- <AddressSpace xsi:noNamespaceSchemaLocation="prince.xsd" Name="U2"
ConfigMax="1" xmlns:xsi="http://www.rag.org/2001/XMLSchema-instance">
<Item Name="raj" VALUE="60864"/>
<Item Name="rag" VALUE="60868" />
</AddressSpace>
Hi all,
problem i am struck:- I want to copy only Root element and
put it in another .xml file.
only this i want to copy and put in another .xml file:
<AddressSpace xsi:noNamespaceSchemaLocation="prince.xsd" Name="U2"
ConfigMax="1" xmlns:xsi="http://www.rag.org/2001/XMLSchema-instance">
I can do it this way
XmlDocument xdoc = new XmlDocument();
xdoc.Load(filename);
string strfiletype =
xdoc.DocumentElement.GetAttribute("xsi:noNamespaceSchemaLocation".ToString());
string strName =
xdoc.DocumentElement.GetAttribute("Name".ToString());
string strConfigMax =
xdoc.DocumentElement.GetAttribute("ConfigMax".ToString());
....
and then use setattribute to write to a new .xml file.
XmlDocument docXML = new XmlDocument();
docXML.Load(new file);
docXML .DocumentElement.SetAttribute("ConfigMax", strConfigMax);
But my rootelement keeps changing and all the times i may not
know the attribute name
hence i want to copy only rootelement without using any names and put
it in a new .xml file.
please help me on this
thanks in advance
RAGHU