Java Code Examples for org.xml.sax.Locator#getLineNumber()
The following examples show how to use
org.xml.sax.Locator#getLineNumber() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: XmlLocationAnnotator.java From org.hl7.fhir.core with Apache License 2.0 | 6 votes |
@Override public void endElement(String uri, String localName, String qName) throws SAXException { // Mutation event fired by the adding of element end, // and so lastAddedElement will be set. super.endElement(uri, localName, qName); if (locatorStack.size() > 0) { Locator startLocator = locatorStack.pop(); XmlLocationData location = new XmlLocationData( startLocator.getSystemId(), startLocator.getLineNumber(), startLocator.getColumnNumber(), locator.getLineNumber(), locator.getColumnNumber()); Element lastAddedElement = elementStack.pop(); lastAddedElement.setUserData( XmlLocationData.LOCATION_DATA_KEY, location, dataHandler); } }
Example 2
Source File: SchemaTreeTraverser.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
/** * Simple constructor. * * @param artifactName Artifact name. * @param locator Artifact locator. */ public SchemaTreeNode(String artifactName, Locator locator) { this.artifactName = artifactName; if (locator == null) { this.fileName = null; } else { String filename = locator.getSystemId(); filename = filename.replaceAll("\u002520", " "); // strip leading protocol if (filename.startsWith("file:/")) { filename = filename.substring(6); } this.fileName = filename; this.lineNumber = locator.getLineNumber() - 1; } }
Example 3
Source File: CollisionInfo.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
private String printLocator(Locator loc) { if( loc==null ) return ""; int line = loc.getLineNumber(); String sysId = loc.getSystemId(); if(sysId==null) sysId = Messages.format(Messages.MSG_UNKNOWN_FILE); if( line!=-1 ) return Messages.format( Messages.MSG_LINE_X_OF_Y, Integer.toString(line), sysId ); else return sysId; }
Example 4
Source File: CollisionInfo.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
private String printLocator(Locator loc) { if( loc==null ) return ""; int line = loc.getLineNumber(); String sysId = loc.getSystemId(); if(sysId==null) sysId = Messages.format(Messages.MSG_UNKNOWN_FILE); if( line!=-1 ) return Messages.format( Messages.MSG_LINE_X_OF_Y, Integer.toString(line), sysId ); else return sysId; }
Example 5
Source File: Util.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * Compares if two {@link Locator}s point to the exact same position. */ public static boolean equals(Locator lhs, Locator rhs) { return lhs.getLineNumber()==rhs.getLineNumber() && lhs.getColumnNumber()==rhs.getColumnNumber() && equals(lhs.getSystemId(),rhs.getSystemId()) && equals(lhs.getPublicId(),rhs.getPublicId()); }
Example 6
Source File: ClassSelector.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
/** * Copies a schema fragment into the javadoc of the generated class. */ private void addSchemaFragmentJavadoc( CClassInfo bean, XSComponent sc ) { // first, pick it up from <documentation> if any. String doc = builder.getBindInfo(sc).getDocumentation(); if(doc!=null) append(bean, doc); // then the description of where this component came from Locator loc = sc.getLocator(); String fileName = null; if(loc!=null) { fileName = loc.getPublicId(); if(fileName==null) fileName = loc.getSystemId(); } if(fileName==null) fileName=""; String lineNumber=Messages.format( Messages.JAVADOC_LINE_UNKNOWN); if(loc!=null && loc.getLineNumber()!=-1) lineNumber = String.valueOf(loc.getLineNumber()); String componentName = sc.apply( new ComponentNameFunction() ); String jdoc = Messages.format( Messages.JAVADOC_HEADING, componentName, fileName, lineNumber ); append(bean,jdoc); // then schema fragment StringWriter out = new StringWriter(); out.write("<pre>\n"); SchemaWriter sw = new SchemaWriter(new JavadocEscapeWriter(out)); sc.visit(sw); out.write("</pre>"); append(bean,out.toString()); }
Example 7
Source File: DOMForestScanner.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
public int getLineNumber() { Locator l = findLocator(); if(l!=null) return l.getLineNumber(); return -1; }
Example 8
Source File: DOMForestScanner.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
public int getLineNumber() { Locator l = findLocator(); if(l!=null) return l.getLineNumber(); return -1; }
Example 9
Source File: SAX2StAXBaseWriter.java From jdk1.8-source-analysis with Apache License 2.0 | 4 votes |
private SAXLocation(Locator locator) { lineNumber = locator.getLineNumber(); columnNumber = locator.getColumnNumber(); publicId = locator.getPublicId(); systemId = locator.getSystemId(); }
Example 10
Source File: DOMForestScanner.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
public int getLineNumber() { Locator l = findLocator(); if(l!=null) return l.getLineNumber(); return -1; }
Example 11
Source File: DOMForestScanner.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
public int getLineNumber() { Locator l = findLocator(); if(l!=null) return l.getLineNumber(); return -1; }
Example 12
Source File: DOMForestScanner.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
public int getLineNumber() { Locator l = findLocator(); if(l!=null) return l.getLineNumber(); return -1; }
Example 13
Source File: SAX2StAXBaseWriter.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
private SAXLocation(Locator locator) { lineNumber = locator.getLineNumber(); columnNumber = locator.getColumnNumber(); publicId = locator.getPublicId(); systemId = locator.getSystemId(); }
Example 14
Source File: DefaultAuthenticator.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
private String getLocationString(Locator l) { return "[" + l.getSystemId() + "#" + l.getLineNumber() + "]"; }
Example 15
Source File: DOMForestScanner.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
public int getLineNumber() { Locator l = findLocator(); if(l!=null) return l.getLineNumber(); return -1; }
Example 16
Source File: DOMForestScanner.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
public int getLineNumber() { Locator l = findLocator(); if(l!=null) return l.getLineNumber(); return -1; }
Example 17
Source File: DefaultAuthenticator.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
private String getLocationString(Locator l) { return "[" + l.getSystemId() + "#" + l.getLineNumber() + "]"; }
Example 18
Source File: DOMForestScanner.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
public int getLineNumber() { Locator l = findLocator(); if(l!=null) return l.getLineNumber(); return -1; }
Example 19
Source File: ValidationEventLocatorImpl.java From jdk1.8-source-analysis with Apache License 2.0 | 3 votes |
/** * Constructs an object from an org.xml.sax.Locator. * * The object's ColumnNumber, LineNumber, and URL become available from the * values returned by the locator's getColumnNumber(), getLineNumber(), and * getSystemId() methods respectively. Node, Object, and Offset are not * available. * * @param loc the SAX Locator object that will be used to populate this * event locator. * @throws IllegalArgumentException if the Locator is null */ public ValidationEventLocatorImpl( Locator loc ) { if( loc == null ) { throw new IllegalArgumentException( Messages.format( Messages.MUST_NOT_BE_NULL, "loc" ) ); } this.url = toURL(loc.getSystemId()); this.columnNumber = loc.getColumnNumber(); this.lineNumber = loc.getLineNumber(); }
Example 20
Source File: ValidationEventLocatorImpl.java From jdk8u60 with GNU General Public License v2.0 | 3 votes |
/** * Constructs an object from an org.xml.sax.Locator. * * The object's ColumnNumber, LineNumber, and URL become available from the * values returned by the locator's getColumnNumber(), getLineNumber(), and * getSystemId() methods respectively. Node, Object, and Offset are not * available. * * @param loc the SAX Locator object that will be used to populate this * event locator. * @throws IllegalArgumentException if the Locator is null */ public ValidationEventLocatorImpl( Locator loc ) { if( loc == null ) { throw new IllegalArgumentException( Messages.format( Messages.MUST_NOT_BE_NULL, "loc" ) ); } this.url = toURL(loc.getSystemId()); this.columnNumber = loc.getColumnNumber(); this.lineNumber = loc.getLineNumber(); }