]> err.no Git - sope/blob - sope-xml/DOM/DOMProcessingInstruction.m
fixed some comments
[sope] / sope-xml / DOM / DOMProcessingInstruction.m
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 #include "DOMProcessingInstruction.h"
23 #include "common.h"
24
25 @implementation NGDOMProcessingInstruction
26
27 - (id)initWithTarget:(NSString *)_target data:(NSString *)_data {
28   if ((self = [super init])) {
29     self->target = [_target copy];
30     self->data   = [_data   copy];
31   }
32   return self;
33 }
34
35 - (void)dealloc {
36   [self->target release];
37   [self->data   release];
38   [super dealloc];
39 }
40
41 /* attributes */
42
43 - (NSString *)target {
44   return self->target;
45 }
46
47 - (void)setData:(NSString *)_data {
48   id old = self->data;
49   self->data = [_data copy];
50   [old release];
51 }
52 - (NSString *)data {
53   return self->data;
54 }
55
56 /* node */
57
58 - (DOMNodeType)nodeType {
59   return DOM_PROCESSING_INSTRUCTION_NODE;
60 }
61
62 - (id<NSObject,DOMNamedNodeMap>)attributes {
63   return nil;
64 }
65
66 - (BOOL)_isValidChildNode:(id)_node {
67   return NO;
68 }
69 - (BOOL)hasChildNodes {
70   /* PI's have no children ! */
71   return NO;
72 }
73 - (id<NSObject,DOMNodeList>)childNodes {
74   /* PI's have no children ! */
75   return nil;
76 }
77 - (id<NSObject,DOMNode>)appendChild:(id<NSObject,DOMNode>)_node {
78   /* PI's have no children ! */
79   return nil;
80 }
81
82 /* parent node */
83
84 - (void)_domNodeRegisterParentNode:(id)_parent {
85   self->parent = _parent;
86 }
87 - (void)_domNodeForgetParentNode:(id)_parent {
88   if (_parent == self->parent)
89     /* the node's parent was deallocated */
90     self->parent = nil;
91 }
92 - (id<NSObject,DOMNode>)parentNode {
93   return self->parent;
94 }
95
96 /* description */
97
98 - (NSString *)description {
99   return [NSString stringWithFormat:@"<0x%08X[%@]: target=%@ data='%@'>",
100                      self, NSStringFromClass([self class]),
101                      [self target], [self data]];
102 }
103
104 @end /* NGDOMProcessingInstruction */