V
vinoth
Hi,
I have created One Xml Structure using the following Code.
XmlDocument xd = new XmlDocument();
xd.LoadXml("<IPR><Test>123</Test><GSD>GSDINDIA</GSD></IPR>");
XmlElement xElem = xd.CreateElement("Personalization");
xElem.InnerXml = "<?xml version=\"1.0\"?><WrapClass
xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"
xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"><obj
xsi:type=\"DefinePersonalization\"><PersonalizationName>RestrictAccess</PersonalizationName><UserGroup><anyType
xsi:type=\"xsd:string\">administrator</anyType><anyType
xsi:type=\"xsd:string\">vinoth</anyType></UserGroup></obj></WrapClass>";
xd.DocumentElement.AppendChild(xElem);
Later i want to Load this XML. When i load this XML using LoadXml
method its giving the following error.
Error :
Unexpected XML declaration. The XML declaration must be the first node
in the document, and no white space characters are allowed to appear
before it.
How can i solve this problem? If anybody knows the solution please let
me know to solve it.
Thanks,
Vinoth
I have created One Xml Structure using the following Code.
XmlDocument xd = new XmlDocument();
xd.LoadXml("<IPR><Test>123</Test><GSD>GSDINDIA</GSD></IPR>");
XmlElement xElem = xd.CreateElement("Personalization");
xElem.InnerXml = "<?xml version=\"1.0\"?><WrapClass
xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"
xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"><obj
xsi:type=\"DefinePersonalization\"><PersonalizationName>RestrictAccess</PersonalizationName><UserGroup><anyType
xsi:type=\"xsd:string\">administrator</anyType><anyType
xsi:type=\"xsd:string\">vinoth</anyType></UserGroup></obj></WrapClass>";
xd.DocumentElement.AppendChild(xElem);
Later i want to Load this XML. When i load this XML using LoadXml
method its giving the following error.
Error :
Unexpected XML declaration. The XML declaration must be the first node
in the document, and no white space characters are allowed to appear
before it.
How can i solve this problem? If anybody knows the solution please let
me know to solve it.
Thanks,
Vinoth