本文整理汇总了Java中javax.xml.stream.Location.getPublicId方法的典型用法代码示例。如果您正苦于以下问题:Java Location.getPublicId方法的具体用法?Java Location.getPublicId怎么用?Java Location.getPublicId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.xml.stream.Location
的用法示例。
在下文中一共展示了Location.getPublicId方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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;
}
示例3: getPublicId
import javax.xml.stream.Location; //导入方法依赖的package包/类
public String getPublicId()
{
Location l = reader.getLocation();
return l.getPublicId();
}