XML Schema depends on namespaces.
Document.createElement()
and
Element.setAttribute()
create non-namespace-aware element and attribute nodes which are missing a local name and namespace URI. You should never use the DOM Level 1 non-namespace factory methods with a DOM containing namespace-aware nodes (or with APIs expecting namespace-aware nodes). New element/attribute nodes should be created by calling
Document.createElementNS()
[1] and
Element.setAttributeNS()
[2].
e.g.
Change:
document.createElement("s:import")
To:
document.createElementNS("http://www.w3.org/2001/XMLSchema", "s:import")
[1]
http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#ID-DocCrElNS
[2]
http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#ID-ElSetAttrNS
[that is from the FIRST answer on google!]