Java Code Examples for org.dom4j.Attribute.getQualifiedName()

The following are Jave code examples for showing how to use getQualifiedName() of the org.dom4j.Attribute class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: joai-project   File: StructureWalker.java   View Source Code Vote up 5 votes
/**
 *  Gets the path attribute of the StructureWalker object
 *
 * @param  a  Description of the Parameter
 * @return    The path value
 */
public String getPath(Attribute a) {
	prtln("getPath: attribute: " + a.asXML(), 1);
	prtln(" ... attributeName: " + a.getName(), 1);
	prtln(" ... qualifiedName: " + a.getQualifiedName(), 1);
	Element parent = a.getParent();
	if (parent == null) {
		prtln(" ... parent is null!", 1);
	}
	// return getPath((Node) a);
	return getPath(parent) + "/@" + a.getQualifiedName();
}
 
Example 2
Project: joai-project   File: DocumentPruner.java   View Source Code Vote up 5 votes
/**
 *  Gets the attributePath attribute of the DocumentPruner class
 *
 * @param  a  NOT YET DOCUMENTED
 * @return    The attributePath value
 */
private static String getAttributePath(Attribute a) {

	Element parent = a.getParent();
	if (parent == null) {
		prtln(" ... parent is null!");
	}
	return parent.getPath() + "/@" + a.getQualifiedName();
}
 
Example 3
Project: joai-project   File: SchemEditForm.java   View Source Code Vote up 5 votes
/**
 *  Return true if the node specified by key exists in the instance document
 *  and it has a required attribute in the instance document.
 *
 * @param  key  a jsp-encoded xpath
 * @return      The nodeExistsWithRequiredAttribute value
 */
public String getNodeExistsWithRequiredAttribute(String key) {
	String xpath = XPathUtils.decodeXPath(key);
	Node node = docMap.selectSingleNode(xpath);
	if (node == null) {
		return FALSE;
	}
	if (node.getNodeType() != Node.ELEMENT_NODE) {
		return FALSE;
	}
	Element element = (Element) node;
	if (element.attributes().isEmpty()) {
		return FALSE;
	}

	/* check attributes for a required one */
	for (Iterator i = element.attributeIterator(); i.hasNext(); ) {
		Attribute attribute = (Attribute) i.next();
		String attPath = xpath + "/@" + attribute.getQualifiedName();
		SchemaNode schemaNode = this.schemaHelper.getSchemaNode(attPath);
		if (schemaNode == null) {
			// prtln ("schemaNode not found for attribute (" + attPath + ")");
			continue;
		}
		if (schemaNode.isRequired())
			return TRUE;
	}
	return FALSE;
}