Search code examples
javahtmlxmldomhtml-parsing

Dom namespace issue


I'm using the following code to update the root namespace

rootTreeNode.setAttributeNS("http://www.w3.org/2000/xmlns/" ,"xmlns:m", "http://schemas.microsoft.com/ado/2007/08/dataservices/metadata");

dataServices.setAttribute("m:DataServiceVersion", "2.0");

Im trying to create new XML file with java and in the XML which I try to create with dom code its look as follows:

xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"

when I open the file in visual studio i got error under the

m:DataServiceVersion
edmx:DataServices m:DataServiceVersion="2.0"

The error is:

the "http://schemas.microsoft.com/ado/2007/08/dataservices/metadata:DataServiceVersion" attribute is not declared .

what am I doing wrong here ?


Solution

  • That looks like Visual Studio is trying to validate the XML file against a schema that doesn't allow the m:DataServiceVersion attribute on that particular element. You can't fix this without changing the schema but you might be able to suppress it by telling VS not to try and validate, but I'm not sure how you would go about doing that.