/** * Set the ending position of the attribute value. * @param end The new offset into the page at which the value ends. */ public void setValueEndPosition (int end) { mValueEnd = end; setValue (null); // uncache value }
/** * Set the starting position of the attribute value. * @param start The new offset into the page at which the value begins. */ public void setValueStartPosition (int start) { mValueStart = start; setAssignment (null); // uncache value setValue (null); // uncache value }
/** * 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)); }
/** * 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)); }
/** * 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)); }
/** * 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)); }
/** * 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)); }
/** * 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)); }
/** * 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 value of the attribute. * The part after the equals sign, or the text if it's just a whitepace * 'attribute'. * <em>NOTE:</em> This does not include any quotes that may have enclosed * the value when it was read. To get the un-stripped value use * {@link #getRawValue}. * @return The value, or <code>null</code> if it's a stand-alone or * empty attribute, or the text if it's just a whitepace 'attribute'. */ public String getValue () { String ret; ret = super.getValue (); if (null == ret) { if ((null != mPage) && (0 <= mValueEnd)) { ret = mPage.getText (mValueStart, mValueEnd); setValue (ret); // cache the value } } return (ret); }
setValue (value); setQuote (quote);
setValue (value); setQuote (quote);
/** * 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); } }
if (null != attribute) attribute.setValue (value); if (0 != quote) attribute.setQuote (quote);
if (null != attribute) attribute.setValue (value); if (0 != quote) attribute.setQuote (quote);