xmltextwriter - ERROR-- Token StartDocument in state End Document would result in an invalid XML document -
i want create xml file below code ..can focus me olution.i searched on error message not find relavent.
code:-
stringbuilder builder = new stringbuilder(); using (stringwriter stringwriter = new stringwriter(builder)) { using (xmltextwriter writer = new xmltextwriter(stringwriter)) { xmlwritersettings settings = new xmlwritersettings(); settings.indent = true; settings.omitxmldeclaration = false; writer.writestartdocument(); writer.writestartelement("xsl:output",""); writer.writeattributestring("method", "xml"); writer.writeattributestring("indent", "yes"); writer.writeendelement(); writer.writestartelement(fihrdocument, ""); writer.writestartelement("xsl:value-of",""); writer.writeattributestring("select", results.link); writer.writeendelement(); writer.writeendelement(); writer.writeenddocument(); writer.close(); } } return builder.tostring(); }
error:-
token startdocument in state end document result in invalid xml document
thanks
Comments
Post a Comment