Creating xml in c# -
hi creating xml programatically.i using namespace.in places dont need namespace , passing string.empty.my element names contains colon ex gd:city.the problem if passing null in third parameter of createelement in output getting city , not gd:city.how solve problem.i need o/p gd:city @ same time dont want pass namespace.
regards sanchaita chakraborty
you need use namespacemanager. like:
xmlnamespacemanager nsm = new xmlnamespacemanager(myxmldocument.nametable); nsm.addnamespace("gd", "http://mynamespacehere"); xmlnode nde = myxmldocument.createelement("gd", "newelement", "http://mynamespacehere");
edit : per other poster's comments, can't create element name containing colon (see w3spec here , tut on namespaces here). if element has colon (:), means using namespace - corresponding xmlns:gd="http://mynamespacehere" in parent node of city element (or city itself).
"gd" placeholder (called prefix) namespace. element city, in namespace - don't have complete xml message - prefix "gd" assigned.
Comments
Post a Comment