Object dom;
if (obj instanceof XmlObjectBase) {
XmlObjectBase source = (XmlObjectBase)obj;
dom = source.newDomNode(options);
} else {
XmlTokenSource source = (XmlTokenSource)obj;
dom = source.newDomNode(options);
}
if (dom instanceof Document) {
org.w3c.dom.Element e = ((Document)dom).getDocumentElement();
StaxUtils.copy(e, output);
} else if (dom instanceof DocumentFragment) {
DocumentFragment frag = (DocumentFragment) dom;
Node node = frag.getFirstChild();
while (node != null) {
if (node instanceof Element) {
StaxUtils.copy((Element)node, output);
} else if (node instanceof Comment) {
output.writeComment(((Comment)node).getData());
} else if (node instanceof Text) {
output.writeCharacters(((Text)node).getData());
}
node = node.getNextSibling();
}
} else {
throw new Fault("Invalid document type returned: " + dom.toString(), LOG);
}
return;
}
XMLStreamReader reader;
if (obj instanceof XmlObjectBase) {
XmlObjectBase source = (XmlObjectBase)obj;
reader = source.newCursorForce().newXMLStreamReader(options);
} else {
XmlTokenSource source = (XmlTokenSource)obj;
reader = source.newCursor().newXMLStreamReader(options);
}
SchemaType st = (SchemaType)part.getProperty(SchemaType.class.getName());
if (st != null && !st.isDocumentType()) {
if (StringUtils.isEmpty(part.getConcreteName().getNamespaceURI())) {