Examples of AttributesImpl


Examples of org.xml.sax.helpers.AttributesImpl

    {
        final SAXConfigurationHandler handler = new SAXConfigurationHandler();
        final String qName = "myElement";
        final String childName = "myChild";
        final String value = "value";
        handler.startElement( "", "", qName, new AttributesImpl() );
        handler.characters( value.toCharArray(), 0, value.length() );
        handler.startElement( "", "", childName, new AttributesImpl() );
        handler.endElement( "", "", childName );
        try
        {
            handler.endElement( "", "", qName );
        }
View Full Code Here

Examples of org.xml.sax.helpers.AttributesImpl

        throws Exception
    {
        final SAXConfigurationHandler handler = new SAXConfigurationHandler();
        final String qName = "myElement";
        final String value = "   \n   \t";
        handler.startElement( "", "", qName, new AttributesImpl() );
        handler.characters( value.toCharArray(), 0, value.length() );
        handler.endElement( "", "", qName );
        final Configuration configuration = handler.getConfiguration();
        assertEquals( "configuration.name", qName, configuration.getName() );
        assertEquals( "configuration.location", "", configuration.getLocation() );
View Full Code Here

Examples of org.xml.sax.helpers.AttributesImpl

    public void testCreateConfigurationWithAttributes()
        throws Exception
    {
        final SAXConfigurationHandler handler = new SAXConfigurationHandler();
        final String qName = "myElement";
        final AttributesImpl attributes = new AttributesImpl();
        attributes.addAttribute( "", "", "key", "CDATA", "value" );
        handler.startElement( "", "", qName, attributes );
        handler.endElement( "", "", qName );
        final Configuration configuration = handler.getConfiguration();
        assertEquals( "configuration.name", qName, configuration.getName() );
        assertEquals( "configuration.location", "", configuration.getLocation() );
View Full Code Here

Examples of org.xml.sax.helpers.AttributesImpl

    public void testCreateConfigurationWithAttributesWithInterception()
        throws Exception
    {
        final SAXConfigurationHandler handler = new MockSAXConfigurationHandler();
        final String qName = "myElement";
        final AttributesImpl attributes = new AttributesImpl();
        attributes.addAttribute( "", "", "key", "CDATA", "value" );
        handler.startElement( "", "", qName, attributes );
        handler.endElement( "", "", qName );
        final Configuration configuration = handler.getConfiguration();
        assertEquals( "configuration.name", qName, configuration.getName() );
        assertEquals( "configuration.location", "", configuration.getLocation() );
View Full Code Here

Examples of org.xml.sax.helpers.AttributesImpl

    public void testSerializeZeroLengthAttributes()
        throws Exception
    {
        final DefaultConfiguration configuration = new DefaultConfiguration( "element", "", "" );
        final SAXConfigurationSerializer serializer = new SAXConfigurationSerializer();
        final AttributesImpl attributes = serializer.serializeAttributes( configuration );
        assertEquals( "attributes.getLength()", 0, attributes.getLength() );
    }
View Full Code Here

Examples of org.xml.sax.helpers.AttributesImpl

        final DefaultConfiguration configuration = new DefaultConfiguration( "element", "", "" );
        final String name = "key";
        final String value = "value";
        configuration.setAttribute( name, value );
        final SAXConfigurationSerializer serializer = new SAXConfigurationSerializer();
        final AttributesImpl attributes = serializer.serializeAttributes( configuration );
        assertEquals( "attributes.getLength()", 1, attributes.getLength() );
        assertEquals( "attributes.getLocalName(0)", name, attributes.getLocalName( 0 ) );
        assertEquals( "attributes.getQName(0)", name, attributes.getQName( 0 ) );
        assertEquals( "attributes.getURI(0)", "", attributes.getURI( 0 ) );
        assertEquals( "attributes.getType(0)", "CDATA", attributes.getType( 0 ) );
        assertEquals( "attributes.getType(0)", value, attributes.getValue( 0 ) );
    }
View Full Code Here

Examples of org.xml.sax.helpers.AttributesImpl

     */
    void serializeElement( final Configuration configuration,
                           final ContentHandler handler )
        throws SAXException
    {
        final AttributesImpl attributes = serializeAttributes( configuration );

        final String name = configuration.getName();
        handler.startElement( EMPTY_NAMESPACE, name, name, attributes );

        String value = configuration.getValue( null );
View Full Code Here

Examples of org.xml.sax.helpers.AttributesImpl

     * @param configuration the configuration
     * @return the AttributesImpl instance
     */
    AttributesImpl serializeAttributes( final Configuration configuration )
    {
        final AttributesImpl attributes = new AttributesImpl();
        final String[] names = configuration.getAttributeNames();
        for( int i = 0; i < names.length; i++ )
        {
            final String name = names[ i ];
            final String value = configuration.getAttribute( name, "" );
            attributes.addAttribute( EMPTY_NAMESPACE, name, name,
                                     CDATA_TYPE, value );
        }
        return attributes;
    }
View Full Code Here

Examples of org.xml.sax.helpers.AttributesImpl

    protected void startTokenHighlight(XMLOutput output, String cssClass) throws SAXException
    {
        if (cssClass != null)
        {
            AttributesImpl attributes = new AttributesImpl();
            attributes.addAttribute("", "class", "class", "string", cssClass);
            output.startElement("div", attributes);
        }
    }
View Full Code Here

Examples of org.xml.sax.helpers.AttributesImpl

  }

  protected void write(Element element, NamespaceStack namespaceStack)
      throws SAXException {
    int stackSize = namespaceStack.size();
    AttributesImpl namespaceAttributes = startPrefixMapping(element,
        namespaceStack);
    startElement(element, namespaceAttributes);
    writeContent(element, namespaceStack);
    endElement(element);
    endPrefixMapping(namespaceStack, stackSize);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.