Package org.htmlparser

Examples of org.htmlparser.Attribute


     *         is out of range.
     * @see #getLength
     */
    public String getQName (int index)
    {
        Attribute attribute;
        String ret;
       
        attribute = (Attribute)(mTag.getAttributesEx ().elementAt (index + 1));
        if (attribute.isWhitespace ())
            ret = "#text";
        else
            ret = attribute.getName ();
       
        return (ret);
    }
View Full Code Here


     *         index is out of range.
     * @see #getLength
     */
    public String getValue (int index)
    {
        Attribute attribute;
        String ret;
       
        attribute = (Attribute)(mTag.getAttributesEx ().elementAt (index + 1));
        ret = attribute.getValue ();
        if (null == ret)
            ret = "";

        return (ret);
    }
View Full Code Here

     */
    public int getIndex (String uri, String localName)
    {
        Vector attributes;
        int size;
        Attribute attribute;
        String string;
        int ret;

        ret = -1;

        attributes = mTag.getAttributesEx ();
        if (null != attributes)
        {
            size = attributes.size ();
            for (int i = 1; i < size; i++)
            {
                attribute = (Attribute)attributes.elementAt (i);
                string = attribute.getName ();
                if (null != string) // not whitespace
                {
                    mSupport.processName (string, mParts, true);
                    if uri.equals (mParts[0])
                        & localName.equalsIgnoreCase (mParts[1]))
View Full Code Here

    {
        assertStringEquals (displayMessage+"\ntag name", expectedTag.getTagName (), actualTag.getTagName ());
        Vector v = actualTag.getAttributesEx ();
        for (int i = 1; i < v.size (); i++)
        {
            Attribute a = (Attribute)v.elementAt (i);
            if (a.isWhitespace ())
                continue;
            String expectedValue = expectedTag.getAttribute (a.getName ());
            if (null == expectedValue)
                fail("\nActual tag had extra attribute: " + a.getName () + displayMessage);
        }
    }
View Full Code Here

    {
        assertStringEquals (displayMessage+"\ntag name", expectedTag.getTagName (), actualTag.getTagName ());
        Vector v = actualTag.getAttributesEx ();
        for (int i = 1; i < v.size (); i++)
        {
            Attribute a = (Attribute)v.elementAt (i);
            if (a.isWhitespace ())
                continue;
            String actualValue = actualTag.getAttribute (a.getName ());
            String expectedValue = expectedTag.getAttribute (a.getName ());

            assertStringEquals(
                "\nvalue for attribute " + a.getName () + " in tag "+expectedTag.getTagName()+" expected="+expectedValue+" but was "+actualValue+
                "\n\nComplete Tag expected:\n"+expectedTag.toHtml()+
                "\n\nComplete Tag actual:\n"+actualTag.toHtml()+
                displayMessage,
                expectedValue,
                actualValue
View Full Code Here

     * Set the <code>HTTP-EQUIV</code> attribute.
     * @param httpEquiv The new value of the <code>HTTP-EQUIV</code> attribute.
     */
    public void setHttpEquiv (String httpEquiv)
    {
        Attribute equiv;
        equiv = getAttributeEx ("HTTP-EQUIV");
        if (null != equiv)
            equiv.setValue (httpEquiv);
        else
            getAttributesEx ().add (new Attribute ("HTTP-EQUIV", httpEquiv));
    }
View Full Code Here

     * Set the <code>CONTENT</code> attribute.
     * @param metaTagContents The new value of the <code>CONTENT</code> attribute.
     */
    public void setMetaTagContents (String metaTagContents)
    {
        Attribute content;
        content = getAttributeEx ("CONTENT");
        if (null != content)
            content.setValue (metaTagContents);
        else
            getAttributesEx ().add (new Attribute ("CONTENT", metaTagContents));
    }
View Full Code Here

     * Set the <code>NAME</code> attribute.
     * @param metaTagName The new value of the <code>NAME</code> attribute.
     */
    public void setMetaTagName (String metaTagName)
    {
        Attribute name;
        name = getAttributeEx ("NAME");
        if (null != name)
            name.setValue (metaTagName);
        else
            getAttributesEx ().add (new Attribute ("NAME", metaTagName));
    }
View Full Code Here

    */
    public String extractImageLocn ()
    {
        Vector attributes;
        int size;
        Attribute attribute;
        String string;
        String data;
        int state;
        String name;
        String ret;
   
        // TODO: move this logic into the lexer?

        ret = "";
        state = 0;
        attributes = getAttributesEx ();
        size = attributes.size ();
        for (int i = 0; (i < size) && (state < 3); i++)
        {
            attribute = (Attribute)attributes.elementAt (i);
            string = attribute.getName ();
            data = attribute.getValue ();
            switch (state)
            {
                case 0: // looking for 'src'
                    if (null != string)
                    {
View Full Code Here

        for (Enumeration e = newAppletParams.keys (); e.hasMoreElements (); )
        {
            attributes = new Vector (); // should the tag copy the attributes?
            paramName = (String)e.nextElement ();
            paramValue = (String)newAppletParams.get (paramName);
            attributes.addElement (new Attribute ("PARAM", null));
            attributes.addElement (new Attribute (" "));
            attributes.addElement (new Attribute ("VALUE", paramValue, '"'));
            attributes.addElement (new Attribute (" "));
            attributes.addElement (new Attribute ("NAME", paramName, '"'));
            tag = new TagNode (null, 0, 0, attributes);
            kids.add (tag);
        }

        //set kids as new children
View Full Code Here

TOP

Related Classes of org.htmlparser.Attribute

Copyright © 2018 www.massapicom. 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.