Java XML Namespace writeNamespaceDeclarations(final XMLStreamWriter writer, final Iterable> prefixes)

Here you can find the source of writeNamespaceDeclarations(final XMLStreamWriter writer, final Iterable> prefixes)

Description

write Namespace Declarations

License

Open Source License

Declaration

private static void writeNamespaceDeclarations(final XMLStreamWriter writer,
            final Iterable<Entry<URI, String>> prefixes) throws XMLStreamException 

Method Source Code


//package com.java2s;
/*//w w  w .  j a v  a2 s .  com
 * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
 *
 * This program and the accompanying materials are made available under the
 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
 * and is available at http://www.eclipse.org/legal/epl-v10.html
 */

import java.net.URI;
import java.util.Map.Entry;

import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamWriter;

public class Main {
    private static void writeNamespaceDeclarations(final XMLStreamWriter writer,
            final Iterable<Entry<URI, String>> prefixes) throws XMLStreamException {
        for (Entry<URI, String> e : prefixes) {
            final String ns = e.getKey().toString();
            final String p = e.getValue();
            writer.writeNamespace(p, ns);
        }
    }
}

Related

  1. printNamespaces(XMLStreamReader xmlr)
  2. readXML(InputStream input, boolean isNamespaceAware)
  3. stringToDoc(String s, boolean nameSpaceAware)
  4. writeNamespace(XMLStreamWriter out, String prefix, String namespaceURI)
  5. writeNamespace(XMLStreamWriter writer, String prefix, String namespaceURI)
  6. writeNamespaceIfNotBound(XMLStreamWriter xmlStream, String prefix, String nsUri)
  7. writeNamespaces(XMLStreamWriter writer, Iterator namespaces)