KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > jawe > xml > XMLSimpleElement


1 /* XMLSimpleElement.java
2  *
3  * Authors:
4  * Stefanovic Nenad chupo@iis.ns.ac.yu
5  * Bojanic Sasa sasaboy@neobee.net
6  * Puskas Vladimir vpuskas@eunet.yu
7  * Pilipovic Goran zboniek@uns.ac.yu
8  *
9  */

10
11
12 package org.enhydra.jawe.xml;
13
14 import org.enhydra.jawe.xml.panels.*;
15
16 import javax.swing.JPanel JavaDoc;
17 import javax.swing.JComponent JavaDoc;
18 import org.w3c.dom.*;
19
20 public class XMLSimpleElement extends XMLElement {
21
22    public XMLSimpleElement () {
23       super();
24    }
25
26    public void toXML(Node parent) throws DOMException {
27       //System.out.println("Element="+name);
28
if (!isEmpty() || isRequired()) {
29          if (parent!=null) {
30             Node node = (parent.getOwnerDocument()).createElement(name);
31             node.appendChild(parent.getOwnerDocument().createTextNode(toString().trim()));
32             parent.appendChild(node);
33          }
34       }
35    }
36
37    public XMLPanel getPanel () {
38       return new XMLTextPanel(this);
39    }
40
41 }
42
43 /* End of XMLSimpleElement.java */
44
Popular Tags