private String getPrefixForUri(NSContext nsContext, String uri) { Set<String> prefixes = nsContext.getPrefixes(); for (String prefix : prefixes) { String anUri = (nsContext.getNamespaceURI(prefix)); if (anUri != null && anUri.equals(uri)) { return prefix; } } return null; }
public QName derefQName(String qname) throws NSContextException { if (qname == null) return null; int idx = qname.indexOf(':'); if (idx == -1) { try { return new QName(getNamespaceURI(null), qname); } catch (NSContextException nsEx) { return null; } } String prefix = qname.substring(0, idx); String localname = qname.substring(idx + 1); String uri; try { uri = getNamespaceURI(prefix); } catch (NSContextException nsEx) { nsEx.setErrorMsg("Namespace not found for prefix in " + prefix); throw nsEx; } return new QName(uri, localname); }
/** * <p> * Convert the current stack of contexts into a single <code>NSContext</code>. * </p> * @return the <code>NSContext</code> instance */ public NSContext toNSContext() { NSContext n = new NSContext(); for (Frame f = _current;f != null; f=f._parent) { if (f._bindings == null) continue; for (Iterator it = f._bindings.keySet().iterator();it.hasNext();) { String pfx = (String) it.next(); if (n.getNamespaceURI(pfx) == null) { n.register(pfx, f._bindings.get(pfx)); } } } return n; }
String nsUri = nsContext.getNamespaceURI(nsPrefix);
/** * Dereference a qualified name given in the "ns:name" form using the namespace * context of a given element. * * @param prefixedQNameStr qualified name, represented as a prefixed string * @param context context element * @return a resolved {@link QName} * @throws javax.wsdl.WSDLException in case of resolution error (e.g. undefined prefix) */ protected static QName derefQName(String prefixedQNameStr, Element context) throws WSDLException { int idx = prefixedQNameStr.indexOf(":"); String uri; if (idx == -1) { uri = DOMUtils.getNamespaceURIFromPrefix(context, null); } else { if (idx >= prefixedQNameStr.length() || idx == 0) { String msg = __msgs.msgMalformedQName(prefixedQNameStr); throw new WSDLException(WSDLException.INVALID_WSDL, msg); } // Look up the prefix from the namespaces defined *at the element*. String prefix = prefixedQNameStr.substring(0, idx); uri = DOMUtils.getMyNSContext(context).getNamespaceURI(prefix); if (uri == null) { String msg = __msgs.msgInvalidNamespacePrefix(prefix); throw new WSDLException(WSDLException.INVALID_WSDL, msg); } } return new QName(uri, prefixedQNameStr.substring(idx + 1, prefixedQNameStr.length())); }
String prefix = stringValue.substring(0, stringValue.indexOf(":")); String localPart = stringValue.substring(stringValue.indexOf(":") + 1); String namespaceUri = _oxpath.namespaceCtx.getNamespaceURI(prefix); propertyName = new QName(namespaceUri, localPart, prefix); } else {
/** */ public void endFunction() { super.endFunction(); FunctionCallExpr c = (FunctionCallExpr)peekFrame() .getLast(); String prefix = c.getPrefix(); // empty string prefix should resolve to xpath namespace, NOT bpel if ((prefix == null) || "".equals(prefix)) { return; } String ns = _nsContext.getNamespaceURI(prefix); if (ns == null) { throw new CompilationException( __msgs.errUndeclaredFunctionPrefix(prefix,c.getFunctionName())); } else if (isBpelNamespace(ns)) { if (Constants.EXT_FUNCTION_GETVARIABLEDATA.equals(c.getFunctionName())) { compileGetVariableData(c); } else if (Constants.EXT_FUNCTION_GETVARIABLEPROPRTY.equals(c .getFunctionName())) { compileGetVariableProperty(c); } else if (Constants.EXT_FUNCTION_GETLINKSTATUS.equals(c.getFunctionName())) { compileGetLinkStatus(c); } else if (Constants.EXT_FUNCTION_DOXSLTRANSFORM.equals(c.getFunctionName())) { compileDoXslTransform(c); } else { throw new CompilationException(__msgs.errUnknownBpelFunction(c.getFunctionName())); } } }
String uri = nsContext.getNamespaceURI(prefix); staticContext.declareNamespace(prefix, uri); if ("".equals(prefix)) {
Set<String> prefixes = nsContext.getPrefixes(); for (String prefix : prefixes) { String uri = nsContext.getNamespaceURI(prefix); staticEnv.declareNamespace(prefix, uri);