Search in sources :

Example 1 with XmlAttribute

use of org.eclipse.sapphire.modeling.xml.XmlAttribute in project liferay-ide by liferay.

the class QNamespaceValueBinding method read.

/**
 * (non-Javadoc)
 *
 * @see org.eclipse.sapphire.modeling.ValuePropertyBinding#read()
 */
@Override
public String read() {
    String value = null;
    XmlElement parent = xml(false);
    XmlElement qNameElement = null;
    if (parent.getLocalName().equals(params[0])) {
        qNameElement = parent;
    } else {
        qNameElement = parent.getChildElement(params[0], false);
    }
    if (qNameElement != null) {
        // System.out.println( qNameElement );
        List<XmlAttribute> listOfAttibutes = qNameElement.getAttributes();
        XmlAttribute xmlAttribute = listOfAttibutes != null && listOfAttibutes.size() > 0 ? listOfAttibutes.get(0) : null;
        if (xmlAttribute != null) {
            value = xmlAttribute.getText();
        }
    }
    if (value != null) {
        return value.trim();
    }
    return value;
}
Also used : XmlAttribute(org.eclipse.sapphire.modeling.xml.XmlAttribute) XmlElement(org.eclipse.sapphire.modeling.xml.XmlElement)

Aggregations

XmlAttribute (org.eclipse.sapphire.modeling.xml.XmlAttribute)1 XmlElement (org.eclipse.sapphire.modeling.xml.XmlElement)1