KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > xquark > xpath > datamodel > TypedDocumentImpl


1 /*
2  * This file belongs to the XQuark distribution.
3  * Copyright (C) 2003 Universite de Versailles Saint-Quentin.
4  *
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307.
18  * You can also get it at http://www.gnu.org/licenses/lgpl.html
19  *
20  * For more information on this software, see http://www.xquark.org.
21  */

22
23 package org.xquark.xpath.datamodel;
24
25 import org.w3c.dom.*;
26 import org.xquark.schema.Declaration;
27 import org.xquark.schema.SimpleType;
28 import org.xquark.schema.Type;
29 import org.xquark.xpath.datamodel.xerces.dom.DocumentImpl;
30
31 public class TypedDocumentImpl extends DocumentImpl implements TypedDocument {
32     private static final String JavaDoc RCSRevision = "$Revision: 1.2 $";
33     private static final String JavaDoc RCSName = "$Name: $";
34
35     public TypedDocumentImpl() {
36         super();
37     }
38
39     // public TypedDocument(boolean grammarAccess) {
40
// super(grammarAccess);
41
// }
42
//
43
// public TypedDocument(DocumentType doctype) {
44
// super(doctype);
45
// }
46
//
47
// public TypedDocument(DocumentType doctype, boolean grammarAccess) {
48
// super(doctype, grammarAccess);
49
// }
50
//
51
public Element createElementNS(String JavaDoc namespaceURI, String JavaDoc qualifiedName) {
52         return new TypedElementImpl(this, namespaceURI, qualifiedName);
53     }
54
55     public Attr createAttributeNS(String JavaDoc namespaceURI, String JavaDoc qualifiedName) {
56         return new TypedAttributeImpl(this, namespaceURI, qualifiedName);
57     }
58
59     public Text createTextNode(String JavaDoc data) {
60         return new TypedValueImpl(this, data);
61     }
62
63     public TypedValue createTypedValue(Object JavaDoc typedValue, SimpleType simpleType) {
64         TypedValue retVal = new TypedValueImpl(this, (simpleType==null)?null:simpleType.toXMLString(typedValue,null));
65         retVal.setType(simpleType);
66         retVal.setTypedValue(typedValue);
67
68         return retVal;
69     }
70
71     /* (non-Javadoc)
72      * @see org.xquark.xpath.datamodel.TypedDOM#setType(org.xquark.schema.Type)
73      */

74     public void setType(Type type) {
75     }
76
77     /* (non-Javadoc)
78      * @see org.xquark.xpath.datamodel.TypedDOM#getType()
79      */

80     public Type getType() {
81         return null;
82     }
83
84     /* (non-Javadoc)
85      * @see org.xquark.xpath.datamodel.TypedDOM#setTypedValue(java.lang.Object)
86      */

87     public void setTypedValue(Object JavaDoc typedValue) {
88     }
89
90     /* (non-Javadoc)
91      * @see org.xquark.xpath.datamodel.TypedDOM#getTypedValue()
92      */

93     public Object JavaDoc getTypedValue() {
94         return null;
95     }
96
97     /* (non-Javadoc)
98      * @see org.xquark.xpath.datamodel.TypedDOM#getExtendedTypedValue()
99      */

100     public Object JavaDoc getExtendedTypedValue() {
101         return null;
102     }
103
104     /* (non-Javadoc)
105      * @see org.xquark.xpath.datamodel.TypedDOM#setDeclaration(org.xquark.schema.Declaration)
106      */

107     public void setDeclaration(Declaration elementDeclaration) {
108     }
109
110     /* (non-Javadoc)
111      * @see org.xquark.xpath.datamodel.TypedDOM#getDeclaration()
112      */

113     public Declaration getDeclaration() {
114         return null;
115     }
116
117     /* (non-Javadoc)
118      * @see org.xquark.xpath.datamodel.TypedDOM#setNormalizedStringValue(java.lang.String)
119      */

120     public void setNormalizedStringValue(String JavaDoc normalizedStringValue) {
121     }
122
123     /* (non-Javadoc)
124      * @see org.xquark.xpath.datamodel.TypedDOM#getNormalizedStringValue()
125      */

126     public String JavaDoc getNormalizedStringValue() {
127         return null;
128     }
129
130     //
131
// public Element getElementById(String elementId) {
132
// if(elementId == null) {
133
// return null;
134
// } else {
135
// return getElementById(elementId, this);
136
// }
137
// }
138
//
139
// protected Element getElementById(String elementId, Node root) {
140
// Node child = root.getFirstChild();
141
// while(child != null) {
142
// if(child instanceof TypedElement) {
143
// NamedNodeMap attributes = ((TypedElement)child).getAttributes();
144
// for(int i=0;i<attributes.getLength();i++) {
145
// if(attributes.item(i) instanceof TypedAttribute && ((TypedAttribute)attributes.item(i)).isTypeID()) {
146
// if(elementId.equals(attributes.item(i).getNodeValue())) {
147
// return (Element)child;
148
// }
149
// }
150
// }
151
// }
152
// if(child.getNodeType() == Node.ELEMENT_NODE) {
153
// Element search = this.getElementById(elementId,child);
154
// if(search != null) {
155
// return search;
156
// }
157
// }
158
// child = child.getNextSibling();
159
// }
160
// return null;
161
// }
162
}
163
Popular Tags