Package org.htmlparser

Examples of org.htmlparser.Attribute


    */
    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

     * 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

  private void processAttributes(AnnotationFS annotation, Tag tag) {
    int size = tag.getAttributesEx().size() - 1;
    StringArray attributeName = new StringArray(jcas, size);
    StringArray attributeValue = new StringArray(jcas, size);
    for (int i = 0; i < size; i++) {
      Attribute attribute = (Attribute) tag.getAttributesEx().elementAt(i + 1);
      attributeName.set(i, attribute.getName());
      attributeValue.set(i, attribute.getValue());
    }
    Feature feature1 = annotation.getType().getFeatureByBaseName("attributeName");
    annotation.setFeatureValue(feature1, attributeName);
    Feature feature2 = annotation.getType().getFeatureByBaseName("attributeValue");
    annotation.setFeatureValue(feature2, attributeValue);
View Full Code Here

     * (and value if that is being checked too), <code>false</code> otherwise.
     */
    public boolean accept (Node node)
    {
        Tag tag;
        Attribute attribute;
        boolean ret;

        ret = false;
        if (node instanceof Tag)
        {
            tag = (Tag)node;
            attribute = tag.getAttributeEx (mAttribute);
            ret = null != attribute;
            if (ret && (null != mValue))
                ret = mValue.equals (attribute.getValue ());
        }

        return (ret);
    }
View Full Code Here

    public String toHtml (TagNode tag)
    {
        int length;
        int size;
        Vector attributes;
        Attribute attribute;
        String s;
        boolean children;
        StringBuffer ret;

        length = 2;
        attributes = tag.getAttributesEx ();
        size = attributes.size ();
        for (int i = 0; i < size; i++)
        {
            attribute = (Attribute)attributes.elementAt (i);
            length += attribute.getLength ();
        }
        ret = new StringBuffer (length);
        ret.append ("<");
        for (int i = 0; i < size; i++)
        {
            attribute = (Attribute)attributes.elementAt (i);
            attribute.toString (ret);
        }
        ret.append (">");
        s = Translate.encode (ret.toString ());
        children = null != tag.getChildren ();
        ret = new StringBuffer (s.length () + 13 + (children ? 16 : 0));
View Full Code Here

     * @param node The node with attributes to add.
     */
    protected void addAttributes (Set set, Node node)
    {
        Vector attributes;
        Attribute attribute;
        String name;
        NodeList children;

        if (node instanceof Tag)
        {
            attributes = ((Tag)node).getAttributesEx ();
            for (int i = 1; i < attributes.size (); i++)
            {
                attribute = (Attribute)attributes.elementAt (i);
                name = attribute.getName ();
                if (null != name)
                    set.add (name);
            }
            if (node instanceof CompositeTag)
            {
View Full Code Here

     * @param node The node with attributes to add.
     */
    protected void addAttributeValues (Set set, Node node)
    {
        Vector attributes;
        Attribute attribute;
        String value;
        NodeList children;

        if (node instanceof Tag)
        {
            attributes = ((Tag)node).getAttributesEx ();
            for (int i = 1; i < attributes.size (); i++)
            {
                attribute = (Attribute)attributes.elementAt (i);
                if (null != attribute.getName ())
                {
                    value = attribute.getValue ();
                    if (null != value)
                        set.add (value);
                }
            }
            if (node instanceof CompositeTag)
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.