private void copyNamespaces(NamespaceResolver source, NamespaceResolver target) { if (null != source && null != target) { target.getPrefixesToNamespaces().putAll(source.getPrefixesToNamespaces()); target.setDefaultNamespaceURI(source.getDefaultNamespaceURI()); } }
public void startPrefixMappings(NamespaceResolver namespaceResolver) { if (namespaceResolver != null) { for(Entry<String, String> entry: namespaceResolver.getPrefixesToNamespaces().entrySet()) { startPrefixMapping(entry.getKey(), entry.getValue()); } } }
public void endPrefixMappings(NamespaceResolver namespaceResolver) { if (namespaceResolver != null) { for(Entry<String, String> entry: namespaceResolver.getPrefixesToNamespaces().entrySet()) { endPrefixMapping(entry.getKey()); } } }
private void copyNamespaces(NamespaceResolver source, NamespaceResolver target) { if (null != source && null != target) { if(source.hasPrefixesToNamespaces()) { target.getPrefixesToNamespaces().putAll(source.getPrefixesToNamespaces()); } target.setDefaultNamespaceURI(source.getDefaultNamespaceURI()); } } }
private void copyNamespaces(NamespaceResolver source, NamespaceResolver target) { if (null != source && null != target) { if(source.hasPrefixesToNamespaces()) { target.getPrefixesToNamespaces().putAll(source.getPrefixesToNamespaces()); } target.setDefaultNamespaceURI(source.getDefaultNamespaceURI()); } } }
private void writePrefixMappings() { try { if(null != namespaceResolver) { String defaultNamespace = namespaceResolver.getDefaultNamespaceURI(); if(defaultNamespace != null) { xmlStreamWriter.writeNamespace(XMLConstants.EMPTY_STRING, defaultNamespace); } for(Map.Entry<String, String> entry:this.namespaceResolver.getPrefixesToNamespaces().entrySet()) { xmlStreamWriter.writeNamespace(entry.getKey(), entry.getValue()); } namespaceResolver = null; } if(null != prefixMapping) { for(Map.Entry<String, String> entry:this.prefixMapping.entrySet()) { xmlStreamWriter.writeNamespace(entry.getKey(), entry.getValue()); } prefixMapping = null; } } catch(XMLStreamException e) { throw XMLMarshalException.marshalException(e); } }
/** * INTERNAL: * Add the namespace declarations to the XML document. * @param namespaceResolver The NamespaceResolver contains the namespace * prefix and URI pairings that need to be declared. */ public void namespaceDeclarations(NamespaceResolver namespaceResolver) { if (namespaceResolver == null) { return; } String namespaceURI = namespaceResolver.getDefaultNamespaceURI(); if(null != namespaceURI) { attribute(XMLConstants.XMLNS_URL, XMLConstants.XMLNS, XMLConstants.XMLNS, namespaceURI); } for(Entry<String, String> entry: namespaceResolver.getPrefixesToNamespaces().entrySet()) { String namespacePrefix = entry.getKey(); attribute(XMLConstants.XMLNS_URL, namespacePrefix, XMLConstants.XMLNS + XMLConstants.COLON + namespacePrefix, entry.getValue()); } }
/** * INTERNAL: * Add the namespace declarations to the XML document. * @param namespaceResolver The NamespaceResolver contains the namespace * prefix and URI pairings that need to be declared. */ public void namespaceDeclarations(NamespaceResolver namespaceResolver) { if (namespaceResolver == null) { return; } String namespaceURI = namespaceResolver.getDefaultNamespaceURI(); if(null != namespaceURI) { attribute(XMLConstants.XMLNS_URL, XMLConstants.XMLNS, XMLConstants.XMLNS, namespaceURI); } for(Entry<String, String> entry: namespaceResolver.getPrefixesToNamespaces().entrySet()) { String namespacePrefix = entry.getKey(); attribute(XMLConstants.XMLNS_URL, namespacePrefix, XMLConstants.XMLNS + XMLConstants.COLON + namespacePrefix, entry.getValue()); } }
for(Map.Entry<String, String> entry:this.namespaceResolver.getPrefixesToNamespaces().entrySet()) { XMLEvent namespace = xmlEventFactory.createNamespace(entry.getKey(), entry.getValue()); if(null == namespaceDeclarations) {
protected List addExtraNamespacesToNamespaceResolver(XMLDescriptor desc, XMLRecord marshalRecord, AbstractSession session) { if (((XMLLogin)session.getDatasourceLogin()).hasEqualNamespaceResolvers()) { return null; } List returnList = new ArrayList(); for(Entry<String, String> entry: desc.getNonNullNamespaceResolver().getPrefixesToNamespaces().entrySet()) { //if isn't already on a parentadd namespace to this element String prefix = marshalRecord.getNamespaceResolver().resolveNamespaceURI(entry.getValue()); if (prefix == null || prefix.length() == 0) { //if there is no prefix already declared for this uri in the nr add this one // marshalRecord.getNamespaceResolver().put(entry.getKey(), entry.getValue()); returnList.add(new Namespace(entry.getKey(), entry.getValue())); } else { //if prefix is the same do nothing if (!prefix.equals(entry.getKey())) { //if prefix exists for uri but is different then add this marshalRecord.getNamespaceResolver().put(entry.getKey(), entry.getValue()); returnList.add(new Namespace(entry.getKey(), entry.getValue())); } } } return returnList; }
for(Map.Entry<String, String> entry: this.namespaceResolver.getPrefixesToNamespaces().entrySet()) { final String namespace = entry.getValue(); if (namespace != null) {
public NamespaceResolver getNamespaceResolverForDescriptor() { if(this.namespaceResolverForDescriptor == null) { this.namespaceResolverForDescriptor = new NamespaceResolver(); if(this.namespaceResolver.hasPrefixesToNamespaces()) { for(String next:this.namespaceResolver.getPrefixesToNamespaces().keySet()) { this.namespaceResolverForDescriptor.put(next, this.namespaceResolver.resolveNamespacePrefix(next)); } } this.namespaceResolverForDescriptor.setDefaultNamespaceURI(namespaceResolver.getDefaultNamespaceURI()); } return this.namespaceResolverForDescriptor; } }
for(Entry<String, String> entry : parentNamespaceResolver.getPrefixesToNamespaces().entrySet()) { String namespaceURI = namespaceResolver.resolveNamespacePrefix(entry.getKey()); if(null == namespaceURI) {
for(Entry<String, String> entry : parentNamespaceResolver.getPrefixesToNamespaces().entrySet()) { String namespaceURI = namespaceResolver.resolveNamespacePrefix(entry.getKey()); if(null == namespaceURI) {
if(namespace.length() != 0) { if(isDefaultNamespaceAllowed && globalNamespaceResolver.getDefaultNamespaceURI() == null && namespace.length() != 0) { if (!namespaceInfo.getNamespaceResolverForDescriptor().getPrefixesToNamespaces().containsValue(namespace)) { globalNamespaceResolver.setDefaultNamespaceURI(namespace); namespaceInfo.getNamespaceResolverForDescriptor().setDefaultNamespaceURI(namespace);