Possible Duplicate:
Can I use predefined namespaces when loading an XDocument?
I have following xml nodes in a xml document:
<g:games>
</g:games>
But when this file comes to me it is missing namespace url. Is there a way to add the namespace url in .net 3.5? I am using Linq so using XDocument.Load command to load xml file.
In older version we can do this through xmlschema but its not working on XDocument?
It is true that what I suggested as an answer is unnecessarily complex. The code below should allow you to read your document:
Granted, it seems like a lot of work for very little, but the only other alternative would be to edit the XML file before loading it with
XDocument, but depending on where you are reading your file from (a network stream, for example), this could be an even more complicated option.