
org.magicwerk.brownies.jdom.XmlTransformer Maven / Gradle / Ivy
/*
* Copyright 2015 by Thomas Mauch
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* $Id$
*/
package org.magicwerk.brownies.jdom;
import java.util.Comparator;
import java.util.List;
import java.util.function.Predicate;
import org.jdom2.Attribute;
import org.jdom2.Comment;
import org.jdom2.Content;
import org.jdom2.DocType;
import org.jdom2.Document;
import org.jdom2.Element;
import org.jdom2.ProcessingInstruction;
import org.jdom2.Text;
import org.magicwerk.brownies.collections.GapList;
import org.magicwerk.brownies.collections.IList;
import org.magicwerk.brownies.core.CheckTools;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Transform XML content according to registered handlers.
*
* @author Thomas Mauch
* @version $Id$
*/
public class XmlTransformer {
/** Logger */
static final Logger LOG = LoggerFactory.getLogger(XmlTransformer.class);
static class NodeContext {
Element parent;
Object node;
NodeContext(Element parent, Object node) {
this.parent = parent;
this.node = node;
}
}
List> handlers = GapList.create();
boolean copyHandler = true;
Object currentNode;
IList
© 2015 - 2025 Weber Informatics LLC | Privacy Policy