当前位置: 首页>>代码示例>>Java>>正文


Java Location.getPublicId方法代码示例

本文整理汇总了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();
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:8,代码来源:LocationImpl.java

示例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;
}
 
开发者ID:Legostaev,项目名称:xmlsec-gost,代码行数:55,代码来源:StAX2DOM.java

示例3: getPublicId

import javax.xml.stream.Location; //导入方法依赖的package包/类
public String getPublicId()
{
  Location l = reader.getLocation();
  return l.getPublicId();
}
 
开发者ID:vilie,项目名称:javify,代码行数:6,代码来源:SAXParser.java


注:本文中的javax.xml.stream.Location.getPublicId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。