/**
* Set up <schema> namespaces appropriately and append that attr
* into specified element
*/
private Element setupNamespaces(Document schemaDocs, XmlSchema schemaObj) {
NamespacePrefixList ctx = schemaObj.getNamespaceContext();
schemaObj.schema_ns_prefix = xsdPrefix = ctx.getPrefix(xsdNamespace);
if(xsdPrefix == null) {
schemaObj.schema_ns_prefix = xsdPrefix = "";
}
String[] prefixes = ctx.getDeclaredPrefixes();
for (int i = 0; i < prefixes.length; i++) {
String prefix = prefixes[i];
String uri = ctx.getNamespaceURI(prefix);
schema_ns.put(uri, prefix);
}
//for schema that not set the xmlns attrib member
if (schema_ns.get(xsdNamespace) == null) {
schema_ns.put(xsdNamespace, xsdPrefix);