Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
/*
 Copyright (c) 2013 eBay, Inc.
 This program is licensed under the terms of the eBay Common Development and
 Distribution License (CDDL) Version 1.0 (the "License") and any subsequent  version 
 thereof released by eBay.  The then-current version of the License can be found 
 at http://www.opensource.org/licenses/cddl1.php and in the eBaySDKLicense file that 
 is under the eBay SDK ../docs directory.
 */

import org.w3c.dom.Document;
import org.w3c.dom.Element;

import org.w3c.dom.Node;

public class Main {
    /**
     *
     * @param doc Document
     * @param parent Node
     * @param name String
     * @param value int
     * @return Element
     */
    public static Element appendChildNodeCDATA(Document doc, Node parent, String name, int value) {
        Element child = doc.createElement(name);
        child.appendChild(doc.createCDATASection(new Integer(value).toString()));
        parent.appendChild(child);
        return child;
    }

    /**
     *
     * @param doc Document
     * @param parent Node
     * @param name String
     * @param value String
     * @return Element
     */
    public static Element appendChildNodeCDATA(Document doc, Node parent, String name, String value) {
        Element child = doc.createElement(name);
        child.appendChild(doc.createCDATASection(value));
        parent.appendChild(child);
        return child;
    }
}