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