Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
// Licensed under the Apache License, Version 2.0 (the "License");

import org.w3c.dom.DOMConfiguration;

import org.w3c.dom.Document;

public class Main {
    private static final String DOM_CONFIG_COMMENTS = "comments";
    private static final String DOM_CONFIG_ELEMENT_CONTENT_WHITESPACE = "element-content-whitespace";
    private static final String DOM_CONFIG_CANONICAL_FORM = "canonical-form";

    /**
     * Set standard DOM configuration.
     *
     * @param document The document to set the configuration for.
     */
    public static void setConfigParams(Document document) {
        DOMConfiguration config = document.getDomConfig();
        config.setParameter(DOM_CONFIG_COMMENTS, true);
        config.setParameter(DOM_CONFIG_ELEMENT_CONTENT_WHITESPACE, true);
        if (config.canSetParameter(DOM_CONFIG_CANONICAL_FORM, true)) {
            config.setParameter(DOM_CONFIG_CANONICAL_FORM, true);
        }
    }
}