Search in sources :

Example 1 with LocatorImpl

use of org.xml.sax.helpers.LocatorImpl 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 LocatorImpl

use of org.xml.sax.helpers.LocatorImpl 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 LocatorImpl

use of org.xml.sax.helpers.LocatorImpl 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 LocatorImpl

use of org.xml.sax.helpers.LocatorImpl in project Asqatasun by Asqatasun.

the class JSContentAdapterImpl method startDocument.

/**
     * Event fired when the parse starts
     *
     * @throws SAXException
     * @see org.xml.sax.ContentHandler#startDocument()
     */
@Override
public void startDocument() throws SAXException {
    buffer = new StringBuffer();
    jsVector = new HashSet();
    locator = new LocatorImpl();
    inlineResourceList = new ArrayList<>();
    jsSet = new HashSet<>();
}
Also used : LocatorImpl(org.xml.sax.helpers.LocatorImpl) HashSet(java.util.HashSet)

Example 5 with LocatorImpl

use of org.xml.sax.helpers.LocatorImpl in project robovm by robovm.

the class LocatorImplTest method testSetColumnNumberGetColumnNumber.

public void testSetColumnNumberGetColumnNumber() {
    LocatorImpl l = new LocatorImpl();
    l.setColumnNumber(COL);
    assertEquals(COL, l.getColumnNumber());
    l.setColumnNumber(0);
    assertEquals(0, l.getColumnNumber());
}
Also used : LocatorImpl(org.xml.sax.helpers.LocatorImpl)

Aggregations

LocatorImpl (org.xml.sax.helpers.LocatorImpl)28 SAXParseException (org.xml.sax.SAXParseException)9 SAXException (org.xml.sax.SAXException)7 SchemaLocationFilter (com.sun.xml.bind.marshaller.SchemaLocationFilter)5 MarshalException (javax.xml.bind.MarshalException)5 Locator (org.xml.sax.Locator)4 IOException (java.io.IOException)3 URL (java.net.URL)3 URLConnection (java.net.URLConnection)3 DocumentImpl (org.apache.harmony.xml.dom.DocumentImpl)3 KXmlParser (org.kxml2.io.KXmlParser)3 DocumentType (org.w3c.dom.DocumentType)3 XmlPullParserException (org.xmlpull.v1.XmlPullParserException)3 Test (org.junit.Test)2 HashSet (java.util.HashSet)1 Map (java.util.Map)1 Properties (java.util.Properties)1 XMLEventReader (javax.xml.stream.XMLEventReader)1 XMLStreamException (javax.xml.stream.XMLStreamException)1 XMLStreamReader (javax.xml.stream.XMLStreamReader)1