From: Jan T. <de...@us...> - 2001-12-03 21:17:49
|
Update of /cvsroot/net-script/netscript2/src/perl/XML/DOM2 In directory usw-pr-cvs1:/tmp/cvs-serv19044 Modified Files: CDATASection.pm CharacterData.pm Comment.pm Text.pm Log Message: * prevented child operations, since these nodes cannot have children Index: CDATASection.pm =================================================================== RCS file: /cvsroot/net-script/netscript2/src/perl/XML/DOM2/CDATASection.pm,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** CDATASection.pm 2001/11/29 21:42:18 1.1 --- CDATASection.pm 2001/12/03 21:17:45 1.2 *************** *** 14,17 **** --- 14,19 ---- use vars qw($VERSION); + use XML::DOM2::DOMException; + #-------------------------------------------------------- # Globals *************** *** 36,39 **** --- 38,92 ---- } + #/** + # AppendChild is unsupported, a CDATA-Section cannot have children. + #*/ + sub appendChild { + my $exc = XML::DOM2::DOMException -> new ( + { ErrCode => XML::DOM2::DOMException -> INVALID_ACCESS_ERR(), + ErrDesc => "This node cannot have children." + } ); + $exc -> raise(); + } + #/** + # RemoveChild is unsupported, a CDATA-Section cannot have children. + #*/ + sub removeChild { + my $exc = XML::DOM2::DOMException -> new ( + { ErrCode => XML::DOM2::DOMException -> INVALID_ACCESS_ERR(), + ErrDesc => "This node cannot have children." + } ); + $exc -> raise(); + } + #/** + # ReplaceChild is unsupported, a CDATA-Section cannot have children. + #*/ + sub replaceChild { + my $exc = XML::DOM2::DOMException -> new ( + { ErrCode => XML::DOM2::DOMException -> INVALID_ACCESS_ERR(), + ErrDesc => "This node cannot have children." + } ); + $exc -> raise(); + + } + + #/** + # InsertBefore is unsupported, a CDATA-Section cannot have children. + #*/ + sub insertBefore { + my $exc = XML::DOM2::DOMException -> new ( + { ErrCode => XML::DOM2::DOMException -> INVALID_ACCESS_ERR(), + ErrDesc => "This node cannot have children." + } ); + $exc -> raise(); + } + + #/** + # Returns the content of the CDATA-Section + # @return the content of the CDATA-Section + #*/ + sub nodeValue { + my ($this) = @_; + $this -> data(); + } Index: CharacterData.pm =================================================================== RCS file: /cvsroot/net-script/netscript2/src/perl/XML/DOM2/CharacterData.pm,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** CharacterData.pm 2001/11/29 21:42:18 1.1 --- CharacterData.pm 2001/12/03 21:17:45 1.2 *************** *** 13,16 **** --- 13,17 ---- use base qw(XML::DOM2::Node); use vars qw($VERSION); + use XML::DOM2::DOMException; Index: Comment.pm =================================================================== RCS file: /cvsroot/net-script/netscript2/src/perl/XML/DOM2/Comment.pm,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Comment.pm 2001/11/29 21:42:18 1.1 --- Comment.pm 2001/12/03 21:17:45 1.2 *************** *** 14,17 **** --- 14,19 ---- use vars qw($VERSION); + use XML::DOM2::DOMException; + #-------------------------------------------------------- # Globals *************** *** 36,38 **** --- 38,93 ---- } + #/** + # AppendChild is unsupported, a Comment cannot have children. + #*/ + sub appendChild { + my $exc = XML::DOM2::DOMException -> new ( + { ErrCode => XML::DOM2::DOMException -> INVALID_ACCESS_ERR(), + ErrDesc => "This node cannot have children." + } ); + $exc -> raise(); + } + + #/** + # RemoveChild is unsupported, a Comment cannot have children. + #*/ + sub removeChild { + my $exc = XML::DOM2::DOMException -> new ( + { ErrCode => XML::DOM2::DOMException -> INVALID_ACCESS_ERR(), + ErrDesc => "This node cannot have children." + } ); + $exc -> raise(); + } + #/** + # ReplaceChild is unsupported, a Comment cannot have children. + #*/ + sub replaceChild { + my $exc = XML::DOM2::DOMException -> new ( + { ErrCode => XML::DOM2::DOMException -> INVALID_ACCESS_ERR(), + ErrDesc => "This node cannot have children." + } ); + $exc -> raise(); + + } + + #/** + # InsertBefore is unsupported, a Comment cannot have children. + #*/ + sub insertBefore { + my $exc = XML::DOM2::DOMException -> new ( + { ErrCode => XML::DOM2::DOMException -> INVALID_ACCESS_ERR(), + ErrDesc => "This node cannot have children." + } ); + $exc -> raise(); + } + + #/** + # Returns the content of this comment. + # @return the content of this comment. + # @public + #*/ + sub nodeValue { + my ($this) = @_; + $this -> data(); + } Index: Text.pm =================================================================== RCS file: /cvsroot/net-script/netscript2/src/perl/XML/DOM2/Text.pm,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Text.pm 2001/11/29 21:42:18 1.1 --- Text.pm 2001/12/03 21:17:45 1.2 *************** *** 13,16 **** --- 13,17 ---- use base qw(XML::DOM2::CharacterData); use vars qw($VERSION); + use XML::DOM2::DOMException; *************** *** 72,77 **** $this -> data( { "data" => $data } ); ! my $newTextNode = XML::DOM2::Text -> new(); ! $newTextNode -> data($newData); my $parent = $this -> parent(); --- 73,78 ---- $this -> data( { "data" => $data } ); ! my $newTextNode = $this -> ownerDocument() -> createTextNode( ! { data => $newData } ); my $parent = $this -> parent(); *************** *** 94,96 **** --- 95,150 ---- } + #/** + # AppendChild is unsupported, a Text cannot have children. + #*/ + sub appendChild { + my $exc = XML::DOM2::DOMException -> new ( + { ErrCode => XML::DOM2::DOMException -> INVALID_ACCESS_ERR(), + ErrDesc => "This node cannot have children." + } ); + $exc -> raise(); + } + + #/** + # RemoveChild is unsupported, a Text cannot have children. + #*/ + sub removeChild { + my $exc = XML::DOM2::DOMException -> new ( + { ErrCode => XML::DOM2::DOMException -> INVALID_ACCESS_ERR(), + ErrDesc => "This node cannot have children." + } ); + $exc -> raise(); + } + + #/** + # ReplaceChild is unsupported, a Text cannot have children. + #*/ + sub replaceChild { + my $exc = XML::DOM2::DOMException -> new ( + { ErrCode => XML::DOM2::DOMException -> INVALID_ACCESS_ERR(), + ErrDesc => "This node cannot have children." + } ); + $exc -> raise(); + + } + + #/** + # InsertBefore is unsupported, a Text cannot have children. + #*/ + sub insertBefore { + my $exc = XML::DOM2::DOMException -> new ( + { ErrCode => XML::DOM2::DOMException -> INVALID_ACCESS_ERR(), + ErrDesc => "This node cannot have children." + } ); + $exc -> raise(); + } + #/** + # Returns the content of the text node. + # @return the content of the text node. + # @public + #*/ + sub nodeValue() { + my ($this) = @_; + $this -> data(); + } |