2
* Copyright (C) 2001-2012 Michael Fuchs
4
* This file is part of herold.
6
* herold is free software: you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation, either version 3 of the License, or
9
* (at your option) any later version.
11
* herold is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
16
* You should have received a copy of the GNU General Public License
17
* along with herold. If not, see <http://www.gnu.org/licenses/>.
19
package org.dbdoclet.trafo.tag.html;
21
import java.util.HashMap;
23
import org.dbdoclet.xiphias.dom.TextImpl;
24
import org.w3c.dom.Node;
26
abstract public class InlineElement extends HtmlElement {
29
protected boolean validate(HashMap<String, HashMap<String, String>> validParentMap) {
31
if (validParentMap == null) {
33
throw new IllegalArgumentException("Parameter validParentMap is null!");
36
if (getParentNode() == null) {
38
throw new NullPointerException("Variable getParent() is null!");
41
if (nodeStack == null) {
43
throw new NullPointerException("Variable nodeStack is null!");
46
nodeStack.removeAllElements();
49
if (validParentMap.get(getParentNode().getNodeName()) != null) {
53
if (getParentNode() instanceof Fieldset) {
55
Node child = getParentNode().getFirstChild();
57
if ((child == null) || !(child instanceof Legend)) {
59
Legend legend = new Legend();
60
getParentNode().appendChild(legend);
62
legend.appendChild(new TextImpl("Legend", legend));
68
if (getParentNode() instanceof Select) {
70
nodeStack.removeAllElements();
72
Option option = new Option();
73
nodeStack.push(option);
78
if (getParentNode() instanceof Optgroup) {
80
nodeStack.removeAllElements();
82
Option option = new Option();
83
nodeStack.push(option);
88
if (getParentNode() instanceof Dl) {
98
if (getParentNode() instanceof Dir || getParentNode() instanceof Menu || getParentNode() instanceof Ol
99
|| getParentNode() instanceof Ul) {
102
li.appendChild(this);
109
if (getParentNode() instanceof Table) {
114
td.appendChild(this);
122
if (getParentNode() instanceof Tbody || getParentNode() instanceof Tfoot
123
|| getParentNode() instanceof Thead) {
128
td.appendChild(this);
136
if (getParentNode() instanceof Tr) {
139
td.appendChild(this);
146
if (getParentNode() instanceof Map) {
149
div.appendChild(this);