Refine search
/** * This method makes a clone of this object. * */ public Object clone() throws CloneNotSupportedException { NamespaceMappings clone = new NamespaceMappings(); clone.m_nodeStack = (NamespaceMappings.Stack) m_nodeStack.clone(); clone.count = this.count; clone.m_namespaces = (Hashtable) m_namespaces.clone(); clone.count = count; return clone; }
String uri = m_prefixMap.lookupNamespace(prefixFromRawName); if (uri != null && uri.equals(ns)) String prefix = m_prefixMap.lookupPrefix(ns); if (prefix == null) prefix = m_prefixMap.generateNextPrefix(); this.startPrefixMapping(prefix, ns, false); this.addAttribute(
MappingRecord getMappingFromURI(String uri) { MappingRecord foundMap = null; Enumeration prefixes = m_namespaces.keys(); while (prefixes.hasMoreElements()) { String prefix = (String) prefixes.nextElement(); MappingRecord map2 = getMappingFromPrefix(prefix); if (map2 != null && (map2.m_uri).equals(uri)) { foundMap = map2; break; } } return foundMap; }
final void reset() { this.count = 0; this.m_namespaces.clear(); this.m_nodeStack.clear(); initNamespaces(); }
/** * Given a namespace uri, and the namespaces mappings for the * current element, return the current prefix for that uri. * * @param uri the namespace URI to be search for * @return an existing prefix that maps to the given URI, null if no prefix * maps to the given namespace URI. */ public String lookupPrefix(String uri) { String foundPrefix = null; Enumeration prefixes = m_namespaces.keys(); while (prefixes.hasMoreElements()) { String prefix = (String) prefixes.nextElement(); String uri2 = lookupNamespace(prefix); if (uri2 != null && uri2.equals(uri)) { foundPrefix = prefix; break; } } return foundPrefix; }
/** * Undeclare the namespace that is currently pointed to by a given * prefix. Inform SAX handler if prefix was previously mapped. */ protected boolean popNamespace(String prefix) { try { if (m_prefixMap.popNamespace(prefix)) { m_saxHandler.endPrefixMapping(prefix); return true; } } catch (SAXException e) { // falls through } return false; }
pushed = m_prefixMap.pushNamespace(prefix, uri, pushDepth); m_saxHandler.startPrefixMapping(prefix,uri);
Stack prefixStack = getPrefixStack(prefix); MappingRecord nm2 = (MappingRecord) prefixStack.peek(); if (nm1 == nm2) saxHandler.endPrefixMapping(prefix);
NamespaceMappings nm = new NamespaceMappings(); for (int i = 0; i < length; i++) { final Node attr = map.item(i); String newPrefix = nm.lookupPrefix(uriAttr); if (newPrefix == null) newPrefix = nm.generateNextPrefix(); prefix = (colon > 0) ? qnameAttr.substring(0, colon) : newPrefix;
NamespaceMappings.MappingRecord existing_mapping = m_prefixMap.getMappingFromPrefix(prefix); prefix = m_prefixMap.lookupPrefix(uri); if (prefix == null) prefix = m_prefixMap.generateNextPrefix();
/** * Returns the URI of prefix (if any) * * @param prefix the prefix whose URI is searched for * @return the namespace URI currently associated with the * prefix, null if the prefix is undefined. */ public String getNamespaceURIFromPrefix(String prefix) { String uri = null; if (m_prefixMap != null) uri = m_prefixMap.lookupNamespace(prefix); return uri; }
prefix = m_prefixMap.lookupPrefix(uri); if (prefix == null) prefix = m_prefixMap.generateNextPrefix();
/** * Default constructor. */ public ToHTMLStream() { super(); // we are just constructing this thing, no output properties // have been used, so we will set the right default for // indenting anyways m_doIndent = true; m_charInfo = m_htmlcharInfo; // initialize namespaces m_prefixMap = new NamespaceMappings(); }
/** * From XSLTC * Declare a prefix to point to a namespace URI. Inform SAX handler * if this is a new prefix mapping. */ protected boolean pushNamespace(String prefix, String uri) { try { if (m_prefixMap.pushNamespace( prefix, uri, m_elemContext.m_currentElemDepth)) { startPrefixMapping(prefix, uri); return true; } } catch (SAXException e) { // falls through } return false; } /**
/** * This method initializes the namespace object with appropriate stacks * and predefines a few prefix/uri pairs which always exist. */ private void initNamespaces() { // The initial prefix mappings will never be deleted because they are at element depth -1 // (a kludge) // Define the default namespace (initially maps to "" uri) Stack stack; MappingRecord nn; nn = new MappingRecord(EMPTYSTRING, EMPTYSTRING, -1); stack = createPrefixStack(EMPTYSTRING); stack.push(nn); // define "xml" namespace nn = new MappingRecord(XML_PREFIX, "http://www.w3.org/XML/1998/namespace", -1); stack = createPrefixStack(XML_PREFIX); stack.push(nn); }
/** * Returns the prefix currently pointing to the given URI (if any). * @param namespaceURI the uri of the namespace in question * @return a prefix pointing to the given URI (if any). * @see ExtendedContentHandler#getPrefix(String) */ public String getPrefix(String namespaceURI) { String prefix = m_prefixMap.lookupPrefix(namespaceURI); return prefix; }
prefix = prefixMapping.generateNextPrefix();
/** * Undeclare the namespace that is currently pointed to by a given prefix */ boolean popNamespace(String prefix) { // Prefixes "xml" and "xmlns" cannot be redefined if (prefix.startsWith(XML_PREFIX)) { return false; } Stack stack; if ((stack = getPrefixStack(prefix)) != null) { stack.pop(); return true; } return false; }
/** * Default constructor * @see java.lang.Object#Object() */ public NamespaceMappings() { initNamespaces(); }
public Docx4jMappingRecord(NamespaceMappings namespaceMappings, String prefix) { MappingRecord mappingRecord = namespaceMappings.getMappingFromPrefix(prefix); m_prefix = mappingRecord.m_prefix; m_uri = mappingRecord.m_uri; m_declarationDepth = mappingRecord.m_declarationDepth; }