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

The following are Jave code examples for showing how to use getText() 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: DleseCollectionFileIndexingWriter.java   View Source Code Vote up 5 votes
/**
 *  Gets the status of the collection based on the values in the collection-level record.
 *
 * @param  doc  A dlese_collect XML Document
 * @return      The currentCollectionStatus value
 */
public final static String getCurrentCollectionStatus(org.dom4j.Document doc) {
	List nodes = doc.selectNodes("/*[local-name()='collectionRecord']/*[local-name()='approval']/*[local-name()='collectionStatuses']/*[local-name()='collectionStatus']");

	if (nodes == null || nodes.size() == 0)
		return "Error: no collectionStatus elements found in the XML";

	Collections.sort(nodes, new CollectionAccessionStatusComparator());

	Element collectionStatus = (Element) nodes.get(0);
	Attribute collecitonState = collectionStatus.attribute("state");

	return collecitonState.getText();
}
 
Example 2
Project: joai-project   File: SchemaReader.java   View Source Code Vote up 5 votes
/**
 *  Determines the targetNamespace of the schema document. If a "targetNamespace" is explicitly declared, then
 this is returned. Otherwise, the "defaultTargetNamespaceURI" is used.
 *
 * @param  defaultTargetNamespaceURI  NOT YET DOCUMENTED
 * @return                            The targetNamespace value
 */
private String getTargetNamespaceUri(String defaultTargetNamespaceURI) {
	Attribute tnsAttribute = root.attribute("targetNamespace");
	if (tnsAttribute != null)
		return tnsAttribute.getText();
	else
		return defaultTargetNamespaceURI;
}