use of org.xml.sax.helpers.AttributesImpl in project robovm by robovm.
the class AttributesImplTest method testAttributesImplAttributes.
public void testAttributesImplAttributes() {
// Ordinary case
AttributesImpl ai = new AttributesImpl(empty);
assertEquals(0, ai.getLength());
// Another ordinary case
ai = new AttributesImpl(multi);
assertEquals(5, ai.getLength());
// No Attributes
try {
ai = new AttributesImpl(null);
assertEquals(0, ai.getLength());
fail("NullPointerException expected");
} catch (NullPointerException e) {
// Expected
}
}
use of org.xml.sax.helpers.AttributesImpl in project robovm by robovm.
the class AttributesImplTest method testGetLength.
public void testGetLength() {
AttributesImpl ai = new AttributesImpl(empty);
assertEquals(0, ai.getLength());
ai = new AttributesImpl(multi);
assertEquals(5, ai.getLength());
for (int i = 4; i >= 0; i--) {
ai.removeAttribute(i);
assertEquals(i, ai.getLength());
}
}
use of org.xml.sax.helpers.AttributesImpl in project tika by apache.
the class XMPContentHandler method startDescription.
public void startDescription(String about, String prefix, String uri) throws SAXException {
this.prefix = prefix;
this.uri = uri;
startPrefixMapping(prefix, uri);
AttributesImpl attributes = new AttributesImpl();
attributes.addAttribute(RDF, "about", "rdf:about", "CDATA", about);
startElement(RDF, "Description", "rdf:Description", attributes);
}
use of org.xml.sax.helpers.AttributesImpl in project tika by apache.
the class MatchingContentHandler method startElement.
public void startElement(String uri, String localName, String name, Attributes attributes) throws SAXException {
matchers.addFirst(matcher);
matcher = matcher.descend(uri, localName);
AttributesImpl matches = new AttributesImpl();
for (int i = 0; i < attributes.getLength(); i++) {
String attributeURI = attributes.getURI(i);
String attributeName = attributes.getLocalName(i);
if (matcher.matchesAttribute(attributeURI, attributeName)) {
matches.addAttribute(attributeURI, attributeName, attributes.getQName(i), attributes.getType(i), attributes.getValue(i));
}
}
if (matcher.matchesElement() || matches.getLength() > 0) {
super.startElement(uri, localName, name, matches);
if (!matcher.matchesElement()) {
// Force the matcher to match the current element, so the
// endElement method knows to emit the correct event
matcher = new CompositeMatcher(matcher, ElementMatcher.INSTANCE);
}
}
}
use of org.xml.sax.helpers.AttributesImpl in project webservices-axiom by apache.
the class DummyXMLReader method parse.
private void parse() throws SAXException {
parsed = true;
contentHandler.startDocument();
contentHandler.startElement("", "test", "test", new AttributesImpl());
contentHandler.endElement("", "test", "test");
contentHandler.endDocument();
}
Aggregations