/** * Predicate to determine if this attribute is whitespace. * @return <code>true</code> if this attribute is whitespace, * <code>false</code> if it is a real attribute. */ public boolean isWhitespace () { return (null == getName ()); }
/** * Predicate to determine if this attribute is whitespace. * @return <code>true</code> if this attribute is whitespace, * <code>false</code> if it is a real attribute. */ public boolean isWhitespace () { return (((null == super.getName ()) && (null == mPage)) || ((null != mPage) && (0 > mNameStart))); }
/** * Predicate to determine if this attribute is whitespace. * @return <code>true</code> if this attribute is whitespace, * <code>false</code> if it is a real attribute. */ public boolean isWhitespace () { return (null == getName ()); }
/** * Predicate to determine if this attribute is whitespace. * @return <code>true</code> if this attribute is whitespace, * <code>false</code> if it is a real attribute. */ public boolean isWhitespace () { return (((null == super.getName ()) && (null == mPage)) || ((null != mPage) && (0 > mNameStart))); }
/** * Predicate to determine if this attribute has no equals sign (or value). * @return <code>true</code> if this attribute is a standalone attribute. * <code>false</code> if has an equals sign. */ public boolean isStandAlone () { return ((null != getName ()) && (null == getAssignment ())); }
/** * Predicate to determine if this attribute has no equals sign (or value). * @return <code>true</code> if this attribute is a standalone attribute. * <code>false</code> if has an equals sign. */ public boolean isStandAlone () { return ((null != getName ()) && (null == getAssignment ())); }
@SuppressWarnings("unchecked") private Map<String, String> getAttributes(org.htmlparser.Tag tag) { Map<String, String> result = new HashMap<String, String>(); List<?> original = tag.getAttributesEx(); List<Attribute> list = new ArrayList<Attribute>((Collection<? extends Attribute>) original .subList(1, original.size())); for (Attribute a : list) { if (a.getName() != null && !a.getName().equals("/") && !a.isWhitespace()) { result.put(a.getName(), a.getValue()); } } return result; } }
/** * Return the name of this tag. * @return The tag name or null if this tag contains nothing or only * whitespace. */ public String getRawTagName () { List attributes; String ret; ret = null; attributes = getAttributesEx (); if (0 != attributes.size ()) ret = ((Attribute)attributes.get (0)).getName (); return (ret); }
/** * Return the name of this tag. * @return The tag name or null if this tag contains nothing or only * whitespace. */ public String getRawTagName () { Vector attributes; String ret; ret = null; attributes = getAttributesEx (); if (0 != attributes.size ()) ret = ((Attribute)attributes.elementAt (0)).getName (); return (ret); }
/** * Get the name of this attribute. * @param buffer The buffer to place the name in. * @see #getName() */ public void getName (StringBuilder buffer) { String name; name = super.getName (); if (null == name) { if ((null != mPage) && (0 <= mNameStart)) mPage.getText (buffer, mNameStart, mNameEnd); } else buffer.append (name); }
/** * Get the name of this attribute. * @param buffer The buffer to place the name in. * @see #getName() */ public void getName (StringBuffer buffer) { String name; name = super.getName (); if (null == name) { if ((null != mPage) && (0 <= mNameStart)) mPage.getText (buffer, mNameStart, mNameEnd); } else buffer.append (name); }
/** * Look up an attribute's XML qualified (prefixed) name by index. * * @param index The attribute index (zero-based). * @return The XML qualified name, or the empty string * if none is available, or null if the index * is out of range. * @see #getLength */ public String getQName (int index) { Attribute attribute; String ret; attribute = (Attribute)(getAttributes ().elementAt (index)); ret = attribute.getName (); return (ret); }
/** * Get a text representation of this attribute. * @param buffer The accumulator for placing the text into. * @see #toString() */ public void toString (StringBuffer buffer) { getName (buffer); getAssignment (buffer); getRawValue (buffer); }
/** * Get a text representation of this attribute. * @param buffer The accumulator for placing the text into. * @see #toString() */ public void toString (StringBuilder buffer) { getName (buffer); getAssignment (buffer); getRawValue (buffer); }
private static Vector cloneAttributes(Vector<Attribute> attributes) { Vector<Attribute> newAttributes = new Vector<>(attributes.size()); for (Attribute a : attributes) { newAttributes.add(new Attribute(a.getName(), a.getAssignment(), a.getValue(), a.getQuote())); } return newAttributes; }
private static Vector cloneAttributes(Vector<Attribute> attributes) { Vector<Attribute> newAttributes = new Vector<>(attributes.size()); for (Attribute a : attributes) { newAttributes.add(new Attribute(a.getName(), a.getAssignment(), a.getValue(), a.getQuote())); } return newAttributes; }
/** * Look up an attribute's XML qualified (prefixed) name by index. * * @param index The attribute index (zero-based). * @return The XML qualified name, or the empty string * if none is available, or null if the index * is out of range. * @see #getLength */ public String getQName (int index) { Attribute attribute; String ret; attribute = (Attribute)(mTag.getAttributesEx ().get (index + 1)); if (attribute.isWhitespace ()) ret = "#text"; else ret = attribute.getName (); return (ret); }
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); }
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); }