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();
}
}
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();
}
}
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();
}
}
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());
}
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());
}
Aggregations