Java Code Examples for org.apache.axiom.om.OMAttribute#getLocalName()

The following examples show how to use org.apache.axiom.om.OMAttribute#getLocalName() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Metadata.java    From openxds with Apache License 2.0 6 votes vote down vote up
OMElement dup_wrapper1(OMElement e) {
	OMElement e_dup = om_factory().createOMElement(e.getLocalName(),
			e.getNamespace());
	for (Iterator it = e.getAllAttributes(); it.hasNext();) {
		OMAttribute a = (OMAttribute) it.next();
		String name = a.getLocalName();
		String value = a.getAttributeValue();
		e_dup.addAttribute(name, value, null);
	}
	if (e.getLocalName().equals(wrapper.getLocalName())) {
		wrapperDup = e_dup;
		return e_dup;
	}
	for (Iterator it = e.getChildElements(); it.hasNext();) {
		OMElement ele = (OMElement) it.next();
		OMElement ele_dup = dup_wrapper1(ele);
		e_dup.addChild(ele_dup);
	}
	return e_dup;
}
 
Example 2
Source File: HttpRequestHashGenerator.java    From micro-integrator with Apache License 2.0 5 votes vote down vote up
/**
 * This is an overloaded method for getting the expanded name as namespaceURI followed by the local name for
 * OMAttribute.
 *
 * @param attribute - OMAttribute of which the expanded name is retrieved
 * @return expanded name of the OMAttribute as an String in the form {ns-uri:local-name}
 */
public String getExpandedName(OMAttribute attribute) {

    if (attribute.getNamespace() != null) {
        return attribute.getNamespace().getNamespaceURI() + ":" + attribute.getLocalName();
    } else {
        return attribute.getLocalName();
    }
}
 
Example 3
Source File: DOMHASHGenerator.java    From micro-integrator with Apache License 2.0 5 votes vote down vote up
/**
 * This is an overloaded method for getting the expanded name as namespaceURI followed by the local name for
 * OMAttribute.
 *
 * @param attribute - OMAttribute of which the expanded name is retrieved
 * @return expanded name of the OMAttribute as an String in the form {ns-uri:local-name}
 */
public String getExpandedName(OMAttribute attribute) {

    if (attribute.getNamespace() != null) {
        return attribute.getNamespace().getNamespaceURI() + ":" + attribute.getLocalName();
    } else {
        return attribute.getLocalName();
    }
}
 
Example 4
Source File: RegistryErrorList.java    From openxds with Apache License 2.0 5 votes vote down vote up
HashMap<String, String> getErrorDetails(OMElement registryError) {
	HashMap<String, String>  err = new HashMap<String, String>();

	for (Iterator<OMAttribute> it=registryError.getAllAttributes(); it.hasNext(); ) {
		OMAttribute att = it.next();
		String name = att.getLocalName();
		String value = att.getAttributeValue();
		err.put(name, value);
	}

	return err;
}
 
Example 5
Source File: TranslateToV2.java    From openxds with Apache License 2.0 5 votes vote down vote up
protected void copy_attributes(OMElement from, OMElement to) {
		String element_name = from.getLocalName();
		for (Iterator it=from.getAllAttributes(); it.hasNext();  ) {
			OMAttribute from_a = (OMAttribute) it.next();
			String name = from_a.getLocalName();
			String value = from_a.getAttributeValue();
			OMNamespace xml_namespace = MetadataSupport.xml_namespace;
			OMNamespace namespace = null;
			if (name.endsWith("status"))
				value = translate_att(value);
			else if (name.endsWith("associationType"))
				value = translate_att(value);
			else if (name.equals("minorVersion"))
				continue;
			else if (name.equals("majorVersion"))
				continue;
			else if (name.equals("lang"))
				namespace = xml_namespace;
			else if (name.equals("objectType") && value.startsWith("urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:")) {
				String[] parts = value.split(":");
				value = parts[parts.length-1];
			}
//			else if (name.equals("objectType") && ! value.startsWith("urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:"))
//			value = "urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:" + value;
			OMAttribute to_a = MetadataSupport.om_factory.createOMAttribute(name, namespace, value);
			to.addAttribute(to_a);
		}
		
	}