• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Locator2Impl类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.xml.sax.ext.Locator2Impl的典型用法代码示例。如果您正苦于以下问题:Java Locator2Impl类的具体用法?Java Locator2Impl怎么用?Java Locator2Impl使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Locator2Impl类属于org.xml.sax.ext包,在下文中一共展示了Locator2Impl类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: setLocation

import org.xml.sax.ext.Locator2Impl; //导入依赖的package包/类
private void setLocation(PsiElement text) {
  final PsiFile psiFile = text.getContainingFile();
  final Document document = PsiDocumentManager.getInstance(text.getProject()).getDocument(psiFile);
  if (document == null) {
    return;
  }
  final VirtualFile virtualFile = psiFile.getVirtualFile();
  if (virtualFile == null) {
    return;
  }

  final Locator2Impl locator = new Locator2Impl();
  locator.setSystemId(RngParser.reallyFixIDEAUrl(virtualFile.getUrl()));

  final int offset = text.getTextRange().getEndOffset();
  final int lineNumber = document.getLineNumber(offset);

  locator.setLineNumber(lineNumber + 1);
  locator.setColumnNumber(1 + offset - document.getLineStartOffset(lineNumber));

  myHandler.setDocumentLocator(locator);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:Psi2SaxAdapter.java


示例2: testHandleException_3

import org.xml.sax.ext.Locator2Impl; //导入依赖的package包/类
/**
 * Run the WatsParseException handleException(Throwable) method test.
 * 
 * @throws Exception
 * 
 * @generatedBy CodePro at 9/3/14 3:44 PM
 */
@Test
public void testHandleException_3()
        throws Exception {
    Throwable throwable = new SAXParseException("", new Locator2Impl());

    WatsParseException result = ParseExceptionConverter.handleException(throwable);

    assertNotNull(result);
    assertEquals(0, result.getColumn());
    assertEquals("Error at line:column 0:0: ", result.getMessage());
    assertEquals(0, result.getLineNumber());
    assertEquals("com.intuit.tank.vm.exception.WatsParseException: Error at line:column 0:0: ",
            result.toString());
    assertEquals("Error at line:column 0:0: ", result.getLocalizedMessage());
}
 
开发者ID:intuit,项目名称:Tank,代码行数:23,代码来源:ParseExceptionConverterCpTest.java


示例3: testLocatorImpl

import org.xml.sax.ext.Locator2Impl; //导入依赖的package包/类
@TestTargetNew(
    level = TestLevel.COMPLETE,
    method = "Locator2Impl",
    args = { }
)
public void testLocatorImpl() {
    Locator2Impl l = new Locator2Impl();

    assertEquals(null, l.getPublicId());
    assertEquals(null, l.getSystemId());
    assertEquals(0, l.getLineNumber());
    assertEquals(0, l.getColumnNumber());

    assertEquals(null, l.getEncoding());
    assertEquals(null, l.getXMLVersion());
}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:17,代码来源:Locator2ImplTest.java


示例4: testSetXMLVersionGetXMLVersion

import org.xml.sax.ext.Locator2Impl; //导入依赖的package包/类
@TestTargets({
    @TestTargetNew(
        level = TestLevel.COMPLETE,
        method = "setXMLVersion",
        args = { String.class }
    ),
    @TestTargetNew(
        level = TestLevel.COMPLETE,
        method = "getXMLVersion",
        args = { }
    )
})
public void testSetXMLVersionGetXMLVersion() {
    Locator2Impl l = new Locator2Impl();

    l.setXMLVersion(XML);
    assertEquals(XML, l.getXMLVersion());

    l.setXMLVersion(null);
    assertEquals(null, l.getXMLVersion());
}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:22,代码来源:Locator2ImplTest.java


示例5: testSetEncodingGetEncoding

import org.xml.sax.ext.Locator2Impl; //导入依赖的package包/类
@TestTargets({
    @TestTargetNew(
        level = TestLevel.COMPLETE,
        method = "setEncoding",
        args = { String.class }
    ),
    @TestTargetNew(
        level = TestLevel.COMPLETE,
        method = "getEncoding",
        args = { }
    )
})
public void testSetEncodingGetEncoding() {
    Locator2Impl l = new Locator2Impl();

    l.setEncoding(ENC);
    assertEquals(ENC, l.getEncoding());

    l.setEncoding(null);
    assertEquals(null, l.getEncoding());
}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:22,代码来源:Locator2ImplTest.java


示例6: setLocation

import org.xml.sax.ext.Locator2Impl; //导入依赖的package包/类
private void setLocation(PsiElement text) {
  final PsiFile psiFile = text.getContainingFile();
  final Document document = PsiDocumentManager.getInstance(text.getProject()).getDocument(psiFile);
  if (document == null) {
    return;
  }
  final VirtualFile virtualFile = psiFile.getVirtualFile();
  if (virtualFile == null) {
    return;
  }

  final Locator2Impl locator = new Locator2Impl();
  locator.setSystemId(VfsUtilCore.fixIDEAUrl(virtualFile.getUrl()));

  final int offset = text.getTextRange().getEndOffset();
  final int lineNumber = document.getLineNumber(offset);

  locator.setLineNumber(lineNumber + 1);
  locator.setColumnNumber(1 + offset - document.getLineStartOffset(lineNumber));

  myHandler.setDocumentLocator(locator);
}
 
开发者ID:consulo,项目名称:consulo-xml,代码行数:23,代码来源:Psi2SaxAdapter.java


示例7: setDocumentLocator

import org.xml.sax.ext.Locator2Impl; //导入依赖的package包/类
public void setDocumentLocator(Locator locator) {
    this.locator = new Locator2Impl((Locator2) locator);
    this.locator.setXMLVersion(version);
    this.locator.setEncoding(encoding);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:6,代码来源:MyDefaultHandler2.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java InVMAcceptorFactory类代码示例发布时间:2022-05-22
下一篇:
Java EditText类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap