本文整理汇总了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;未经允许,请勿转载。 |
请发表评论