Search in sources :

Example 81 with AttributesImpl

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
    }
}
Also used : AttributesImpl(org.xml.sax.helpers.AttributesImpl)

Example 82 with AttributesImpl

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());
    }
}
Also used : AttributesImpl(org.xml.sax.helpers.AttributesImpl)

Example 83 with AttributesImpl

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);
}
Also used : AttributesImpl(org.xml.sax.helpers.AttributesImpl)

Example 84 with AttributesImpl

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);
        }
    }
}
Also used : AttributesImpl(org.xml.sax.helpers.AttributesImpl)

Example 85 with AttributesImpl

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();
}
Also used : AttributesImpl(org.xml.sax.helpers.AttributesImpl)

Aggregations

AttributesImpl (org.xml.sax.helpers.AttributesImpl)310 SAXException (org.xml.sax.SAXException)53 Test (org.junit.Test)34 DiskWriteAttributesImpl (org.apache.geode.internal.cache.DiskWriteAttributesImpl)23 PartitionAttributesImpl (org.apache.geode.internal.cache.PartitionAttributesImpl)23 ContentHandler (org.xml.sax.ContentHandler)21 Attributes (org.xml.sax.Attributes)17 PreparedStatement (java.sql.PreparedStatement)16 ResultSet (java.sql.ResultSet)16 Map (java.util.Map)16 PackOut (org.adempiere.pipo.PackOut)16 IOException (java.io.IOException)15 POSaveFailedException (org.adempiere.pipo.exception.POSaveFailedException)12 Iterator (java.util.Iterator)11 TransformerHandler (javax.xml.transform.sax.TransformerHandler)11 StreamResult (javax.xml.transform.stream.StreamResult)11 Metadata (org.apache.tika.metadata.Metadata)11 File (java.io.File)9 SAXTransformerFactory (javax.xml.transform.sax.SAXTransformerFactory)9 DatabaseAccessException (org.adempiere.pipo.exception.DatabaseAccessException)9