Code example for Attributes

Methods: getLengthgetLocalNamegetQNamegetURI

0
            @Override public void startElement(String uri, String localName,
                    String qName, Attributes attributes) {
                assertEquals("http://quux", uri);
                assertEquals("foo", localName);
                assertEquals("a:foo", qName);
                assertEquals(2, attributes.getLength());
                assertEquals("http://quux", attributes.getURI(0));
                assertEquals("bar", attributes.getLocalName(0));
                assertEquals("a:bar", attributes.getQName(0));
                assertEquals("", attributes.getURI(1));
                assertEquals("", attributes.getLocalName(1));
                assertEquals("xmlns:a", attributes.getQName(1));
            } 
        }); 
    } 
 
    public void testYesPrefixesNoNamespaces() throws Exception { 
        parse(true, false, "<foo bar=\"baz\"/>", new DefaultHandler() {
            @Override public void startElement(String uri, String localName,
                    String qName, Attributes attributes) {
Stop searching for code, let great code find you!  Add Codota to your java IDE