public static String getNamespaceURI(Element el, String pfx) { if ("xml".equals(pfx)) { return "http://www.w3.org/XML/1998/namespace"; } else if ("xmlns".equals(pfx)) { return "http://www.w3.org/2000/xmlns/"; } if (DOM_LEVEL_3) { return getNamespaceURIDomLevel3(el, pfx); } return getNamespaceContext(el).getNamespaceURI(pfx); } private static String getNamespaceURIDomLevel3(Element el, String pfx) {
private QName getRefQName(String pName, Element pNode) { final int offset = pName.indexOf(':'); String uri; final String localName; final String prefix; if (offset == -1) { uri = NodeNamespaceContext.getNamespaceURI(pNode, Constants.DEFAULT_NS_PREFIX); if (Constants.NULL_NS_URI.equals(uri)) { return new QName(Constants.NULL_NS_URI, pName); } localName = pName; prefix = Constants.DEFAULT_NS_PREFIX; } else { prefix = pName.substring(0, offset); uri = NodeNamespaceContext.getNamespaceURI(pNode, prefix); if (uri == null || Constants.NULL_NS_URI.equals(uri)) { if (schema.parent != null && schema.parent.getNamespaceContext() != null) { uri = schema.parent.getNamespaceContext().getNamespaceURI( prefix); } } if (uri == null || Constants.NULL_NS_URI.equals(uri)) { throw new IllegalStateException("The prefix " + prefix + " is not bound."); } localName = pName.substring(offset + 1); } return new QName(uri, localName, prefix); }
String namespace = NodeNamespaceContext.getNamespaceURI(attrEl, prefix); if (!Constants.NULL_NS_URI.equals(namespace)) { Attr nsAttr = attrEl.getOwnerDocument()
ctx = NodeNamespaceContext.getNamespaceContext(attrEl); String namespace = ctx.getNamespaceURI(prefix); if (!Constants.NULL_NS_URI.equals(namespace)) { Attr nsAttr = attrEl.getOwnerDocument()
ctx = new NodeNamespaceContext(attrEl); String namespace = ctx.getNamespaceURI(prefix); if (!Constants.NULL_NS_URI.equals(namespace)) { Attr nsAttr = attrEl.getOwnerDocument().createAttribute("xmlns:" + prefix);