本文整理了Java中org.apache.axiom.om.OMElement.findNamespaceURI()
方法的一些代码示例,展示了OMElement.findNamespaceURI()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。OMElement.findNamespaceURI()
方法的具体详情如下:
包路径:org.apache.axiom.om.OMElement
类名称:OMElement
方法名:findNamespaceURI
[英]Checks for a namespace in the context of this element with the given prefix and returns the relevant namespace object, if available. If not available, returns null.
[中]检查此元素上下文中具有给定前缀的名称空间,并返回相关名称空间对象(如果可用)。如果不可用,则返回null。
代码示例来源:origin: org.apache.ws.commons.axiom/axiom-impl
String getNamespaceURI(String prefix) {
if (currentEvent == START_ELEMENT || currentEvent == END_ELEMENT) {
if (node instanceof OMElement) {
OMNamespace namespaceURI =
((OMElement) node).findNamespaceURI(prefix);
return namespaceURI != null ? namespaceURI.getNamespaceURI() : null;
}
}
return null;
}
代码示例来源:origin: org.apache.ws.commons.axiom/om-aspects
String getNamespaceURI(String prefix) {
if (currentEvent == START_ELEMENT || currentEvent == END_ELEMENT) {
if (node instanceof OMElement) {
OMNamespace namespaceURI =
((OMElement) node).findNamespaceURI(prefix);
return namespaceURI != null ? namespaceURI.getNamespaceURI() : null;
}
}
return null;
}
代码示例来源:origin: org.bluestemsoftware.open.eoa.ext/open-eoa-aspect-axiom
public OMNamespace findNamespaceURI(String prefix) {
OMNamespace ns = this.namespaces == null ?
null :
(OMNamespace) this.namespaces.get(prefix);
if (ns == null && this.parentNode instanceof OMElement) {
// try with the parent
ns = ((OMElement) this.parentNode).findNamespaceURI(prefix);
}
return ns;
}
代码示例来源:origin: org.apache.ws.commons.axiom/axiom-impl
protected String doGetNamespaceURI(String prefix) {
OMNamespace ns = element.findNamespaceURI(prefix);
return ns == null ? XMLConstants.NULL_NS_URI : ns.getNamespaceURI();
}
代码示例来源:origin: org.apache.axis2/axis2-saaj
public String getNamespaceURI(String prefix) {
OMNamespace ns = omTarget.findNamespaceURI(prefix);
return ns != null ? ns.getNamespaceURI() : null;
}
代码示例来源:origin: org.apache.ws.commons.axiom/om-aspects
protected String doGetNamespaceURI(String prefix) {
OMNamespace ns = element.findNamespaceURI(prefix);
return ns == null ? XMLConstants.NULL_NS_URI : ns.getNamespaceURI();
}
代码示例来源:origin: org.apache.ws.commons.axiom/axiom-common-impl
protected String doGetNamespaceURI(String prefix) {
OMNamespace ns = element.findNamespaceURI(prefix);
return ns == null ? XMLConstants.NULL_NS_URI : ns.getNamespaceURI();
}
代码示例来源:origin: apache/axis2-java
public String getNamespaceURI(String prefix) {
OMNamespace ns = omTarget.findNamespaceURI(prefix);
return ns != null ? ns.getNamespaceURI() : null;
}
代码示例来源:origin: org.apache.ws.commons.axiom/axiom-impl
private OMNamespace getOMNamespace(String prefix, String namespaceURI, boolean isDecl) {
if (prefix == null) {
prefix = "";
}
if (namespaceURI == null) {
namespaceURI = "";
}
if (!isDecl && namespaceURI.length() == 0) {
return null;
} else {
if (parent != null) {
// If possible, locate an existing OMNamespace object
OMNamespace ns = parent.findNamespaceURI(prefix);
if (ns != null && ns.getNamespaceURI().equals(namespaceURI)) {
return ns;
}
}
return factory.createOMNamespace(namespaceURI, prefix);
}
}
代码示例来源:origin: org.apache.ws.commons.axiom/om-aspects
private OMNamespace getOMNamespace(String prefix, String namespaceURI, boolean isDecl) {
if (prefix == null) {
prefix = "";
}
if (namespaceURI == null) {
namespaceURI = "";
}
if (!isDecl && namespaceURI.length() == 0) {
return null;
} else {
if (parent != null) {
// If possible, locate an existing OMNamespace object
OMNamespace ns = parent.findNamespaceURI(prefix);
if (ns != null && ns.getNamespaceURI().equals(namespaceURI)) {
return ns;
}
}
return factory.createOMNamespace(namespaceURI, prefix);
}
}
代码示例来源:origin: org.wso2.bpel/ode-bpel-epr
/**
* Axiom is supposed to handle this properly however this method is buggy and doesn't work (whereas setting a QName as text
* works).
*
* @param elmt
* @return text qname
*/
public static QName getTextAsQName(OMElement elmt) {
QName qname = elmt.getTextAsQName();
// The getTextAsQName is buggy, it sometimes return the full text without extracting namespace
if (qname == null || qname.getNamespaceURI().length() == 0) {
int colonIdx = elmt.getText().indexOf(":");
String localpart = elmt.getText().substring(colonIdx + 1, elmt.getText().length());
String prefix = elmt.getText().substring(0, colonIdx);
String ns = elmt.findNamespaceURI(prefix).getNamespaceURI();
qname = new QName(ns, localpart, prefix);
}
return qname;
}
代码示例来源:origin: org.apache.ws.commons.axiom/axiom-impl
private void processAttribute(String prefix, String namespaceURI, String localName, String type, String value) throws OutputException {
mapNamespace(prefix, namespaceURI, false, true);
if (namespaceRepairing && contextElement != null && namespaceURI.equals(XSI_URI) && localName.equals(XSI_LOCAL_NAME)) {
String trimmedValue = value.trim();
if (trimmedValue.indexOf(":") > 0) {
String refPrefix = trimmedValue.substring(0, trimmedValue.indexOf(":"));
OMNamespace ns = contextElement.findNamespaceURI(refPrefix);
if (ns != null) {
mapNamespace(refPrefix, ns.getNamespaceURI(), false, true);
}
}
}
addAttribute(prefix, namespaceURI, localName, type, value);
}
代码示例来源:origin: org.apache.ws.commons.axiom/om-aspects
private void processAttribute(String prefix, String namespaceURI, String localName, String type, String value) throws OutputException {
mapNamespace(prefix, namespaceURI, false, true);
if (namespaceRepairing && contextElement != null && namespaceURI.equals(XSI_URI) && localName.equals(XSI_LOCAL_NAME)) {
String trimmedValue = value.trim();
if (trimmedValue.indexOf(":") > 0) {
String refPrefix = trimmedValue.substring(0, trimmedValue.indexOf(":"));
OMNamespace ns = contextElement.findNamespaceURI(refPrefix);
if (ns != null) {
mapNamespace(refPrefix, ns.getNamespaceURI(), false, true);
}
}
}
addAttribute(prefix, namespaceURI, localName, type, value);
}
代码示例来源:origin: org.apache.woden/woden-impl-om
protected QName doGetQName(String prefixedValue) throws WSDLException {
OMElement elem = (OMElement)fSource;
int index = prefixedValue.indexOf(':');
String prefix = (index != -1)
? prefixedValue.substring(0, index)
: null;
String localPart = prefixedValue.substring(index + 1);
OMNamespace OMns = elem.findNamespaceURI(prefix);
String namespaceURI = OMns != null ? OMns.getNamespaceURI() : null;
if(prefix != null && namespaceURI == null) {
String faultCode = WSDLException.UNBOUND_PREFIX;
String msg = fErrorReporter.getFormattedMessage(
"WSDL513",
new Object[] {prefixedValue, elem.getQName()});
WSDLException wsdlExc = new WSDLException(
faultCode,
msg);
//TODO wsdlExc.setLocation(XPathUtils.getXPathExprFromNode(el));
throw wsdlExc;
}
return new QName(namespaceURI, localPart, (prefix != null ? prefix : emptyString));
}
代码示例来源:origin: org.apache.ws.commons.axiom/axiom-api
public static void setNamespace(OMElement element, String namespaceURI, String prefix, boolean namespaceURIInterning) {
if (prefix == null) {
prefix = "";
}
if (namespaceURI == null) {
namespaceURI = "";
}
// Check if there is an existing namespace declaration. This has two purposes:
// * Avoid creating a new OMNamespace instance for each OMElement
// * Perform namespace repairing
OMNamespace namespace = element.findNamespaceURI(prefix);
if (namespace == null && namespaceURI.length() > 0
|| namespace != null && !namespace.getNamespaceURI().equals(namespaceURI)) {
if (namespaceURIInterning) {
namespaceURI = namespaceURI.intern();
}
// This is actually the place where we perform namespace repairing as specified
// in the contract of OMXMLBuilderFactory#createStAXOMBuilder:
namespace = ((OMElementEx)element).addNamespaceDeclaration(namespaceURI, prefix);
}
if (namespace != null && namespaceURI.length() > 0) {
element.setNamespace(namespace, false);
}
}
}
代码示例来源:origin: org.apache.ws.commons.axiom/axiom-common-impl
/**
* Method getNamespaceURI.
*
* @param prefix
* @return Returns String.
*/
public String getNamespaceURI(String prefix) {
String returnString = null;
if (parser != null) {
returnString = parser.getNamespaceURI(prefix);
} else {
if (isStartElement() || isEndElement()) {
if (lastNode instanceof OMElement) {
OMNamespace namespaceURI =
((OMElement) lastNode).findNamespaceURI(prefix);
return namespaceURI != null ? namespaceURI.getNamespaceURI() : null;
}
}
}
return returnString;
}
代码示例来源:origin: org.ballerinalang/ballerina-core
/**
* {@inheritDoc}
*/
@Override
public String getAttribute(String localName, String namespace, String prefix) {
if (nodeType != XMLNodeType.ELEMENT || localName == null || localName.isEmpty()) {
return STRING_NULL_VALUE;
}
QName attributeName = getQName(localName, namespace, prefix);
OMAttribute attribute = ((OMElement) omNode).getAttribute(attributeName);
if (attribute != null) {
return attribute.getAttributeValue();
}
OMNamespace ns = ((OMElement) omNode).findNamespaceURI(localName);
return ns == null ? STRING_NULL_VALUE : ns.getNamespaceURI();
}
代码示例来源:origin: org.apache.ws.commons.axiom/axiom-api
OMNamespace namespace = element.findNamespaceURI(prefix);
if (namespace == null) {
return null;
代码示例来源:origin: org.wso2.bpel/ode-bpel-epr
OMNamespace attrValNs = element.findNamespaceURI(attr.getAttributeValue().substring(0, colonIdx));
if (attrValNs != null)
domElement.setAttributeNS(DOMUtils.NS_URI_XMLNS, "xmlns:"+ attrValNs.getPrefix(), attrValNs.getNamespaceURI());
代码示例来源:origin: org.ballerinalang/ballerina-core
OMNamespace existingNs = node.findNamespaceURI(prefix);
内容来源于网络,如有侵权,请联系作者删除!