Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
/*
 * 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 printNamespaces(XMLStreamReader xmlr, StringBuffer result) {
        for (int i = 0; i < xmlr.getNamespaceCount(); i++) {
            printNamespace(xmlr, i, result);
        }
    }

    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("'");
    }
}