use of com.sun.xml.txw2.output.XmlSerializer in project metro-jax-ws by eclipse-ee4j.
the class WSDLGenerator method doGeneration.
/**
* Performes the actual WSDL generation
*/
public void doGeneration() {
XmlSerializer serviceWriter;
XmlSerializer portWriter = null;
String fileName = mangleName(model.getServiceQName().getLocalPart());
Result result = wsdlResolver.getWSDL(fileName + DOT_WSDL);
wsdlLocation = result.getSystemId();
serviceWriter = new CommentFilter(ResultFactory.createSerializer(result));
if (model.getServiceQName().getNamespaceURI().equals(model.getTargetNamespace())) {
portWriter = serviceWriter;
schemaPrefix = fileName + "_";
} else {
String wsdlName = mangleName(model.getPortTypeName().getLocalPart());
if (wsdlName.equals(fileName))
wsdlName += "PortType";
Holder<String> absWSDLName = new Holder<>();
absWSDLName.value = wsdlName + DOT_WSDL;
result = wsdlResolver.getAbstractWSDL(absWSDLName);
if (result != null) {
portWSDLID = result.getSystemId();
if (portWSDLID.equals(wsdlLocation)) {
portWriter = serviceWriter;
} else {
portWriter = new CommentFilter(ResultFactory.createSerializer(result));
}
} else {
portWSDLID = absWSDLName.value;
}
schemaPrefix = new java.io.File(portWSDLID).getName();
int idx = schemaPrefix.lastIndexOf('.');
if (idx > 0)
schemaPrefix = schemaPrefix.substring(0, idx);
schemaPrefix = mangleName(schemaPrefix) + "_";
}
generateDocument(serviceWriter, portWriter);
}
use of com.sun.xml.txw2.output.XmlSerializer in project jaxb-ri by eclipse-ee4j.
the class TXW method create.
/**
* Creates a new {@link TypedXmlWriter} to write a new instance of a document.
*
* @param <T> an instance of {@link TypedXmlWriter}
* @param rootElement
* The {@link TypedXmlWriter} interface that declares the content model of the root element.
* This interface must have {@link XmlElement} annotation on it to designate the tag name
* of the root element.
* @param out
* The target of the writing.
* @return
* always return non-null {@link TypedXmlWriter} that can be used
* to write the contents of the root element.
*/
public static <T extends TypedXmlWriter> T create(Class<T> rootElement, XmlSerializer out) {
if (out instanceof TXWSerializer) {
TXWSerializer txws = (TXWSerializer) out;
return txws.txw._element(rootElement);
}
Document doc = new Document(out);
QName n = getTagName(rootElement);
return new ContainerElement(doc, null, n.getNamespaceURI(), n.getLocalPart())._cast(rootElement);
}
Aggregations