java类org.xml.sax.helpers.LocatorImpl的实例源码

PatternMatcherTest.java 文件源码 项目:jing-trang 阅读 25 收藏 0 点赞 0 评论 0
@DataProvider(name = "attributePairs")
Object[][] attributePairs() {
  final Name foo = new Name("", "foo");
  final Name bar = new Name("", "bar");
  Set<Name> nameSet = new HashSet<Name>();
  nameSet.add(foo);
  nameSet.add(bar);
  final NormalizedNameClass foobarNNC = new NormalizedNsNameClass(nameSet, EMPTY_MAP);
  final Locator loc = new LocatorImpl();
  return new Object[][] {
          { rootAttributeMatcher(makeElement(new SimpleNameClass(root),
                                             makeGroup(makeAttribute(new SimpleNameClass(foo), makeText(), loc),
                                                       makeAttribute(new SimpleNameClass(bar), makeText(), loc)),
                                             loc)),
            foobarNNC }                    
  };
}
SchemaContentHandler.java 文件源码 项目:xerces-for-android 阅读 29 收藏 0 点赞 0 评论 0
static void convertToSAXParseException(XMLParseException e) throws SAXException {
    Exception ex = e.getException();
    if (ex == null) {
        // must be a parser exception; mine it for locator info and throw
        // a SAXParseException
        LocatorImpl locatorImpl = new LocatorImpl();
        locatorImpl.setPublicId(e.getPublicId());
        locatorImpl.setSystemId(e.getExpandedSystemId());
        locatorImpl.setLineNumber(e.getLineNumber());
        locatorImpl.setColumnNumber(e.getColumnNumber());
        throw new SAXParseException(e.getMessage(), locatorImpl);
    }
    if (ex instanceof SAXException) {
        // why did we create an XMLParseException?
        throw (SAXException) ex;
    }
    throw new SAXException(ex);
}
Converter.java 文件源码 项目:ttt 阅读 20 收藏 0 点赞 0 评论 0
private int hasTextField(LocatorImpl locator, String[] parts, int partIndex, NonTextAttributeTreatment nonTextAttributeTreatment) {
    while (partIndex < parts.length) {
        String field = parts[partIndex];
        if (field.length() == 0) {
            return -1;
        } else {
            int[] delims = countTextAttributeDelimiters(field);
            if (inTextAttribute) {
                if ((delims[1] > 0) && (delims[0] < delims[1]))
                    inTextAttribute = false;
                return partIndex;
            } else if (isTextField(locator, field, partIndex, nonTextAttributeTreatment)) {
                return partIndex;
            } else if ((delims[0] > 0) && (delims[0] > delims[1])) {
                inTextAttribute = true;
                return partIndex;
            } else
                return -1;
        }
    }
    return -1;
}
ClassBeanInfoImpl.java 文件源码 项目:cxf-plus 阅读 24 收藏 0 点赞 0 评论 0
public BeanT createInstance(UnmarshallingContext context) throws IllegalAccessException, InvocationTargetException, InstantiationException, SAXException {

    BeanT bean = null;        
    if (factoryMethod == null){
       bean = ClassFactory.create0(jaxbType);
    }else {
        Object o = ClassFactory.create(factoryMethod);
        if( jaxbType.isInstance(o) ){
            bean = (BeanT)o;
        } else {
            throw new InstantiationException("The factory method didn't return a correct object");
        }
    }

    if(xmlLocatorField!=null)
        // need to copy because Locator is mutable
        try {
            xmlLocatorField.set(bean,new LocatorImpl(context.getLocator()));
        } catch (AccessorException e) {
            context.handleError(e);
        }
    return bean;
}
XMLFilterImplTest.java 文件源码 项目:In-the-Box-Fork 阅读 22 收藏 0 点赞 0 评论 0
@TestTargetNew(
    level = TestLevel.COMPLETE,
    method = "setDocumentLocator",
    args = { Locator.class }
)
public void testSetDocumentLocator() {
    Locator l = new LocatorImpl();

    child.setDocumentLocator(l);

    assertEquals(logger.size(), 1);
    assertEquals("setDocumentLocator", logger.getMethod());
    assertEquals(new Object[] { l }, logger.getArgs());

    child.setDocumentLocator(null);

    assertEquals(logger.size(), 2);
    assertEquals("setDocumentLocator", logger.getMethod());
    assertEquals(new Object[] { null }, logger.getArgs());
}
LocatorImplTest.java 文件源码 项目:In-the-Box-Fork 阅读 20 收藏 0 点赞 0 评论 0
@TestTargets({
    @TestTargetNew(
        level = TestLevel.COMPLETE,
        method = "setPublicId",
        args = { String.class }
    ),
    @TestTargetNew(
        level = TestLevel.COMPLETE,
        method = "getPublicId",
        args = { }
    )
})
public void testSetPublicIdGetPublicId() {
    LocatorImpl l = new LocatorImpl();

    l.setPublicId(PUB);
    assertEquals(PUB, l.getPublicId());

    l.setPublicId(null);
    assertEquals(null, l.getPublicId());
}
LocatorImplTest.java 文件源码 项目:In-the-Box-Fork 阅读 21 收藏 0 点赞 0 评论 0
@TestTargets({
    @TestTargetNew(
        level = TestLevel.COMPLETE,
        method = "setLineNumber",
        args = { int.class }
    ),
    @TestTargetNew(
        level = TestLevel.COMPLETE,
        method = "getLineNumber",
        args = { }
    )
})
public void testSetLineNumberGetLineNumber() {
    LocatorImpl l = new LocatorImpl();

    l.setLineNumber(ROW);
    assertEquals(ROW, l.getLineNumber());

    l.setLineNumber(0);
    assertEquals(0, l.getLineNumber());
}
LocatorImplTest.java 文件源码 项目:In-the-Box-Fork 阅读 22 收藏 0 点赞 0 评论 0
@TestTargets({
    @TestTargetNew(
        level = TestLevel.COMPLETE,
        method = "setColumnNumber",
        args = { int.class }
    ),
    @TestTargetNew(
        level = TestLevel.COMPLETE,
        method = "getColumnNumber",
        args = { }
    )
})
public void testSetColumnNumberGetColumnNumber() {
    LocatorImpl l = new LocatorImpl();

    l.setColumnNumber(COL);
    assertEquals(COL, l.getColumnNumber());

    l.setColumnNumber(0);
    assertEquals(0, l.getColumnNumber());
}
XMLReaderAdapterTest.java 文件源码 项目:In-the-Box-Fork 阅读 26 收藏 0 点赞 0 评论 0
@TestTargetNew(
    level = TestLevel.COMPLETE,
    method = "setDocumentLocator",
    args = { Locator.class }
)
public void testSetDocumentLocator() {
    // Ordinary case
    LocatorImpl locator = new LocatorImpl();
    adapter.setDocumentLocator(locator);

    assertEquals("setDocumentLocator", logger.getMethod());
    assertEquals(new Object[] { locator }, logger.getArgs());

    // null case (for the DocumentHandler itself!)
    adapter.setDocumentHandler(null);
    adapter.setDocumentLocator(locator);
}
ClassBeanInfoImpl.java 文件源码 项目:OLD-OpenJDK8 阅读 31 收藏 0 点赞 0 评论 0
public BeanT createInstance(UnmarshallingContext context) throws IllegalAccessException, InvocationTargetException, InstantiationException, SAXException {

        BeanT bean = null;
        if (factoryMethod == null){
           bean = ClassFactory.create0(jaxbType);
        }else {
            Object o = ClassFactory.create(factoryMethod);
            if( jaxbType.isInstance(o) ){
                bean = (BeanT)o;
            } else {
                throw new InstantiationException("The factory method didn't return a correct object");
            }
        }

        if(xmlLocatorField!=null)
            // need to copy because Locator is mutable
            try {
                xmlLocatorField.set(bean,new LocatorImpl(context.getLocator()));
            } catch (AccessorException e) {
                context.handleError(e);
            }
        return bean;
    }


问题


面经


文章

微信
公众号

扫码关注公众号