Java Code Examples for org.xml.sax.helpers.AttributesImpl#setLocalName()

The following examples show how to use org.xml.sax.helpers.AttributesImpl#setLocalName() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
/**
 * Basic test for setLocalName(int, String), setQName(int, String),
 * setType(int, String), setValue(int, String) and setURI(int, String).
 */
@Test
public void testcase07() {
    AttributesImpl attr = new AttributesImpl();
    attr.addAttribute(CAR_URI, CAR_LOCALNAME, CAR_QNAME, CAR_TYPE, CAR_VALUE);
    attr.addAttribute(JEEP_URI, JEEP_LOCALNAME, JEEP_QNAME, JEEP_TYPE,
            JEEP_VALUE);
    attr.setLocalName(1, "speclead");
    attr.setQName(1, "megi");
    attr.setType(1, "sax");
    attr.setValue(1, "SAX01");
    attr.setURI(1, "www.megginson.com/sax/sax01");

    assertEquals(attr.getLocalName(1), "speclead");
    assertEquals(attr.getQName(1), "megi");
    assertEquals(attr.getType(1), "sax");
    assertEquals(attr.getType("megi"), "sax");
    assertEquals(attr.getURI(1), "www.megginson.com/sax/sax01");
}
 
Example 2
static
protected Attributes renameAttribute(Attributes attributes, String oldLocalName, String localName){
	int index = attributes.getIndex("", oldLocalName);

	if(index < 0){
		return attributes;
	}

	AttributesImpl result = new AttributesImpl(attributes);
	result.setLocalName(index, localName);
	result.setQName(index, localName); // XXX

	return result;
}