Search in sources :

Example 11 with Location

use of javax.xml.stream.Location in project spring-framework by spring-projects.

the class StaxEventXMLReader method handleStartDocument.

private void handleStartDocument(final XMLEvent event) throws SAXException {
    if (event.isStartDocument()) {
        StartDocument startDocument = (StartDocument) event;
        String xmlVersion = startDocument.getVersion();
        if (StringUtils.hasLength(xmlVersion)) {
            this.xmlVersion = xmlVersion;
        }
        if (startDocument.encodingSet()) {
            this.encoding = startDocument.getCharacterEncodingScheme();
        }
    }
    if (getContentHandler() != null) {
        final Location location = event.getLocation();
        getContentHandler().setDocumentLocator(new Locator2() {

            @Override
            public int getColumnNumber() {
                return (location != null ? location.getColumnNumber() : -1);
            }

            @Override
            public int getLineNumber() {
                return (location != null ? location.getLineNumber() : -1);
            }

            @Override
            public String getPublicId() {
                return (location != null ? location.getPublicId() : null);
            }

            @Override
            public String getSystemId() {
                return (location != null ? location.getSystemId() : null);
            }

            @Override
            public String getXMLVersion() {
                return xmlVersion;
            }

            @Override
            public String getEncoding() {
                return encoding;
            }
        });
        getContentHandler().startDocument();
    }
}
Also used : StartDocument(javax.xml.stream.events.StartDocument) Locator2(org.xml.sax.ext.Locator2) Location(javax.xml.stream.Location)

Example 12 with Location

use of javax.xml.stream.Location in project spring-framework by spring-projects.

the class StaxEventXMLReader method handleDtd.

private void handleDtd(DTD dtd) throws SAXException {
    if (getLexicalHandler() != null) {
        javax.xml.stream.Location location = dtd.getLocation();
        getLexicalHandler().startDTD(null, location.getPublicId(), location.getSystemId());
    }
    if (getLexicalHandler() != null) {
        getLexicalHandler().endDTD();
    }
}
Also used : Location(javax.xml.stream.Location)

Example 13 with Location

use of javax.xml.stream.Location in project spring-framework by spring-projects.

the class StaxStreamXMLReader method handleDtd.

private void handleDtd() throws SAXException {
    if (getLexicalHandler() != null) {
        javax.xml.stream.Location location = this.reader.getLocation();
        getLexicalHandler().startDTD(null, location.getPublicId(), location.getSystemId());
    }
    if (getLexicalHandler() != null) {
        getLexicalHandler().endDTD();
    }
}
Also used : Location(javax.xml.stream.Location)

Example 14 with Location

use of javax.xml.stream.Location in project Activiti by Activiti.

the class BpmnXMLUtil method addXMLLocation.

public static void addXMLLocation(BaseElement element, XMLStreamReader xtr) {
    Location location = xtr.getLocation();
    element.setXmlRowNumber(location.getLineNumber());
    element.setXmlColumnNumber(location.getColumnNumber());
}
Also used : Location(javax.xml.stream.Location)

Example 15 with Location

use of javax.xml.stream.Location in project Activiti by Activiti.

the class BpmnXMLUtil method addXMLLocation.

public static void addXMLLocation(GraphicInfo graphicInfo, XMLStreamReader xtr) {
    Location location = xtr.getLocation();
    graphicInfo.setXmlRowNumber(location.getLineNumber());
    graphicInfo.setXmlColumnNumber(location.getColumnNumber());
}
Also used : Location(javax.xml.stream.Location)

Aggregations

Location (javax.xml.stream.Location)16 XMLStreamException (javax.xml.stream.XMLStreamException)6 XMLInputFactory (javax.xml.stream.XMLInputFactory)5 XMLReporter (javax.xml.stream.XMLReporter)5 DataInputStream (java.io.DataInputStream)3 InputStream (java.io.InputStream)3 InputStreamReader (java.io.InputStreamReader)3 ZipEntry (java.util.zip.ZipEntry)3 XMLStreamReader (javax.xml.stream.XMLStreamReader)3 Locator2 (org.xml.sax.ext.Locator2)3 BigInteger (java.math.BigInteger)1 StartDocument (javax.xml.stream.events.StartDocument)1 XmlFormat (org.apache.juneau.xml.annotation.XmlFormat)1 CapabilityImpl (org.apache.karaf.features.internal.resolver.CapabilityImpl)1 ResourceImpl (org.apache.karaf.features.internal.resolver.ResourceImpl)1 Report (org.gephi.io.importer.api.Report)1 ProjectControllerImpl (org.gephi.project.impl.ProjectControllerImpl)1 ProjectImpl (org.gephi.project.impl.ProjectImpl)1 ProjectInformationImpl (org.gephi.project.impl.ProjectInformationImpl)1 ProjectsImpl (org.gephi.project.impl.ProjectsImpl)1