How to add schemaLocation and xmlns:xsi with XmlBeans
Hello!I need to add:
xsi:schemaLocation
xmlns:xsi
...with XmlBeans into a xml doc.
I found this code:
XmlCursor xmlCursor = doc.newCursor();
if(xmlCursor.toFirstChild())
{
xmlCursor.setAttributeText( new QName("http://myapp.se/schema/a/b/c/x/v7", "schemaLocation"), "http://myapp.se/schema/a/b/c/x/v7/a_x.xsd");
}
It should look like:
<v7:a
tid="2009-02-26T13:48:16.656+01:00"
transid="12345"
xmlns:v7="http://myapp.se/schema/a/b/c/x/v7"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://myapp.se/schema/a/b/c/x/v7 http://myapp.se/schema/a/b/c/x/v7/a_x.xsd">
...
But I get:
<v7:a
tid="2009-02-27T09:55:53.906+01:00"
transid="12345"
v7:schemaLocation="http://myapp.se/schema/a/b/c/x/v7/a_x.xsd"
xmlns:v7="http://myapp.se/schema/a/b/c/x/v7">
...
It seems that I miss xmlns:xsi and completly, and the schemaLocation does not get the xsi: infront.
So if you guys got any ideas please let me know!
Best regards
Fredrik
