public String getAttributeQName(Object o) { return (isAttribute(o) ? ((Attribute)o).getQualifiedName() : null); }
public String getAttributeName(int index) { return decodeAttribute(currentElement.getAttribute(index).getQualifiedName()); }
/** * <p> * Returns a string representation of the attribute * that is a well-formed XML attribute. * </p> * * @return a string containing the XML form of this attribute */ public final String toXML() { // It's a common belief that methods like this one should be // implemented using StringBuffers rather than String // concatenation for maximum performance. However, // disassembling the code shows that today's compilers are // smart enough to figure this out for themselves. The compiled // version of this class only uses a single StringBuffer. No // benefit would be gained by making the code more opaque here. return getQualifiedName() + "=\"" + escapeText(value) + "\""; }
/** * <p> * Returns a string representation of the attribute suitable for * debugging and diagnosis. However, this is not necessarily * a well-formed XML attribute. * </p> * * @return a non-XML string representation of this attribute * * @see java.lang.Object#toString() */ public final String toString() { return "[" + getClass().getName() + ": " + getQualifiedName() + "=\"" + Text.escapeLineBreaksAndTruncate(getValue()) + "\"]"; }
@Override public String getAttributeName(final int index) { return decodeAttribute(currentElement.getAttribute(index).getQualifiedName()); }
public String getAttributeName(int index) { return unescapeXmlName(currentElement.getAttribute(index).getQualifiedName()); }
public String getAttributeName(int index) { return decodeAttribute(currentElement.getAttribute(index).getQualifiedName()); }
public String getAttributeName(int index) { return unescapeXmlName(currentElement.getAttribute(index).getQualifiedName()); }
public String getAttributeName(int index) { return decodeAttribute(currentElement.getAttribute(index).getQualifiedName()); }
public String getAttributeName(int index) { return decodeAttribute(currentElement.getAttribute(index).getQualifiedName()); }
public String getAttributeName(int index) { return decodeAttribute(currentElement.getAttribute(index).getQualifiedName()); }
public String getAttributeName(int index) { return decodeAttribute(currentElement.getAttribute(index).getQualifiedName()); }
public String getAttributeName(int index) { return unescapeXmlName(currentElement.getAttribute(index).getQualifiedName()); }
/** * Get the display name of this node. For elements and attributes this is * [prefix:]localname. For unnamed nodes, it is an empty string. * * @return The display name of this node. For a node with no name, return an * empty string. */ public String getDisplayName() { switch (nodeKind) { case Type.ELEMENT: return ((Element) node).getQualifiedName(); case Type.ATTRIBUTE: return ((Attribute) node).getQualifiedName(); case Type.PROCESSING_INSTRUCTION: return ((ProcessingInstruction) node).getTarget(); default: return ""; } }
/** * Get the display name of this node. For elements and attributes this is * [prefix:]localname. For unnamed nodes, it is an empty string. * * @return The display name of this node. For a node with no name, return an * empty string. */ public String getDisplayName() { switch (nodeKind) { case Type.ELEMENT: return ((Element) node).getQualifiedName(); case Type.ATTRIBUTE: return ((Attribute) node).getQualifiedName(); case Type.PROCESSING_INSTRUCTION: return ((ProcessingInstruction) node).getTarget(); default: return ""; } }
/** * Get the display name of this node. For elements and attributes this is * [prefix:]localname. For unnamed nodes, it is an empty string. * * @return The display name of this node. For a node with no name, return an * empty string. */ public String getDisplayName() { switch (nodeKind) { case Type.ELEMENT: return ((Element) node).getQualifiedName(); case Type.ATTRIBUTE: return ((Attribute) node).getQualifiedName(); case Type.PROCESSING_INSTRUCTION: return ((ProcessingInstruction) node).getTarget(); default: return ""; } }
private static Map<String, Object> buildMetadata(Element fromElem) { Map<String, Object> metadata = Maps.newHashMap(); for (int i = 0; i < fromElem.getAttributeCount(); i++) { Attribute attr = fromElem.getAttribute(i); String uri = attr.getNamespaceURI(); String name = attr.getLocalName(); if (inTmxNamespace(uri)) { String value = attr.getValue(); metadata.put(name, value); } else if (attr.getQualifiedName().equals(XML_LANG)) { String value = attr.getValue(); metadata.put(attr.getQualifiedName(), value); } } List<String> childrenXml = getChildrenAsXml(fromElem); metadata.put(TMX_ELEMENT_CHILDREN, childrenXml); return metadata; }
/** * This method overrides the XmlElement definition so that it can allow * the definition of the href attribute. All other attributes are * shown as 'Unknown Attribute' info elements. * * @param element The element that contains the attributes * @param info The info object that will hold the validation info. */ @Override protected void processUnexpectedAttributes(Element element, SwordValidationInfo info) { int attributeCount = element.getAttributeCount(); Attribute attribute = null; for (int i = 0; i < attributeCount; i++) { attribute = element.getAttribute(i); if (!ATTRIBUTE_HREF_NAME.getLocalName().equals(attribute.getQualifiedName())) { XmlName attributeName = new XmlName(attribute.getNamespacePrefix(), attribute.getLocalName(), attribute.getNamespaceURI()); SwordValidationInfo item = new SwordValidationInfo(xmlName, attributeName, SwordValidationInfo.UNKNOWN_ATTRIBUTE, SwordValidationInfoType.INFO); item.setContentDescription(attribute.getValue()); info.addUnmarshallAttributeInfo(item); } } }
/** * This method overrides the XmlElement definition so that it can allow * the definition of the href attribute. All other attributes are * shown as 'Unknown Attribute' info elements. * * @param element The element that contains the attributes * @param info The info object that will hold the validation info. */ @Override protected void processUnexpectedAttributes(Element element, SwordValidationInfo info) { int attributeCount = element.getAttributeCount(); Attribute attribute = null; for( int i = 0; i < attributeCount; i++ ) { attribute = element.getAttribute(i); if( ! ATTRIBUTE_HREF_NAME.getLocalName().equals(attribute.getQualifiedName()) ) { XmlName attributeName = new XmlName(attribute.getNamespacePrefix(), attribute.getLocalName(), attribute.getNamespaceURI()); SwordValidationInfo item = new SwordValidationInfo(xmlName, attributeName, SwordValidationInfo.UNKNOWN_ATTRIBUTE, SwordValidationInfoType.INFO); item.setContentDescription(attribute.getValue()); info.addUnmarshallAttributeInfo(item); } } }
/** * This method overrides the XmlElement definition so that it can allow * the definition of the href attribute. All other attributes are * shown as 'Unknown Attribute' info elements. * * @param element The element that contains the attributes * @param info The info object that will hold the validation info. */ @Override protected void processUnexpectedAttributes(Element element, SwordValidationInfo info) { int attributeCount = element.getAttributeCount(); Attribute attribute = null; for( int i = 0; i < attributeCount; i++ ) { attribute = element.getAttribute(i); if( ! ATTRIBUTE_HREF_NAME.getLocalName().equals(attribute.getQualifiedName()) ) { XmlName attributeName = new XmlName(attribute.getNamespacePrefix(), attribute.getLocalName(), attribute.getNamespaceURI()); SwordValidationInfo item = new SwordValidationInfo(xmlName, attributeName, SwordValidationInfo.UNKNOWN_ATTRIBUTE, SwordValidationInfoType.INFO); item.setContentDescription(attribute.getValue()); info.addUnmarshallAttributeInfo(item); } } }