Here you can find the source of printNamespace(XMLStreamReader xmlr, int index, StringBuffer result)
private static void printNamespace(XMLStreamReader xmlr, int index, StringBuffer result)
//package com.java2s; /*/*ww w. j av a 2 s. c om*/ * Copyright LGPL3 * YES Technology Association * http://yestech.org * * http://www.opensource.org/licenses/lgpl-3.0.html */ import javax.xml.stream.XMLStreamReader; public class Main { private static void printNamespace(XMLStreamReader xmlr, int index, StringBuffer result) { String prefix = xmlr.getNamespacePrefix(index); String uri = xmlr.getNamespaceURI(index); result.append(" "); if (prefix == null) result.append("xmlns='").append(uri).append("'"); else result.append("xmlns:").append(prefix).append("='").append(uri).append("'"); } }