// DOM output public void setupNamespace(Element element) { String uri = element.getNamespaceURI(); String myPrefix = getPrefixByUri(uri); element.setPrefix(myPrefix); if (myPrefix != null) { IRNSContainer parent = (IRNSContainer) rnode_.getParentRNode(); if (parent == null) { addPrefixDecl(element, myPrefix, uri); return; } RNSContext parentContext = parent.getRNSContext(); String parentPrefix = parentContext.getPrefixByUri(uri); if (!myPrefix.equals(parentPrefix)) { addPrefixDecl(element, myPrefix, uri); } } }
public String getUriByPrefix(String prefix) { if ("xml".equals(prefix)) { return ("http://www.w3.org/XML/1998/namespace"); } if ("xmlns".equals(prefix)) { return ("http://www.w3.org/XML/2000/xmlns/"); } String uri = (String) uriByPrefix_.get(prefix); if (uri != null) { return (uri); } IRNSContainer parent = (IRNSContainer) rnode_.getParentRNode(); if (parent == null) { return (null); } return (parent.getRNSContext().getUriByPrefix(prefix)); }
public String getPrefixByUri(String uri) { if ("http://www.w3.org/XML/1998/namespace".equals(uri)) { return ("xml"); } if ("http://www.w3.org/XML/2000/xmlns/".equals(uri)) { return ("xmlns"); } String prefix = (String) prefixByUri_.get(uri); if (prefix != null) { return (prefix); } IRNSContainer parent = (IRNSContainer) rnode_.getParentRNode(); if (parent == null) { return (null); } return (parent.getRNSContext().getPrefixByUri(uri)); }