本文整理汇总了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);
}
示例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());
}
示例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());
}
示例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());
}
示例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());
}
示例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);
}
示例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);
}