definitionCache.setType(DefinitionCacheTypeConfig.TEXT);
Map<String, XmlObject> urls = SchemaUtils.getDefinitionParts(loader);
definitionCache.setRootPart(baseUri);
for (Map.Entry<String, XmlObject> entry : urls.entrySet()) {
DefintionPartConfig definitionPart = definitionCache.addNewPart();
String url = entry.getKey();
definitionPart.setUrl(url);
XmlObject xmlObject = entry.getValue();
Node domNode = xmlObject.getDomNode();
if (domNode.getNodeType() == Node.DOCUMENT_FRAGMENT_NODE) {
Node node = ((DocumentFragment) domNode).getFirstChild();
if (node.getNodeType() == Node.TEXT_NODE) {
domNode = XmlUtils.parseXml(node.getNodeValue());
// xmlObject = XmlObject.Factory.parse( domNode );
xmlObject = XmlUtils.createXmlObject(domNode);
}
}
Element contentElement = ((Document) domNode).getDocumentElement();
Node newDomNode = definitionPart.addNewContent().getDomNode();
newDomNode.appendChild(newDomNode.getOwnerDocument().createTextNode(xmlObject.toString()));
definitionPart.setType(contentElement.getNamespaceURI());
}
initParts();
}