Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*******************************************************************************
* Copyright (C) 2007, 2014:
*
* - Ferdinando Villa
* - integratedmodelling.org
* - any other authors listed in @author annotations
*
* All rights reserved. This file is part of the k.LAB software suite,
* meant to enable modular, collaborative, integrated
* development of interoperable data and model components. For
* details, see http://integratedmodelling.org.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the Affero General Public License
* Version 3 or any later version.
*
* This program is distributed in the hope that it will be useful,
* but without any warranty; without even the implied warranty of
* merchantability or fitness for a particular purpose. See the
* Affero General Public License for more details.
*
* You should have received a copy of the Affero General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
* The license is also available at: https://www.gnu.org/licenses/agpl.html
*******************************************************************************/
package org.integratedmodelling.utils.xml;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import javax.swing.tree.DefaultMutableTreeNode;
import org.integratedmodelling.collections.Pair;
import org.integratedmodelling.exceptions.KlabException;
import org.integratedmodelling.exceptions.KlabValidationException;
import org.w3c.dom.Attr;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
/**
* Make XML encoding as fun as possible using a functional style. Also automatically
* converts (suitable) polylists to XML nodes.
*
* Example:
*
* XML.document("myns=http://my.namespace.org/ns"
* XML.node("root",
* XML.node("myns:content1", "Hi!")
* XML.node("myns:content2", "Hi!")
* XML.node("myns:content3", "Hi!")
* )).write("file.xml");
*
* @author Ferdinando Villa
* @see HTML for an HTML-specialized version.
*/
public class XML {
public static class XmlNode extends DefaultMutableTreeNode {
boolean isCdata = false;
private static final long serialVersionUID = -3750169814447901831L;
String tag = null;
ArrayList> attrs = null;
ArrayList