use of org.apache.axiom.om.impl.intf.AxiomAttribute in project webservices-axiom by apache.
the class OMFactoryImpl method importAttribute.
private AxiomAttribute importAttribute(OMAttribute attribute) {
AxiomAttribute importedAttribute = createNode(AxiomAttribute.class);
copyName(attribute, importedAttribute);
importedAttribute.setAttributeValue(attribute.getAttributeValue());
return importedAttribute;
}
use of org.apache.axiom.om.impl.intf.AxiomAttribute in project webservices-axiom by apache.
the class OMFactoryImpl method createOMAttribute.
@Override
public final OMAttribute createOMAttribute(String localName, OMNamespace ns, String value) {
if (ns != null && ns.getPrefix() == null) {
String namespaceURI = ns.getNamespaceURI();
if (namespaceURI.length() == 0) {
ns = null;
} else {
ns = new OMNamespaceImpl(namespaceURI, generatePrefix(namespaceURI));
}
}
if (ns != null) {
if (ns.getNamespaceURI().length() == 0) {
if (ns.getPrefix().length() > 0) {
throw new IllegalArgumentException("Cannot create a prefixed attribute with an empty namespace name");
} else {
ns = null;
}
} else if (ns.getPrefix().length() == 0) {
throw new IllegalArgumentException("Cannot create an unprefixed attribute with a namespace");
}
}
AxiomAttribute attr = createNode(AxiomAttribute.class);
attr.internalSetLocalName(localName);
try {
attr.coreSetCharacterData(value, AxiomSemantics.INSTANCE);
} catch (CoreModelException ex) {
throw AxiomExceptionTranslator.translate(ex);
}
attr.internalSetNamespace(ns);
attr.coreSetType("CDATA");
return attr;
}
Aggregations