Search in sources :

Example 1 with SchemaLocationFilter

use of com.sun.xml.bind.marshaller.SchemaLocationFilter in project OpenAM by OpenRock.

the class MarshallerImpl method write.

private void write(XMLSerializable obj, ContentHandler writer) throws JAXBException {
    try {
        if (getSchemaLocation() != null || getNoNSSchemaLocation() != null) {
            // if we need to add xsi:schemaLocation or its brother,
            // throw in the component to do that.
            writer = new SchemaLocationFilter(getSchemaLocation(), getNoNSSchemaLocation(), writer);
        }
        SAXMarshaller serializer = new SAXMarshaller(writer, prefixMapper, this);
        // set a DocumentLocator that doesn't provide any information
        writer.setDocumentLocator(new LocatorImpl());
        writer.startDocument();
        serializer.childAsBody(obj, null);
        writer.endDocument();
        // extra check
        serializer.reconcileID();
    } catch (SAXException e) {
        throw new MarshalException(e);
    }
}
Also used : SchemaLocationFilter(com.sun.xml.bind.marshaller.SchemaLocationFilter) MarshalException(javax.xml.bind.MarshalException) LocatorImpl(org.xml.sax.helpers.LocatorImpl) SAXException(org.xml.sax.SAXException)

Example 2 with SchemaLocationFilter

use of com.sun.xml.bind.marshaller.SchemaLocationFilter in project OpenAM by OpenRock.

the class MarshallerImpl method write.

private void write(XMLSerializable obj, ContentHandler writer) throws JAXBException {
    try {
        if (getSchemaLocation() != null || getNoNSSchemaLocation() != null) {
            // if we need to add xsi:schemaLocation or its brother,
            // throw in the component to do that.
            writer = new SchemaLocationFilter(getSchemaLocation(), getNoNSSchemaLocation(), writer);
        }
        SAXMarshaller serializer = new SAXMarshaller(writer, prefixMapper, this);
        // set a DocumentLocator that doesn't provide any information
        writer.setDocumentLocator(new LocatorImpl());
        writer.startDocument();
        serializer.childAsBody(obj, null);
        writer.endDocument();
        // extra check
        serializer.reconcileID();
    } catch (SAXException e) {
        throw new MarshalException(e);
    }
}
Also used : SchemaLocationFilter(com.sun.xml.bind.marshaller.SchemaLocationFilter) MarshalException(javax.xml.bind.MarshalException) LocatorImpl(org.xml.sax.helpers.LocatorImpl) SAXException(org.xml.sax.SAXException)

Example 3 with SchemaLocationFilter

use of com.sun.xml.bind.marshaller.SchemaLocationFilter in project OpenAM by OpenRock.

the class MarshallerImpl method write.

private void write(XMLSerializable obj, ContentHandler writer) throws JAXBException {
    try {
        if (getSchemaLocation() != null || getNoNSSchemaLocation() != null) {
            // if we need to add xsi:schemaLocation or its brother,
            // throw in the component to do that.
            writer = new SchemaLocationFilter(getSchemaLocation(), getNoNSSchemaLocation(), writer);
        }
        SAXMarshaller serializer = new SAXMarshaller(writer, prefixMapper, this);
        // set a DocumentLocator that doesn't provide any information
        writer.setDocumentLocator(new LocatorImpl());
        writer.startDocument();
        serializer.childAsBody(obj, null);
        writer.endDocument();
        // extra check
        serializer.reconcileID();
    } catch (SAXException e) {
        throw new MarshalException(e);
    }
}
Also used : SchemaLocationFilter(com.sun.xml.bind.marshaller.SchemaLocationFilter) MarshalException(javax.xml.bind.MarshalException) LocatorImpl(org.xml.sax.helpers.LocatorImpl) SAXException(org.xml.sax.SAXException)

Example 4 with SchemaLocationFilter

use of com.sun.xml.bind.marshaller.SchemaLocationFilter in project Payara by payara.

the class MarshallerImpl method write.

private void write(XMLSerializable obj, ContentHandler writer) throws JAXBException {
    try {
        if (getSchemaLocation() != null || getNoNSSchemaLocation() != null) {
            // if we need to add xsi:schemaLocation or its brother,
            // throw in the component to do that.
            writer = new SchemaLocationFilter(getSchemaLocation(), getNoNSSchemaLocation(), writer);
        }
        SAXMarshaller serializer = new SAXMarshaller(writer, prefixMapper, this);
        // set a DocumentLocator that doesn't provide any information
        writer.setDocumentLocator(new LocatorImpl());
        writer.startDocument();
        serializer.childAsBody(obj, null);
        writer.endDocument();
        // extra check
        serializer.reconcileID();
    } catch (SAXException e) {
        throw new MarshalException(e);
    }
}
Also used : SchemaLocationFilter(com.sun.xml.bind.marshaller.SchemaLocationFilter) MarshalException(javax.xml.bind.MarshalException) LocatorImpl(org.xml.sax.helpers.LocatorImpl) SAXException(org.xml.sax.SAXException)

Example 5 with SchemaLocationFilter

use of com.sun.xml.bind.marshaller.SchemaLocationFilter in project OpenAM by OpenRock.

the class MarshallerImpl method write.

private void write(XMLSerializable obj, ContentHandler writer) throws JAXBException {
    try {
        if (getSchemaLocation() != null || getNoNSSchemaLocation() != null) {
            // if we need to add xsi:schemaLocation or its brother,
            // throw in the component to do that.
            writer = new SchemaLocationFilter(getSchemaLocation(), getNoNSSchemaLocation(), writer);
        }
        SAXMarshaller serializer = new SAXMarshaller(writer, prefixMapper, this);
        // set a DocumentLocator that doesn't provide any information
        writer.setDocumentLocator(new LocatorImpl());
        writer.startDocument();
        serializer.childAsBody(obj, null);
        writer.endDocument();
        // extra check
        serializer.reconcileID();
    } catch (SAXException e) {
        throw new MarshalException(e);
    }
}
Also used : SchemaLocationFilter(com.sun.xml.bind.marshaller.SchemaLocationFilter) MarshalException(javax.xml.bind.MarshalException) LocatorImpl(org.xml.sax.helpers.LocatorImpl) SAXException(org.xml.sax.SAXException)

Aggregations

SchemaLocationFilter (com.sun.xml.bind.marshaller.SchemaLocationFilter)5 MarshalException (javax.xml.bind.MarshalException)5 SAXException (org.xml.sax.SAXException)5 LocatorImpl (org.xml.sax.helpers.LocatorImpl)5