2 Copyright (C) 2000-2005 SKYRIX Software AG
4 This file is part of SOPE.
6 SOPE is free software; you can redistribute it and/or modify it under
7 the terms of the GNU Lesser General Public License as published by the
8 Free Software Foundation; either version 2, or (at your option) any
11 SOPE is distributed in the hope that it will be useful, but WITHOUT ANY
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
14 License for more details.
16 You should have received a copy of the GNU Lesser General Public
17 License along with SOPE; see the file COPYING. If not, write to the
18 Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
22 #ifndef __DOM_DOMProtocols_H__
23 #define __DOM_DOMProtocols_H__
26 Protocols for DOM objects ...
29 http://www.w3.org/TR/2001/WD-DOM-Level-3-Core-20010913/DOM3-Core.html
34 DOM_ATTRIBUTE_NODE = 1,
35 DOM_CDATA_SECTION_NODE = 2,
37 DOM_DOCUMENT_FRAGMENT_NODE = 4,
38 DOM_DOCUMENT_NODE = 5,
39 DOM_DOCUMENT_TYPE_NODE = 6,
42 DOM_ENTITY_REFERENCE_NODE = 9,
43 DOM_NOTATION_NODE = 10,
44 DOM_PROCESSING_INSTRUCTION_NODE = 11,
48 // TODO: find out which GCC version started to have forward protocols decls ...
49 //#define HAVE_FORWARD_PROTOCOLS 1
51 #if HAVE_FORWARD_PROTOCOLS
53 @protocol DOMAttr, DOMCDATASection, DOMComment, DOMDocumentFragment;
54 @protocol DOMDocument, DOMDocumentType, DOMElement, DOMEntity;
55 @protocol DOMEntityReference, DOMNotation, DOMProcessingInstruction;
58 // NOTE: _ONLY_ use those defines for forward declarations!
60 #define IDOMNode id<NSObject,DOMNode>
61 #define IDOMDocument id<NSObject,DOMDocument>
62 #define IDOMElement id<NSObject,DOMElement>
66 #define IDOMDocument id
67 #define IDOMElement id
73 - (id)objectAtIndex:(unsigned)_idx; // returns the proper attribute node
75 @end /* DOMNodeList */
77 @protocol DOMNamedNodeMap
80 - (id)objectAtIndex:(unsigned)_idx; // returns the proper attribute node
82 - (IDOMNode)namedItem:(NSString *)_name;
83 - (IDOMNode)setNamedItem:(IDOMNode)_node;
84 - (IDOMNode)removeNamedItem:(NSString *)_name;
88 - (IDOMNode)namedItem:(NSString *)_name namespaceURI:(NSString *)_uri;
89 - (IDOMNode)setNamedItemNS:(IDOMNode)_node;
90 - (IDOMNode)removeNamedItem:(NSString *)_name namespaceURI:(NSString *)_uri;
92 @end /* DOMNamedNodeMap */
96 - (DOMNodeType)nodeType;
97 - (NSString *)nodeName;
98 - (NSString *)nodeValue;
100 - (NSString *)localName;
101 - (NSString *)namespaceURI;
102 - (void)setPrefix:(NSString *)_prefix;
103 - (NSString *)prefix;
105 /* element attributes */
107 - (id<NSObject,DOMNamedNodeMap>)attributes;
111 - (id<NSObject,DOMNode>)parentNode;
112 - (id<NSObject,DOMNode>)previousSibling;
113 - (id<NSObject,DOMNode>)nextSibling;
115 - (id<NSObject,DOMNodeList>)childNodes;
116 - (BOOL)hasChildNodes;
117 - (id<NSObject,DOMNode>)firstChild;
118 - (id<NSObject,DOMNode>)lastChild;
122 - (id<NSObject,DOMNode>)appendChild:(id<NSObject,DOMNode>)_node;
123 - (id<NSObject,DOMNode>)removeChild:(id<NSObject,DOMNode>)_node;
127 - (IDOMDocument)ownerDocument;
131 @protocol DOMDocumentFragment < DOMNode >
134 @protocol DOMAttr < DOMNode >
138 - (void)setValue:(NSString *)_value;
143 - (IDOMElement)ownerElement;
147 @protocol DOMCharacterData < DOMNode >
149 - (void)setData:(NSString *)_data;
153 - (NSString *)substringData:(unsigned)_offset count:(unsigned)_count;
154 - (void)appendData:(NSString *)_data;
155 - (void)insertData:(NSString *)_data offset:(unsigned)_offset;
156 - (void)deleteData:(unsigned)_offset count:(unsigned)_count;
157 - (void)replaceData:(unsigned)_offs count:(unsigned)_count with:(NSString *)_s;
159 @end /* DOMCharacterData */
161 @protocol DOMComment < DOMCharacterData >
162 @end /* DOMComment */
164 @protocol DOMText < DOMCharacterData >
166 - (id<NSObject,DOMText>)splitText:(unsigned)_offset;
170 - (BOOL)isWhitespaceInElementContent;
171 - (NSString *)wholeText;
172 - (id<NSObject,DOMText>)replaceWholeText:(NSString *)_content;
176 @protocol DOMCDATASection < DOMText >
179 @protocol DOMElement < DOMNode >
183 - (NSString *)tagName;
187 - (id<NSObject,DOMNodeList>)getElementsByTagName:(NSString *)_tagName;
188 - (id<NSObject,DOMNodeList>)getElementsByTagName:(NSString *)_tagName
189 namespaceURI:(NSString *)_uri;
191 /* element attributes */
193 - (BOOL)hasAttribute:(NSString *)_attrName;
194 - (BOOL)hasAttribute:(NSString *)_localName namespaceURI:(NSString *)_ns;
196 - (void)setAttribute:(NSString *)_attrName value:(NSString *)_value;
197 - (void)setAttribute:(NSString *)_localName namespaceURI:(NSString *)_ns
198 value:(NSString *)_value;
200 - (NSString *)attribute:(NSString *)_attrName;
201 - (NSString *)attribute:(NSString *)_localName namespaceURI:(NSString *)_ns;
202 - (void)removeAttribute:(NSString *)_attrName;
203 - (void)removeAttribute:(NSString *)_attrName namespaceURI:(NSString *)_ns;
205 - (id<NSObject,DOMAttr>)setAttributeNode:(id<NSObject,DOMAttr>)_attrNode;
206 - (id<NSObject,DOMAttr>)removeAttributeNode:(id<NSObject,DOMAttr>)_attrNode;
207 - (id<NSObject,DOMAttr>)setAttributeNodeNS:(id<NSObject,DOMAttr>)_attrNode;
208 - (id<NSObject,DOMAttr>)removeAttributeNodeNS:(id<NSObject,DOMAttr>)_attrNode;
210 @end /* DOMElement */
212 @protocol DOMDocumentType < DOMNode >
213 @end /* DOMDocumentType */
215 @protocol DOMProcessingInstruction < DOMNode >
217 - (NSString *)target;
220 @end /* DOMProcessingInstruction */
222 @protocol DOMEntityReference < DOMNode >
225 @class NGDOMImplementation;
227 @protocol DOMDocument < DOMNode >
229 - (id<NSObject,DOMDocumentType>)doctype;
230 - (NGDOMImplementation *)implementation;
231 - (id<NSObject,DOMElement>)documentElement;
233 - (id<NSObject,DOMNodeList>)getElementsByTagName:(NSString *)_tagName;
234 - (id<NSObject,DOMNodeList>)getElementsByTagName:(NSString *)_tagName
235 namespaceURI:(NSString *)_uri;
236 - (id<NSObject,DOMElement>)getElementById:(NSString *)_eid;
240 - (id<NSObject,DOMElement>)createElement:(NSString *)_tagName;
241 - (id<NSObject,DOMElement>)createElement:(NSString *)_tagName
242 namespaceURI:(NSString *)_uri;
244 - (id<NSObject,DOMDocumentFragment>)createDocumentFragment;
245 - (id<NSObject,DOMText>)createTextNode:(NSString *)_data;
246 - (id<NSObject,DOMComment>)createComment:(NSString *)_data;
247 - (id<NSObject,DOMCDATASection>)createCDATASection:(NSString *)_data;
249 - (id<NSObject,DOMProcessingInstruction>)
250 createProcessingInstruction:(NSString *)_target data:(NSString *)_data;
252 - (id<NSObject,DOMAttr>)createAttribute:(NSString *)_name;
253 - (id<NSObject,DOMAttr>)createAttribute:(NSString *)_name
254 namespaceURI:(NSString *)_uri;
256 - (id<NSObject,DOMEntityReference>)createEntityReference:(NSString *)_name;
258 @end /* DOMDocument */
260 #endif /* __DOM_DOMProtocols_H__ */