Search in sources :

Example 1 with WrapperComposite

use of com.sun.xml.ws.spi.db.WrapperComposite in project metro-jax-ws by eclipse-ee4j.

the class WrapperBond method marshal.

@Override
public final void marshal(T object, XMLStreamWriter output, AttachmentMarshaller am) throws JAXBException {
    WrapperComposite w = (WrapperComposite) object;
    try {
        // output.writeStartElement(typeInfo.tagName.getNamespaceURI(), typeInfo.tagName.getLocalPart());
        // System.out.println(typeInfo.tagName.getNamespaceURI());
        // The prefix is to workaround an eclipselink bug
        output.writeStartElement(WrapperPrefix, typeInfo.tagName.getLocalPart(), typeInfo.tagName.getNamespaceURI());
        output.writeNamespace(WrapperPrefix, typeInfo.tagName.getNamespaceURI());
    // output.writeStartElement("", typeInfo.tagName.getLocalPart(), typeInfo.tagName.getNamespaceURI());
    // output.writeDefaultNamespace(typeInfo.tagName.getNamespaceURI());
    // System.out.println("======== " + output.getPrefix(typeInfo.tagName.getNamespaceURI()));
    // System.out.println("======== " + output.getNamespaceContext().getPrefix(typeInfo.tagName.getNamespaceURI()));
    // System.out.println("======== " + output.getNamespaceContext().getNamespaceURI(""));
    } catch (XMLStreamException e) {
        e.printStackTrace();
        throw new DatabindingException(e);
    }
    if (w.bridges != null)
        for (int i = 0; i < w.bridges.length; i++) {
            if (w.bridges[i] instanceof RepeatedElementBridge) {
                RepeatedElementBridge rbridge = (RepeatedElementBridge) w.bridges[i];
                for (Iterator itr = rbridge.collectionHandler().iterator(w.values[i]); itr.hasNext(); ) {
                    rbridge.marshal(itr.next(), output, am);
                }
            } else {
                w.bridges[i].marshal(w.values[i], output, am);
            }
        }
    try {
        output.writeEndElement();
    } catch (XMLStreamException e) {
        throw new DatabindingException(e);
    }
}
Also used : DatabindingException(com.sun.xml.ws.spi.db.DatabindingException) RepeatedElementBridge(com.sun.xml.ws.spi.db.RepeatedElementBridge) XMLStreamException(javax.xml.stream.XMLStreamException) Iterator(java.util.Iterator) WrapperComposite(com.sun.xml.ws.spi.db.WrapperComposite)

Example 2 with WrapperComposite

use of com.sun.xml.ws.spi.db.WrapperComposite in project metro-jax-ws by eclipse-ee4j.

the class WrapperBond method marshal.

@Override
public final void marshal(T object, XMLStreamWriter output, AttachmentMarshaller am) throws JAXBException {
    WrapperComposite w = (WrapperComposite) object;
    try {
        // output.writeStartElement(typeInfo.tagName.getNamespaceURI(), typeInfo.tagName.getLocalPart());
        // System.out.println(typeInfo.tagName.getNamespaceURI());
        // The prefix is to workaround an eclipselink bug
        output.writeStartElement(WrapperPrefix, typeInfo.tagName.getLocalPart(), typeInfo.tagName.getNamespaceURI());
        output.writeNamespace(WrapperPrefix, typeInfo.tagName.getNamespaceURI());
    // output.writeStartElement("", typeInfo.tagName.getLocalPart(), typeInfo.tagName.getNamespaceURI());
    // output.writeDefaultNamespace(typeInfo.tagName.getNamespaceURI());
    // System.out.println("======== " + output.getPrefix(typeInfo.tagName.getNamespaceURI()));
    // System.out.println("======== " + output.getNamespaceContext().getPrefix(typeInfo.tagName.getNamespaceURI()));
    // System.out.println("======== " + output.getNamespaceContext().getNamespaceURI(""));
    } catch (XMLStreamException e) {
        // e.printStackTrace();
        throw new DatabindingException(e);
    }
    if (w.bridges != null) {
        for (int i = 0; i < w.bridges.length; i++) {
            // System.out.println("======== bond " + w.bridges[i].getTypeInfo().tagName);
            w.bridges[i].marshal(w.values[i], output, am);
        }
    }
    try {
        output.writeEndElement();
    } catch (XMLStreamException e) {
        throw new DatabindingException(e);
    }
}
Also used : DatabindingException(com.sun.xml.ws.spi.db.DatabindingException) XMLStreamException(javax.xml.stream.XMLStreamException) WrapperComposite(com.sun.xml.ws.spi.db.WrapperComposite)

Example 3 with WrapperComposite

use of com.sun.xml.ws.spi.db.WrapperComposite in project metro-jax-ws by eclipse-ee4j.

the class WrapperBond method marshal.

