Here you can find the source of parseNamespace(XMLStreamReader reader)
static Map<String, String> parseNamespace(XMLStreamReader reader)
//package com.java2s; /*/* w ww . jav a 2 s .c o m*/ * Copyright (C) 2006-2016 Talend Inc. - www.talend.com * * This source code is available under agreement available at * %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt * * You should have received a copy of the agreement along with this program; if not, write to Talend SA 9 rue Pages * 92150 Suresnes, France */ import javax.xml.stream.XMLStreamReader; import java.util.Collections; import java.util.HashMap; import java.util.Map; public class Main { static Map<String, String> parseNamespace(XMLStreamReader reader) { if (reader.getNamespaceCount() == 0) { return Collections.emptyMap(); } Map<String, String> prefixToNamespace = new HashMap<String, String>(reader.getNamespaceCount()); int namespaceCount = reader.getNamespaceCount(); for (int i = 0; i < namespaceCount; i++) { String namespacePrefix = reader.getNamespacePrefix(i); String namespaceURI = reader.getNamespaceURI(namespacePrefix); prefixToNamespace.put(namespacePrefix, namespaceURI); } return prefixToNamespace; } }