本文整理匯總了Java中javax.xml.stream.Location.getLineNumber方法的典型用法代碼示例。如果您正苦於以下問題:Java Location.getLineNumber方法的具體用法?Java Location.getLineNumber怎麽用?Java Location.getLineNumber使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.xml.stream.Location
的用法示例。
在下文中一共展示了Location.getLineNumber方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: LocationImpl
import javax.xml.stream.Location; //導入方法依賴的package包/類
LocationImpl(Location loc){
systemId = loc.getSystemId();
publicId = loc.getPublicId();
lineNo = loc.getLineNumber();
colNo = loc.getColumnNumber();
charOffset = loc.getCharacterOffset();
}
示例2: AbstractObjectImpl
import javax.xml.stream.Location; //導入方法依賴的package包/類
AbstractObjectImpl(XMLStreamReader xsr) {
Location loc = xsr.getLocation();
this.lineNumber = loc.getLineNumber();
this.systemId = loc.getSystemId();
}
示例3: addLocation
import javax.xml.stream.Location; //導入方法依賴的package包/類
static boolean addLocation(Document doc, Node node,
XMLStreamReader reader,
boolean recordLoc) {
if (recordLoc) {
Location loc = reader.getLocation();
if (loc != null && (loc.getColumnNumber() != 0 || loc.getLineNumber() != 0)) {
try {
final int charOffset = loc.getCharacterOffset();
final int colNum = loc.getColumnNumber();
final int linNum = loc.getLineNumber();
final String pubId = loc.getPublicId() == null ? doc.getDocumentURI() : loc.getPublicId();
final String sysId = loc.getSystemId() == null ? doc.getDocumentURI() : loc.getSystemId();
Location loc2 = new Location() {
@Override
public int getCharacterOffset() {
return charOffset;
}
@Override
public int getColumnNumber() {
return colNum;
}
@Override
public int getLineNumber() {
return linNum;
}
@Override
public String getPublicId() {
return pubId;
}
@Override
public String getSystemId() {
return sysId;
}
};
node.setUserData("location", loc2, new UserDataHandler() {
@Override
public void handle(short operation, String key, Object data, Node src, Node dst) {
if (operation == NODE_CLONED) {
dst.setUserData(key, data, this);
}
}
});
} catch (Exception ex) {
//possibly not DOM level 3, won't be able to record this then
return false;
}
}
}
return recordLoc;
}
示例4: XMLReadException
import javax.xml.stream.Location; //導入方法依賴的package包/類
private XMLReadException(RuntimeException cause, Location location) {
super(cause.getMessage() + " at " + location.getLineNumber() + ":" + location.getColumnNumber(), cause);
}
示例5: getLineNumber
import javax.xml.stream.Location; //導入方法依賴的package包/類
public int getLineNumber()
{
Location l = reader.getLocation();
return l.getLineNumber();
}