M
Martin
Hi,
I would appreciate some help with creating an xml node in a document and
automatically setting the default namespace
The code below loads an xmnldocument with a default namespace --
xmlns=""http://mydomain.org/schema.xsd""
however when i create a nod in it below the node come out with a blank
string set for the "xmlns" attribute.
can anybody suggest how to populate the attribute "xmlns" with
"http://mydomain.org/schema.xsd"
XmlDocument xmldoc = new XmlDocument() ;
xmldoc.LoadXml( @"<?xml version=""1.0"" encoding=""utf-8"" ?>
<root xmlns:xsd=""http://www.w3.org/2001/XMLSchema""
xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance""
xmlns=""http://mydomain.org/schema.xsd"">
</root>") ;
XmlNode AddNode;
AddNode = xmldoc.CreateElement( "Trial" ) ;
xmldoc.DocumentElement.AppendChild( AddNode ) ;
xmldoc.Save( Console.Out ) ;
many thanks in advance
cheers
martin.
I would appreciate some help with creating an xml node in a document and
automatically setting the default namespace
The code below loads an xmnldocument with a default namespace --
xmlns=""http://mydomain.org/schema.xsd""
however when i create a nod in it below the node come out with a blank
string set for the "xmlns" attribute.
can anybody suggest how to populate the attribute "xmlns" with
"http://mydomain.org/schema.xsd"
XmlDocument xmldoc = new XmlDocument() ;
xmldoc.LoadXml( @"<?xml version=""1.0"" encoding=""utf-8"" ?>
<root xmlns:xsd=""http://www.w3.org/2001/XMLSchema""
xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance""
xmlns=""http://mydomain.org/schema.xsd"">
</root>") ;
XmlNode AddNode;
AddNode = xmldoc.CreateElement( "Trial" ) ;
xmldoc.DocumentElement.AppendChild( AddNode ) ;
xmldoc.Save( Console.Out ) ;
many thanks in advance
cheers
martin.