diff options
author | Kurt Zenker <kz@openoffice.org> | 2004-05-19 11:39:28 +0000 |
---|---|---|
committer | Kurt Zenker <kz@openoffice.org> | 2004-05-19 11:39:28 +0000 |
commit | d2aa0857d56d7e41cacc06111039698fbbb5c515 (patch) | |
tree | 7c58ef8d7099652eb9dfdd9ee8171bcb25c1d713 /wizards/com | |
parent | 3afbd6a4fec22dd41a24906074b6efa5d514b1b5 (diff) |
INTEGRATION: CWS qwizards1 (1.1.2); FILE ADDED
2004/03/12 16:16:50 rpiterman 1.1.2.5: documentation and small implementation-fixes
2004/02/02 11:27:52 tv 1.1.2.4: formatted with autoformatter (indents now use TAB)
2004/01/14 19:47:29 rpiterman 1.1.2.3: now attributes with value "" (empty string) are not added to the element.
2003/12/19 17:53:25 rpiterman 1.1.2.2: extended... bugfix...
2003/11/04 16:30:48 rpiterman 1.1.2.1: XMLProvider ist an interface which enables an object to "add itself" to a DOM representation.
XMLHelper has convenience methods for adding elements to a document.
Diffstat (limited to 'wizards/com')
-rw-r--r-- | wizards/com/sun/star/wizards/common/XMLHelper.java | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/wizards/com/sun/star/wizards/common/XMLHelper.java b/wizards/com/sun/star/wizards/common/XMLHelper.java new file mode 100644 index 000000000000..d047fd3509ff --- /dev/null +++ b/wizards/com/sun/star/wizards/common/XMLHelper.java @@ -0,0 +1,33 @@ +/* + * XMLHelper.java + * + * Created on 30. September 2003, 15:38 + */ + +package com.sun.star.wizards.common; + +import org.w3c.dom.*; + +/** + * + * @author rpiterman + */ +public class XMLHelper { + + public static Node addElement(Node parent, String name, String[] attNames, String[] attValues) { + Document doc = parent.getOwnerDocument(); + if (doc == null) + doc = (Document) parent; + Element e = doc.createElement(name); + for (int i = 0; i < attNames.length; i++) + if (attValues[i] != null && (!attValues[i].equals(""))) + e.setAttribute(attNames[i], attValues[i]); + parent.appendChild(e); + return e; + } + + public static Node addElement(Node parent, String name, String attNames, String attValues) { + return addElement(parent, name, new String[] { attNames }, new String[] { attValues }); + } + +} |