@Override
public final void marshal(T object, ContentHandler contentHandler, AttachmentMarshaller am) throws JAXBException {
    WrapperComposite w = (WrapperComposite) object;
    Attributes att = new Attributes() {

        @Override
        public int getLength() {
            return 0;
        }

        @Override
        public String getURI(int index) {
            return null;
        }

        @Override
        public String getLocalName(int index) {
            return null;
        }

        @Override
        public String getQName(int index) {
            return null;
        }

        @Override
        public String getType(int index) {
            return null;
        }

        @Override
        public String getValue(int index) {
            return null;
        }

        @Override
        public int getIndex(String uri, String localName) {
            return 0;
        }

        @Override
        public int getIndex(String qName) {
            return 0;
        }

        @Override
        public String getType(String uri, String localName) {
            return null;
        }

        @Override
        public String getType(String qName) {
            return null;
        }

        @Override
        public String getValue(String uri, String localName) {
            return null;
        }

        @Override
        public String getValue(String qName) {
            return null;
        }
    };
    try {
        contentHandler.startPrefixMapping(WrapperPrefix, typeInfo.tagName.getNamespaceURI());
        contentHandler.startElement(typeInfo.tagName.getNamespaceURI(), typeInfo.tagName.getLocalPart(), WrapperPrefixColon + typeInfo.tagName.getLocalPart(), att);
    } catch (SAXException e) {
        throw new JAXBException(e);
    }
    if (w.bridges != null) {
        for (int i = 0; i < w.bridges.length; i++) {
            w.bridges[i].marshal(w.values[i], contentHandler, am);
        }
    }
    try {
        contentHandler.endElement(typeInfo.tagName.getNamespaceURI(), typeInfo.tagName.getLocalPart(), null);
        contentHandler.endPrefixMapping(WrapperPrefix);
    } catch (SAXException e) {
        throw new JAXBException(e);
    }
// bridge.marshal(object, contentHandler, am);
}
Also used : JAXBException(jakarta.xml.bind.JAXBException) Attributes(org.xml.sax.Attributes) WrapperComposite(com.sun.xml.ws.spi.db.WrapperComposite) SAXException(org.xml.sax.SAXException)

Example 4 with WrapperComposite

use of com.sun.xml.ws.spi.db.WrapperComposite in project metro-jax-ws by eclipse-ee4j.

the class WrapperBridge method convert.

static CompositeStructure convert(Object o) {
    WrapperComposite w = (WrapperComposite) o;
    CompositeStructure cs = new CompositeStructure();
    cs.values = w.values;
    cs.bridges = new Bridge[w.bridges.length];
    for (int i = 0; i < cs.bridges.length; i++) {
        cs.bridges[i] = ((BridgeWrapper) w.bridges[i]).getBridge();
    }
    return cs;
}
Also used : CompositeStructure(org.glassfish.jaxb.runtime.api.CompositeStructure) WrapperComposite(com.sun.xml.ws.spi.db.WrapperComposite)

Example 5 with WrapperComposite

use of com.sun.xml.ws.spi.db.WrapperComposite in project metro-jax-ws by eclipse-ee4j.

the class WrapperBond method marshal.

@Override
public final void marshal(T object, ContentHandler contentHandler, AttachmentMarshaller am) throws JAXBException {
    WrapperComposite w = (WrapperComposite) object;
    Attributes att = new Attributes() {

        @Override
        public int getLength() {
            return 0;
        }

        @Override
        public String getURI(int index) {
            return null;
        }

        @Override
        public String getLocalName(int index) {
            return null;
        }

        @Override
        public String getQName(int index) {
            return null;
        }

        @Override
        public String getType(int index) {
            return null;
        }

        @Override
        public String getValue(int index) {
            return null;
        }

        @Override
        public int getIndex(String uri, String localName) {
            return 0;
        }

        @Override
        public int getIndex(String qName) {
            return 0;
        }

        @Override
        public String getType(String uri, String localName) {
            return null;
        }

        @Override
        public String getType(String qName) {
            return null;
        }

        @Override
        public String getValue(String uri, String localName) {
            return null;
        }

        @Override
        public String getValue(String qName) {
            return null;
        }
    };
    try {
        contentHandler.startElement(typeInfo.tagName.getNamespaceURI(), typeInfo.tagName.getLocalPart(), WrapperPrefix_ + typeInfo.tagName.getLocalPart(), att);
    } catch (SAXException e) {
        throw new JAXBException(e);
    }
    if (w.bridges != null)
        for (int i = 0; i < w.bridges.length; i++) {
            if (w.bridges[i] instanceof RepeatedElementBridge) {
                RepeatedElementBridge rbridge = (RepeatedElementBridge) w.bridges[i];
                for (Iterator itr = rbridge.collectionHandler().iterator(w.values[i]); itr.hasNext(); ) {
                    rbridge.marshal(itr.next(), contentHandler, am);
                }
            } else {
                w.bridges[i].marshal(w.values[i], contentHandler, am);
            }
        }
    try {
        contentHandler.endElement(typeInfo.tagName.getNamespaceURI(), typeInfo.tagName.getLocalPart(), null);
    } catch (SAXException e) {
        throw new JAXBException(e);
    }
// bridge.marshal(object, contentHandler, am);
}
Also used : RepeatedElementBridge(com.sun.xml.ws.spi.db.RepeatedElementBridge) JAXBException(jakarta.xml.bind.JAXBException) Attributes(org.xml.sax.Attributes) Iterator(java.util.Iterator) WrapperComposite(com.sun.xml.ws.spi.db.WrapperComposite) SAXException(org.xml.sax.SAXException)

Aggregations

WrapperComposite (com.sun.xml.ws.spi.db.WrapperComposite)5 DatabindingException (com.sun.xml.ws.spi.db.DatabindingException)2 RepeatedElementBridge (com.sun.xml.ws.spi.db.RepeatedElementBridge)2 JAXBException (jakarta.xml.bind.JAXBException)2 Iterator (java.util.Iterator)2 XMLStreamException (javax.xml.stream.XMLStreamException)2 Attributes (org.xml.sax.Attributes)2 SAXException (org.xml.sax.SAXException)2 CompositeStructure (org.glassfish.jaxb.runtime.api.CompositeStructure)1