]> err.no Git - sope/blob - sope-xml/DOM/DOMAttribute.h
renamed packages as discussed in the developer list
[sope] / sope-xml / DOM / DOMAttribute.h
1 /*
2   Copyright (C) 2000-2004 SKYRIX Software AG
3
4   This file is part of OpenGroupware.org.
5
6   OGo 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
9   later version.
10
11   OGo 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.
15
16   You should have received a copy of the GNU Lesser General Public
17   License along with OGo; see the file COPYING.  If not, write to the
18   Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
19   02111-1307, USA.
20 */
21 // $Id$
22
23 #ifndef __DOMAttribute_H__
24 #define __DOMAttribute_H__
25
26 #include <DOM/DOMNode.h>
27
28 /*
29   Why is Attr a Node? Can it have children? Can it be a child?
30   
31   Attr is a Node because its value is actually carried by its children,
32   which may be a mixture of Text and EntityReference nodes, and because
33   making it a Node allows us to store it in a NamedNodeMap for easy retrieval. 
34
35   The getAttribute method hides this detail by returning a string representing
36   the concatenation of all these children, and similarly setAttribute replaces
37   the Attr's contents with a single Text node holding the new string. To create
38   or manipulate other children of an Attr, you have to access the Attr node
39   directly via the getAttributeNode and setAttributeNode methods, or by
40   retrieving it from the element's "attributes" NamedNodeMap. 
41
42   Section 1.1.1 of the Level 1 DOM Recommendation gives a list of which nodes
43   can be parents and children of which other nodes. Attr is not a legal child
44   of any node, so attempts to insert it as one will throw a DOMException
45   (HIERARCHY_REQUEST_ERR).
46
47   Note that:
48     parentNode, nextSibling, previousSibling always return nil !!!
49 */
50
51 @interface DOMAttribute : DOMNodeWithChildren < DOMAttr >
52 {
53   id       element;
54   NSString *name;
55   NSString *namespaceURI;
56   NSString *prefix;
57   BOOL     isSpecified;
58   NSString *value;
59 }
60
61 @end
62
63 @interface DOMAttribute(PrivateCtors)
64 /* use DOMDocument for constructing DOMAttributes ! */
65
66 - (id)initWithName:(NSString *)_name;
67 - (id)initWithName:(NSString *)_name namespaceURI:(NSString *)_uri;
68
69 @end
70
71 @interface DOMAttribute(ObjCValues)
72
73 - (NSString *)stringValue;
74 - (int)intValue;
75 - (double)doubleValue;
76
77 @end /* DOMAttribute(Values) */
78
79 #endif /* __DOMAttribute_H__ */