@Test public void testStartParsing() throws Exception { Attributes attrs = mock( Attributes.class ); doReturn( 6 ).when( attrs ).getLength(); doReturn( "xmlns" ).when( attrs ).getQName( 0 ); doReturn( "xmlns:test" ).when( attrs ).getQName( 1 ); doReturn( "test_qname" ).when( attrs ).getQName( 2 ); doReturn( ":test" ).when( attrs ).getLocalName( 2 ); doReturn( "test_qname" ).when( attrs ).getQName( 3 ); doReturn( "shape" ).when( attrs ).getLocalName( 3 ); doReturn( URI ).when( attrs ).getURI( 3 ); doReturn( "test_qname" ).when( attrs ).getQName( 4 ); doReturn( "coords" ).when( attrs ).getLocalName( 4 ); doReturn( URI ).when( attrs ).getURI( 4 ); doReturn( "test_qname" ).when( attrs ).getQName( 5 ); doReturn( "test_local_name" ).when( attrs ).getLocalName( 5 ); doReturn( URI ).when( attrs ).getURI( 5 ); doReturn( "test_val" ).when( attrs ).getValue( 5 ); handler.startParsing( attrs ); Object mapEntry = handler.getObject(); assertThat( mapEntry, is( instanceOf( ImageMap.class ) ) ); ImageMap entry = (ImageMap) mapEntry; assertThat( entry.getAttribute( URI, "test_local_name" ), is( equalTo( "test_val" ) ) ); }
protected void startParsing( final Attributes attrs ) throws SAXException { final int length = attrs.getLength(); for ( int i = 0; i < length; i++ ) { if ( "xmlns".equals( attrs.getQName( i ) ) || attrs.getQName( i ).startsWith( "xmlns:" ) ) { continue; } final String name = attrs.getLocalName( i ); if ( name.indexOf( ':' ) > -1 ) { continue; } final String namespace = attrs.getURI( i ); final String attributeValue = attrs.getValue( i ); if ( isSameNamespace( namespace ) ) { if ( "shape".equals( name ) ) { continue; } if ( "coords".equals( name ) ) { continue; } } imageMap.setAttribute( namespace, name, attributeValue ); } }
ImageMapReadHandler extends AbstractXmlReadHandler { protected void startParsing( final Attributes attrs ) throws SAXException { final int length = attrs.getLength(); for ( int i = 0; i < length; i++ ) { if ( "xmlns".equals( attrs.getQName( i ) ) || attrs.getQName( i ).startsWith( "xmlns:" ) ) { continue; } final String name = attrs.getLocalName( i ); if ( name.indexOf( ':' ) > -1 ) { continue; } final String namespace = attrs.getURI( i ); final String attributeValue = attrs.getValue( i ); if ( isSameNamespace( namespace ) ) { if ( "shape".equals( name ) ) { continue; } if ( "coords".equals( name ) ) { continue; } } imageMap.setAttribute( namespace, name, attributeValue ); } } }
ImageMapReadHandler extends AbstractXmlReadHandler { protected void startParsing( final Attributes attrs ) throws SAXException { final int length = attrs.getLength(); for ( int i = 0; i < length; i++ ) { if ( "xmlns".equals( attrs.getQName( i ) ) || attrs.getQName( i ).startsWith( "xmlns:" ) ) { continue; } final String name = attrs.getLocalName( i ); if ( name.indexOf( ':' ) > -1 ) { continue; } final String namespace = attrs.getURI( i ); final String attributeValue = attrs.getValue( i ); if ( isSameNamespace( namespace ) ) { if ( "shape".equals( name ) ) { continue; } if ( "coords".equals( name ) ) { continue; } } imageMap.setAttribute( namespace, name, attributeValue ); } } ImageMapReadHandler(); }
ImageMapReadHandler extends AbstractXmlReadHandler { protected void startParsing( final Attributes attrs ) throws SAXException { final int length = attrs.getLength(); for ( int i = 0; i < length; i++ ) { if ( "xmlns".equals( attrs.getQName( i ) ) || attrs.getQName( i ).startsWith( "xmlns:" ) ) { continue; } final String name = attrs.getLocalName( i ); if ( name.indexOf( ':' ) > -1 ) { continue; } final String namespace = attrs.getURI( i ); final String attributeValue = attrs.getValue( i ); if ( isSameNamespace( namespace ) ) { if ( "shape".equals( name ) ) { continue; } if ( "coords".equals( name ) ) { continue; } } imageMap.setAttribute( namespace, name, attributeValue ); } } ImageMapReadHandler(); Object getObject(); }
ImageMapReadHandler extends AbstractXmlReadHandler { protected void startParsing( final Attributes attrs ) throws SAXException { final int length = attrs.getLength(); for ( int i = 0; i < length; i++ ) { if ( "xmlns".equals( attrs.getQName( i ) ) || attrs.getQName( i ).startsWith( "xmlns:" ) ) { continue; } final String name = attrs.getLocalName( i ); if ( name.indexOf( ':' ) > -1 ) { continue; } final String namespace = attrs.getURI( i ); final String attributeValue = attrs.getValue( i ); if ( isSameNamespace( namespace ) ) { if ( "shape".equals( name ) ) { continue; } if ( "coords".equals( name ) ) { continue; } } imageMap.setAttribute( namespace, name, attributeValue ); } } ImageMapReadHandler(); Object getObject();  }