01: package org.objectweb.celtix.tools.extensions.xmlformat;
02:
03: import java.io.PrintWriter;
04:
05: import javax.wsdl.Definition;
06: import javax.wsdl.WSDLException;
07: import javax.wsdl.extensions.ExtensibilityElement;
08: import javax.wsdl.extensions.ExtensionDeserializer;
09: import javax.wsdl.extensions.ExtensionRegistry;
10: import javax.wsdl.extensions.ExtensionSerializer;
11: import javax.xml.namespace.QName;
12:
13: import org.w3c.dom.Element;
14:
15: import org.objectweb.celtix.helpers.XMLUtils;
16:
17: public class XMLFormatBindingSerializer implements
18: ExtensionDeserializer, ExtensionSerializer {
19:
20: XMLUtils xmlUtils = new XMLUtils();
21:
22: public void marshall(Class parentType, QName elementType,
23: ExtensibilityElement extension, PrintWriter pw,
24: Definition def, ExtensionRegistry extReg)
25: throws WSDLException {
26:
27: pw.print("<" + xmlUtils.writeQName(def, elementType) + "/>");
28: pw.println();
29: }
30:
31: public ExtensibilityElement unmarshall(Class parentType,
32: QName elementType, Element el, Definition def,
33: ExtensionRegistry extReg) throws WSDLException {
34:
35: XMLFormatBinding xmlFormatBinding = (XMLFormatBinding) extReg
36: .createExtension(parentType, elementType);
37: xmlFormatBinding.setElement(el);
38: xmlFormatBinding.setElementType(elementType);
39: xmlFormatBinding.setDocumentBaseURI(def.getDocumentBaseURI());
40: return xmlFormatBinding;
41: }
42:
43: }
|