/** * Set the starting position of the attribute name. * @param start The new offset into the page at which the name begins. */ public void setNameStartPosition (int start) { mNameStart = start; setName (null); // uncache value }
/** * Set the ending position of the attribute name. * @param end The new offset into the page at which the name ends. */ public void setNameEndPosition (int end) { mNameEnd = end; setName (null); // uncache value setAssignment (null); // uncache value }
/** * Adds a tag that will be preserved by <code>{@link #stripHtml(String)}</code>.<p> * * @param tagName the name of the tag to keep (case insensitive) * * @return true if the tagName was added correctly to the internal engine */ public boolean addPreserveTag(final String tagName) { Vector<Attribute> attributeList = new Vector<Attribute>(1); Attribute tagNameAttribute = new Attribute(); tagNameAttribute.setName(tagName.toLowerCase()); attributeList.add(tagNameAttribute); Tag keepTag = m_nodeFactory.createTagNode(null, 0, 0, attributeList); boolean result = m_nodeFactory.addTagPreserve(keepTag); return result; }
/** * Adds a tag that will be preserved by <code>{@link #stripHtml(String)}</code>.<p> * * @param tagName the name of the tag to keep (case insensitive) * * @return true if the tagName was added correctly to the internal engine */ public boolean addPreserveTag(final String tagName) { Vector attributeList = new Vector(1); Attribute tagNameAttribute = new Attribute(); tagNameAttribute.setName(tagName.toLowerCase()); attributeList.add(tagNameAttribute); Tag keepTag = m_nodeFactory.createTagNode(null, 0, 0, attributeList); boolean result = m_nodeFactory.addTagPreserve(keepTag); return result; }
/** * Create a whitespace attribute with the value given. * @param value The value of this attribute. * @exception IllegalArgumentException if the value contains other than * whitespace. To set a real value use {@link #Attribute(String,String)}. */ public Attribute (String value) throws IllegalArgumentException { if (0 != value.trim ().length ()) throw new IllegalArgumentException ("non whitespace value"); else { setName (null); setAssignment (null); setValue (value); setQuote ((char)0); } }
/** * Create a whitespace attribute with the value given. * @param value The value of this attribute. * @exception IllegalArgumentException if the value contains other than * whitespace. To set a real value use {@link #Attribute(String,String)}. */ public Attribute (String value) throws IllegalArgumentException { if (0 != value.trim ().length ()) throw new IllegalArgumentException ("non whitespace value"); else { setName (null); setAssignment (null); setValue (value); setQuote ((char)0); } }
/** * Get the name of this attribute. * The part before the equals sign, or the contents of the * stand-alone attribute. * @return The name, or <code>null</code> if it's just a whitepace * 'attribute'. */ public String getName () { String ret; ret = super.getName (); if (null == ret) { if ((null != mPage) && (0 <= mNameStart)) { ret = mPage.getText (mNameStart, mNameEnd); setName (ret); // cache the value } } return (ret); }
Vector attributeList = new Vector(1); Attribute tagNameAttribute = new Attribute(); tagNameAttribute.setName(tagName); attributeList.add(tagNameAttribute); deleteTag = m_nodeFactory.createTagNode(null, 0, 0, attributeList);
/** * Create an attribute. * @param page The page containing the attribute. * @param name_start The starting offset of the name within the page. * If this is negative, the name is considered null. * @param name_end The ending offset of the name within the page. * @param value_start he starting offset of the value within the page. * If this is negative, the value is considered null. * @param value_end The ending offset of the value within the page. * @param quote The quote, if any, surrounding the value of the attribute, * (i.e. ' or "), or zero if none. */ public PageAttribute (Page page, int name_start, int name_end, int value_start, int value_end, char quote) { mPage = page; mNameStart = name_start; mNameEnd = name_end; mValueStart = value_start; mValueEnd = value_end; setName (null); setAssignment (null); setValue (null); setQuote (quote); }
/** * Create an attribute with the name, assignment, value and quote given. * If the quote value is zero, assigns the value using {@link #setRawValue} * which sets the quote character to a proper value if necessary. * @param name The name of this attribute. * @param assignment The assignment string of this attribute. * @param value The value of this attribute. * @param quote The quote around the value of this attribute. */ public Attribute (String name, String assignment, String value, char quote) { setName (name); setAssignment (assignment); if (0 == quote) setRawValue (value); else { setValue (value); setQuote (quote); } }
/** * Create an attribute with the name, assignment, value and quote given. * If the quote value is zero, assigns the value using {@link #setRawValue} * which sets the quote character to a proper value if necessary. * @param name The name of this attribute. * @param assignment The assignment string of this attribute. * @param value The value of this attribute. * @param quote The quote around the value of this attribute. */ public Attribute (String name, String assignment, String value, char quote) { setName (name); setAssignment (assignment); if (0 == quote) setRawValue (value); else { setValue (value); setQuote (quote); } }