KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > tonbeller > wcf > utils > XoplonNS


1 /*
2  * ====================================================================
3  * This software is subject to the terms of the Common Public License
4  * Agreement, available at the following URL:
5  * http://www.opensource.org/licenses/cpl.html .
6  * Copyright (C) 2003-2004 TONBELLER AG.
7  * All Rights Reserved.
8  * You must accept the terms of that agreement to use this software.
9  * ====================================================================
10  *
11  *
12  */

13 package com.tonbeller.wcf.utils;
14
15 import org.w3c.dom.Document JavaDoc;
16 import org.w3c.dom.Element JavaDoc;
17
18 /**
19  * wrapper for a Xoplon namespace. There's no namespace supported
20  * yet, but implementation can could be extended to namespace
21  * supporting.
22  * Actually, I had problems finding the fitting Xalan API function
23  * to map namespace uri to namespace prefix, so I postponed
24  * namespace support.
25  * So this class is a dummy implementation using the DOM API functions
26  * ignoring namespaces.
27  */

28 public class XoplonNS {
29   /** Xoplon namespace, yet hard coded */
30   private static final String JavaDoc NAMESPACE_URI = "urn:xoplon:core";
31   private static final String JavaDoc NAMESPACE_PREFIX = "xc";
32
33   private XoplonNS() {}
34
35   /** creates a DOM element of given tag name */
36   public static Element JavaDoc createElement(Document JavaDoc factory, String JavaDoc name) {
37     return factory.createElement(name);
38   }
39
40   /** sets a DOM attribute */
41   public static void setAttribute(Element JavaDoc elem, String JavaDoc name, String JavaDoc value) {
42     elem.setAttribute(name, value);
43   }
44
45   /** adds xmlns:xc="uri:xoplon:core" */
46   public static void setNameSpaceAttribute(Element JavaDoc elem) {
47   }
48
49   /** removes a DOM attribute */
50   public static void removeAttribute(Element JavaDoc elem, String JavaDoc name) {
51     DomUtils.removeAttribute(elem, name);
52   }
53
54   /** retrieves DOM attribute */
55   public static String JavaDoc getAttribute(Element JavaDoc elem, String JavaDoc name) {
56     return elem.getAttribute(name);
57   }
58
59   public static boolean isXoplonNS(Element JavaDoc elem) {
60     return true;
61   }
62
63   /** returns tag name w/o prefix */
64   public static String JavaDoc getLocalName(Element JavaDoc elem) {
65     return elem.getTagName();
66   }
67
68 }
69
Popular Tags