Update of /cvsroot/net-script/netscript2/src/perl/XML/DOM2 In directory usw-pr-cvs1:/tmp/cvs-serv3460 Modified Files: Attr.pm CDATASection.pm CHANGELOG CharacterData.pm Comment.pm DOMException.pm DOMImplementation.pm DOMParser.pm DOMWriter.pm Document.pm DocumentFragment.pm DocumentType.pm Element.pm Entity.pm EntityReference.pm NamedNodeMap.pm Node.pm NodeList.pm Notation.pm ProcessingInstruction.pm Text.pm XMLDOMWriterStyle.pm notes.txt Log Message: * rewrote complete interface * 30% speed improvement Index: Attr.pm =================================================================== RCS file: /cvsroot/net-script/netscript2/src/perl/XML/DOM2/Attr.pm,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Attr.pm 2 Jun 2002 19:37:40 -0000 1.7 --- Attr.pm 8 Jun 2002 12:14:29 -0000 1.8 *************** *** 9,12 **** --- 9,16 ---- #-------------------------------------------------------- use strict; + + #/** + # This class represents an Attribute of an Element node. + #*/ package XML::DOM2::Attr; use base qw(XML::DOM2::Node); *************** *** 41,47 **** # @public #*/ ! sub name { my ($this) = @_; ! $this -> nodeName(); } --- 45,51 ---- # @public #*/ ! sub getName { my ($this) = @_; ! $this -> getNodeName(); } *************** *** 51,55 **** # @public #*/ ! sub ownerElement { my ($this) = @_; $this -> { m_ownerElement }; --- 55,59 ---- # @public #*/ ! sub getOwnerElement { my ($this) = @_; $this -> { m_ownerElement }; *************** *** 57,63 **** ! sub nodeValue { ! my ($this, $paramRef) = @_; ! $this -> value( $paramRef ); } --- 61,68 ---- ! ! sub getNodeValue { ! my ($this ) = @_; ! $this -> getValue(); } *************** *** 65,109 **** # Returns the value of this attribute. On retrieval, the value # is returned as a string. Character and general entity references ! # are replaced with their values. On setting, this creates a text ! # node with the unparsed contents of the string, i.e any characters ! # that an XML processor would recognize as markup are instead treated ! # as literal text. ! # @optional a hash reference containing the following key-value-pairs ! # <ul><li>value - the new value of the string.</li></ul> # @return the value of this attribute. #*/ ! sub value { ! my ($this, $paramRef) = @_; - if ( defined($paramRef) ) { - my $value = $paramRef -> {"value"}; - - # escape the value - # XXX: do NOT ???? escape the value ? - # $value =~ s/&/&/g; - # $value =~ s/([^a-zA-Z0-9_ .:\/()?=!-\\\[\]])/('&#'.ord($1).';')/eg; - # $value =~ s/</</g; - # $value =~ s/>/>/g; - # $value =~ s/"/"/g; - - # clear list of children - $this -> childNodes() -> removeAll(); - # append new node - my $textNode = $this -> ownerDocument() -> createTextNode( - { data => $value } ); - $this -> appendChild( { newChild => $textNode } ); - $this -> { m_specified } = 1; - } - # now convert all child nodes (which can be text or entity references) # to string and concatenate them. ! my $result = ""; ! my $count = $this -> childNodes() -> length() -1; for (0 .. $count ) { # FIXME: Support for entity references ! my $node = $this -> childNodes() -> item( { index => $_ } ); ! if ( $node -> nodeType() == $XML::DOM2::Node::TEXT_NODE ) { ! $result .= $node -> nodeValue(); } } --- 70,91 ---- # Returns the value of this attribute. On retrieval, the value # is returned as a string. Character and general entity references ! # are replaced with their values. ! # # @return the value of this attribute. #*/ ! sub getValue { ! my ($this) = @_; # now convert all child nodes (which can be text or entity references) # to string and concatenate them. ! my $result = ""; ! my $children = $this -> getChildNodes(); ! my $count = $children -> getLength() -1; for (0 .. $count ) { # FIXME: Support for entity references ! my $node = $children -> item( $_ ); ! if ( $node -> getNodeType() == $XML::DOM2::Node::TEXT_NODE ) { ! $result .= $node -> getNodeValue(); } } *************** *** 111,114 **** --- 93,116 ---- } + + #/** + # Sets the node value of this Attribute. On setting, this creates a text + # node with the unparsed contents of the string, i.e any characters + # that an XML processor would recognize as markup are instead treated + # as literal text. + # @param the new value of the attribute. + #*/ + sub setValue { + my ( $this, $value ) = @_; + + # clear list of children + $this -> getChildNodes() -> removeAll(); + # append new node + my $textNode = $this -> getOwnerDocument() -> createTextNode( $value ); + $this -> appendChild( $textNode ); + $this -> { m_specified } = 1; + } + + #/* # If this attribute was explicitly given a value in the *************** *** 117,123 **** # @public #*/ ! sub specified { my ($this) = @_; ! if ( defined( $this -> ownerElement() ) ) { $this -> m_specified; } --- 119,125 ---- # @public #*/ ! sub getSpecified { my ($this) = @_; ! if ( defined( $this -> getOwnerElement() ) ) { $this -> m_specified; } *************** *** 127,138 **** } ! sub nodeName { my ($this) = @_; $this -> { m_nodeName }; } ! sub prefix { my ($this) = @_; ! my $name = $this -> nodeName(); my ($prefix, $localname ) = split( /:/, $name ); if ( !defined($localname) ) { --- 129,140 ---- } ! sub getNodeName { my ($this) = @_; $this -> { m_nodeName }; } ! sub getPrefix { my ($this) = @_; ! my $name = $this -> getNodeName(); my ($prefix, $localname ) = split( /:/, $name ); if ( !defined($localname) ) { *************** *** 144,150 **** } ! sub localName { my ($this) = @_; ! my $name = $this -> nodeName(); my ($prefix, $localname ) = split( /:/, $name ); if ( !defined($localname) ) { --- 146,152 ---- } ! sub getLocalName { my ($this) = @_; ! my $name = $this -> getNodeName(); my ($prefix, $localname ) = split( /:/, $name ); if ( !defined($localname) ) { *************** *** 156,184 **** } ! sub namespaceURI { my ($this) = @_; $this -> { m_namespaceURI }; } ! #/** ! # Clones this node. ! # @public ! #*/ sub cloneNode { ! my ($this, $paramRef) = @_; ! my $deep = $paramRef -> { deep }; ! my $newNode = $this -> ownerDocument() -> createAttributeNS( { ! namespaceURI => $this -> namespaceURI(), ! qualifiedName => $this -> nodeName() ! } ); $newNode -> { m_specified } = 1; if ( $deep ) { ! my $children = $this -> childNodes(); ! my $len = $children -> length() - 1; for ( 0.. $len ) { ! $newNode -> appendChild( { newChild => $children -> ! item( {index => $_} ) -> cloneNode( $paramRef ) } ); } } --- 158,182 ---- } ! sub getNamespaceURI { my ($this) = @_; $this -> { m_namespaceURI }; } ! sub cloneNode { ! my ($this, $deep ) = @_; ! my $newNode = $this -> getOwnerDocument() -> createAttributeNS( ! $this -> getNamespaceURI(), ! $this -> getNodeName() ); ! $newNode -> { m_specified } = 1; if ( $deep ) { ! my $children = $this -> getChildNodes(); ! my $len = $children -> getLength() - 1; for ( 0.. $len ) { ! $newNode -> appendChild( $children -> ! item( $_ ) -> cloneNode( $deep ) ); } } *************** *** 191,196 **** # @public #*/ ! sub nodeType { ! my ($this) = @_; $XML::DOM2::Node::ATTRIBUTE_NODE; } --- 189,193 ---- # @public #*/ ! sub getNodeType { $XML::DOM2::Node::ATTRIBUTE_NODE; } Index: CDATASection.pm =================================================================== RCS file: /cvsroot/net-script/netscript2/src/perl/XML/DOM2/CDATASection.pm,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** CDATASection.pm 2 Jun 2002 19:37:40 -0000 1.7 --- CDATASection.pm 8 Jun 2002 12:14:29 -0000 1.8 *************** *** 9,12 **** --- 9,15 ---- #-------------------------------------------------------- use strict; + #/** + # This class represents a CDATA-Section. + #*/ package XML::DOM2::CDATASection; use base qw(XML::DOM2::Text); *************** *** 25,32 **** #*/ sub new { ! my ($proto) = shift; my $class = ref( $proto ) || $proto;# get the Classname ! my $this = $proto -> SUPER::new(@_); return $this; } --- 28,35 ---- #*/ sub new { ! my ($proto) = @_; my $class = ref( $proto ) || $proto;# get the Classname ! my $this = $proto -> SUPER::new(); return $this; } *************** *** 37,43 **** sub appendChild { my $exc = XML::DOM2::DOMException -> new ( ! { ErrCode => $XML::DOM2::DOMException::INVALID_ACCESS_ERR, ! ErrDesc => "This node cannot have children." ! } ); $exc -> raise(); } --- 40,46 ---- sub appendChild { my $exc = XML::DOM2::DOMException -> new ( ! $XML::DOM2::DOMException::INVALID_ACCESS_ERR, ! "This node cannot have children." ! ); $exc -> raise(); } *************** *** 48,54 **** sub removeChild { my $exc = XML::DOM2::DOMException -> new ( ! { ErrCode => $XML::DOM2::DOMException::INVALID_ACCESS_ERR, ! ErrDesc => "This node cannot have children." ! } ); $exc -> raise(); } --- 51,57 ---- sub removeChild { my $exc = XML::DOM2::DOMException -> new ( ! $XML::DOM2::DOMException::INVALID_ACCESS_ERR, ! "This node cannot have children." ! ); $exc -> raise(); } *************** *** 59,65 **** sub replaceChild { my $exc = XML::DOM2::DOMException -> new ( ! { ErrCode => $XML::DOM2::DOMException::INVALID_ACCESS_ERR, ! ErrDesc => "This node cannot have children." ! } ); $exc -> raise(); --- 62,68 ---- sub replaceChild { my $exc = XML::DOM2::DOMException -> new ( ! $XML::DOM2::DOMException::INVALID_ACCESS_ERR, ! "This node cannot have children." ! ); $exc -> raise(); *************** *** 71,77 **** sub insertBefore { my $exc = XML::DOM2::DOMException -> new ( ! { ErrCode => $XML::DOM2::DOMException::INVALID_ACCESS_ERR, ! ErrDesc => "This node cannot have children." ! } ); $exc -> raise(); } --- 74,80 ---- sub insertBefore { my $exc = XML::DOM2::DOMException -> new ( ! $XML::DOM2::DOMException::INVALID_ACCESS_ERR, ! "This node cannot have children." ! ); $exc -> raise(); } *************** *** 81,91 **** # @return the content of the CDATA-Section #*/ ! sub nodeValue { my ($this) = @_; ! $this -> data(); } ! sub nodeType { ! my ($this) = @_; $XML::DOM2::Node::CDATA_SECTION_NODE; } --- 84,93 ---- # @return the content of the CDATA-Section #*/ ! sub getNodeValue { my ($this) = @_; ! $this -> getData(); } ! sub getNodeType { $XML::DOM2::Node::CDATA_SECTION_NODE; } *************** *** 97,103 **** sub cloneNode { my ($this) = @_; ! my $newNode = $this -> ownerDocument() -> createCDATASection( { ! data => $this -> data() ! } ); $newNode; } --- 99,104 ---- sub cloneNode { my ($this) = @_; ! my $newNode = $this -> getOwnerDocument() -> createCDATASection( ! $this -> getData() ); $newNode; } Index: CHANGELOG =================================================================== RCS file: /cvsroot/net-script/netscript2/src/perl/XML/DOM2/CHANGELOG,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** CHANGELOG 17 Mar 2002 19:26:14 -0000 1.2 --- CHANGELOG 8 Jun 2002 12:14:29 -0000 1.3 *************** *** 10,13 **** --- 10,18 ---- #-------------------------------------------------------- + --------------------------------------------------------- + Version 0.1.3alpha + --------------------------------------------------------- + * rewrote the complete interface, should be much faster + and easier to use now --------------------------------------------------------- Index: CharacterData.pm =================================================================== RCS file: /cvsroot/net-script/netscript2/src/perl/XML/DOM2/CharacterData.pm,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** CharacterData.pm 2 Jun 2002 19:37:40 -0000 1.7 --- CharacterData.pm 8 Jun 2002 12:14:29 -0000 1.8 *************** *** 35,56 **** #/** ! # The character data of the node that implements this interface. ! # Can be set or retrieved. If the param is not supplied it will ! # return the data, if the param is supplied it will set the new ! # data. ! # @param a hash reference containing the following key-value-pairs ! # data - the new character data # @return the character data of the node that implements this # interface. #*/ ! sub data { ! my ( $this, $paramsRef ) = @_; ! ! if ( defined( $paramsRef ) ) { ! $this -> { m_data } = $paramsRef -> {"data"}; ! } ! $this -> { m_data }; } #/** # Returns the length of the character data in characters --- 35,57 ---- #/** ! # Sets the character data of the node that implements this interface. ! # @param the new character data ! #*/ ! sub setData { ! my ( $this, $data ) = @_; ! $this -> { m_data } = $data; ! } ! ! #/** ! # Gets the character data of the node that implements this interface. # @return the character data of the node that implements this # interface. #*/ ! sub getData { ! my ( $this ) = @_; $this -> { m_data }; } + + #/** # Returns the length of the character data in characters *************** *** 58,85 **** # @public #*/ ! sub length { my ($this) = @_; ! length( $this -> data() ); } #/** # Extracts a range of data from a node. ! # @param a hash reference containing the following key-value-pairs ! # offset - start offset of the substring to extract ! # count - the number of character units to extract #*/ sub substringData { ! my ($this, $paramsRef ) = @_; ! my %params = %{$paramsRef}; ! my $offset = $params{"offset"}; ! my $count = $params{"count"}; ! if ($offset < 0 || $offset > $this -> length() || $count < 0 ) { my $exc = XML::DOM2::DOMException -> new ( ! { ErrCode => $XML::DOM2::DOMException::INDEX_SIZE_ERR, ! ErrDesc => ($offset < 0 ? "The offset is less than 0." : $count < 0 ? "The count is less than 0." : "The offset is greater than the data length.") - } ); $exc -> raise(); --- 59,81 ---- # @public #*/ ! sub getLength { my ($this) = @_; ! length( $this -> getData() ); } #/** # Extracts a range of data from a node. ! # @param start offset of the substring to extract ! # @param the number of character units to extract #*/ sub substringData { ! my ($this, $offset, $count ) = @_; ! if ($offset < 0 || $offset > $this -> getLength() || $count < 0 ) { my $exc = XML::DOM2::DOMException -> new ( ! $XML::DOM2::DOMException::INDEX_SIZE_ERR, ! ($offset < 0 ? "The offset is less than 0." : $count < 0 ? "The count is less than 0." : "The offset is greater than the data length.") ); $exc -> raise(); *************** *** 87,102 **** } ! substr( $this -> data(), $offset, $count ); } #/** # Append the string to the end of the character data of the node. ! # @param a hash reference containing the following key-value-pair ! # arg - the data to append. #*/ sub appendData { ! my ($this, $paramsRef ) = @_; ! my %params = %{$paramsRef}; ! $this -> data( { "data" => $this -> data().$params{"arg"} } ); undef; } --- 83,96 ---- } ! substr( $this -> getData(), $offset, $count ); } #/** # Append the string to the end of the character data of the node. ! # @param the data to append. #*/ sub appendData { ! my ($this, $data ) = @_; ! $this -> setData( $this -> getData().$data ); undef; } *************** *** 104,125 **** #/** # Remove a range of characters from the node. ! # @param a hash reference containing the following key-value-pairs ! # offset - the offset from which to start removing ! # count - the number of characters to be removed. #*/ sub deleteData { ! my ($this, $paramsRef ) = @_; ! my %params = %{$paramsRef}; ! ! my $offset = $params{"offset"}; ! my $count = $params{"count"}; ! if ($offset < 0 || $offset > $this -> length() || $count < 0 ) { my $exc = XML::DOM2::DOMException -> new ( ! { ErrCode => $XML::DOM2::DOMException::INDEX_SIZE_ERR, ! ErrDesc => ($offset < 0 ? "The offset is less than 0." : $count < 0 ? "The count is less than 0." : "The offset is greater than the data length.") - } ); $exc -> raise(); --- 98,113 ---- #/** # Remove a range of characters from the node. ! # @param the offset from which to start removing ! # @param the number of characters to be removed. #*/ sub deleteData { ! my ($this, $offset, $count ) = @_; ! if ($offset < 0 || $offset > $this -> getLength() || $count < 0 ) { my $exc = XML::DOM2::DOMException -> new ( ! $XML::DOM2::DOMException::INDEX_SIZE_ERR, ! ($offset < 0 ? "The offset is less than 0." : $count < 0 ? "The count is less than 0." : "The offset is greater than the data length.") ); $exc -> raise(); *************** *** 127,133 **** } ! my $data = $this -> data(); substr($data, $offset, $count ) = ""; ! $this -> data( { "data" => $data } ); undef; } --- 115,121 ---- } ! my $data = $this -> getData(); substr($data, $offset, $count ) = ""; ! $this -> setData( $data ); undef; } *************** *** 135,152 **** #/** # Insert a string at the specified character offset. ! # @param a hash reference containing the following key-value-pairs ! # offset - the offset at which to insert ! # arg - the string to insert #*/ sub insertData { ! my ($this, $paramsRef ) = @_; ! my %params = %{$paramsRef}; ! my $offset = $params{"offset"}; ! if ($offset < 0 || $offset > $this -> length() ) { my $exc = XML::DOM2::DOMException -> new ( ! { ErrCode => $XML::DOM2::DOMException::INDEX_SIZE_ERR, ! ErrDesc => ($offset < 0 ? "The offset is less than 0." : "The offset is greater than the data length.") - } ); $exc -> raise(); --- 123,136 ---- #/** # Insert a string at the specified character offset. ! # @param the offset at which to insert ! # @param the string to insert #*/ sub insertData { ! my ($this, $offset, $arg ) = @_; ! if ($offset < 0 || $offset > $this -> getLength() ) { my $exc = XML::DOM2::DOMException -> new ( ! $XML::DOM2::DOMException::INDEX_SIZE_ERR, ! ($offset < 0 ? "The offset is less than 0." : "The offset is greater than the data length.") ); $exc -> raise(); *************** *** 154,160 **** } ! my $data = $this -> data(); ! substr($data, $offset, 0 ) = $params{"arg"}; ! $this -> data( { "data" => $data } ); undef; } --- 138,144 ---- } ! my $data = $this -> getData(); ! substr($data, $offset, 0 ) = $arg; ! $this -> setData( $data); undef; } *************** *** 163,190 **** # Replace the characters starting at the specified offset with the # specified string. ! # @param a hash reference containing the following key-value-pairs ! # offset - the offset at which to start replacing ! # count - the number of characters to replace ! # arg - the string to replace. #*/ sub replaceData { ! my ($this, $paramsRef ) = @_; ! my %params = %{$paramsRef}; ! my $offset = $params{"offset"}; ! my $count = $params{"count"}; ! if ($offset < 0 || $offset > $this -> length() || $count < 0 ) { my $exc = XML::DOM2::DOMException -> new ( ! { ErrCode => $XML::DOM2::DOMException::INDEX_SIZE_ERR, ! ErrDesc => ($offset < 0 ? "The offset is less than 0." : $count < 0 ? "The count is less than 0." : "The offset is greater than the data length.") - } ); $exc -> raise(); return undef; } ! my $data = $this -> data(); ! substr($data, $offset, $count) = $params{"arg"}; ! $this -> data( { "data" => $data } ); undef; } --- 147,169 ---- # Replace the characters starting at the specified offset with the # specified string. ! # @param the offset at which to start replacing ! # @param the number of characters to replace ! # @param the string to replace. #*/ sub replaceData { ! my ($this, $offset, $count, $arg ) = @_; ! if ($offset < 0 || $offset > $this -> getLength() || $count < 0 ) { my $exc = XML::DOM2::DOMException -> new ( ! $XML::DOM2::DOMException::INDEX_SIZE_ERR, ! ($offset < 0 ? "The offset is less than 0." : $count < 0 ? "The count is less than 0." : "The offset is greater than the data length.") ); $exc -> raise(); return undef; } ! my $data = $this -> getData(); ! substr($data, $offset, $count) = $arg; ! $this -> setData( $data ); undef; } Index: Comment.pm =================================================================== RCS file: /cvsroot/net-script/netscript2/src/perl/XML/DOM2/Comment.pm,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Comment.pm 2 Jun 2002 19:37:40 -0000 1.7 --- Comment.pm 8 Jun 2002 12:14:29 -0000 1.8 *************** *** 9,12 **** --- 9,15 ---- #-------------------------------------------------------- use strict; + #/** + # This class represents a comment. + #*/ package XML::DOM2::Comment; use base qw(XML::DOM2::CharacterData); *************** *** 29,33 **** my $class = ref( $proto ) || $proto;# get the Classname ! my $this = $proto -> SUPER::new(@_); return $this; } --- 32,36 ---- my $class = ref( $proto ) || $proto;# get the Classname ! my $this = $proto -> SUPER::new(); return $this; } *************** *** 38,44 **** sub appendChild { my $exc = XML::DOM2::DOMException -> new ( ! { ErrCode => $XML::DOM2::DOMException::INVALID_ACCESS_ERR, ! ErrDesc => "This node cannot have children." ! } ); $exc -> raise(); } --- 41,47 ---- sub appendChild { my $exc = XML::DOM2::DOMException -> new ( ! $XML::DOM2::DOMException::INVALID_ACCESS_ERR, ! "This node cannot have children." ! ); $exc -> raise(); } *************** *** 49,55 **** sub removeChild { my $exc = XML::DOM2::DOMException -> new ( ! { ErrCode => $XML::DOM2::DOMException::INVALID_ACCESS_ERR, ! ErrDesc => "This node cannot have children." ! } ); $exc -> raise(); } --- 52,58 ---- sub removeChild { my $exc = XML::DOM2::DOMException -> new ( ! $XML::DOM2::DOMException::INVALID_ACCESS_ERR, ! "This node cannot have children." ! ); $exc -> raise(); } *************** *** 60,66 **** sub replaceChild { my $exc = XML::DOM2::DOMException -> new ( ! { ErrCode => $XML::DOM2::DOMException::INVALID_ACCESS_ERR, ! ErrDesc => "This node cannot have children." ! } ); $exc -> raise(); --- 63,69 ---- sub replaceChild { my $exc = XML::DOM2::DOMException -> new ( ! $XML::DOM2::DOMException::INVALID_ACCESS_ERR, ! "This node cannot have children." ! ); $exc -> raise(); *************** *** 72,78 **** sub insertBefore { my $exc = XML::DOM2::DOMException -> new ( ! { ErrCode => $XML::DOM2::DOMException::INVALID_ACCESS_ERR, ! ErrDesc => "This node cannot have children." ! } ); $exc -> raise(); } --- 75,81 ---- sub insertBefore { my $exc = XML::DOM2::DOMException -> new ( ! $XML::DOM2::DOMException::INVALID_ACCESS_ERR, ! "This node cannot have children." ! ); $exc -> raise(); } *************** *** 83,93 **** # @public #*/ ! sub nodeValue { my ($this) = @_; ! $this -> data(); } ! sub nodeType { ! my ($this) = @_; $XML::DOM2::Node::COMMENT_NODE; } --- 86,95 ---- # @public #*/ ! sub getNodeValue { my ($this) = @_; ! $this -> getData(); } ! sub getNodeType { $XML::DOM2::Node::COMMENT_NODE; } *************** *** 99,105 **** sub cloneNode { my ($this) = @_; ! my $newNode = $this -> ownerDocument() -> createComment( { ! data => $this -> data() ! } ); $newNode; } --- 101,106 ---- sub cloneNode { my ($this) = @_; ! my $newNode = $this -> getOwnerDocument() -> createComment( ! $this -> getData() ); $newNode; } Index: DOMException.pm =================================================================== RCS file: /cvsroot/net-script/netscript2/src/perl/XML/DOM2/DOMException.pm,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** DOMException.pm 2 Jun 2002 19:37:40 -0000 1.9 --- DOMException.pm 8 Jun 2002 12:14:29 -0000 1.10 *************** *** 50,56 **** #/** # The constructor. Constructs a DOMException. ! # @param a hash reference containing the following key-value-pairs ! # ErrCode - the ErrorCode for this Exception ! # ErrDesc - an exact description why the error occured # @return an instance of XML::DOM2:DOMException #*/ --- 50,55 ---- #/** # The constructor. Constructs a DOMException. ! # @param the ErrorCode for this Exception ! # @param an exact description why the error occured # @return an instance of XML::DOM2:DOMException #*/ *************** *** 58,70 **** # These two lines help with inheritance and # allow this method to be called as object method. ! my ($proto, $argsRef) = @_; my $class = ref( $proto ) || $proto;# get the Classname - my %args = %{$argsRef}; # Create a Class using the Hash-As-An-Object-Idiom my $this = {}; bless( $this, $class ); # create Object ! $this -> { m_code } = $args{ErrCode}; # Exception Error code. ! $this -> { m_desc } = $args{ErrDesc}; # Exception description return $this; # return Object } --- 57,68 ---- # These two lines help with inheritance and # allow this method to be called as object method. ! my ($proto, $errCode, $errDesc) = @_; my $class = ref( $proto ) || $proto;# get the Classname # Create a Class using the Hash-As-An-Object-Idiom my $this = {}; bless( $this, $class ); # create Object ! $this -> { m_code } = $errCode; # Exception Error code. ! $this -> { m_desc } = $errDesc; # Exception description return $this; # return Object } Index: DOMImplementation.pm =================================================================== RCS file: /cvsroot/net-script/netscript2/src/perl/XML/DOM2/DOMImplementation.pm,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** DOMImplementation.pm 2 Jun 2002 19:37:40 -0000 1.7 --- DOMImplementation.pm 8 Jun 2002 12:14:29 -0000 1.8 *************** *** 62,78 **** # Creates an empty DocumentType node. # ! # @param a hash reference containing the following key-value-pairs ! # <ul><li>qualifiedName - the qualified name of the document type to be created.</li> ! # <li>publicId - the external subset public identifier.</li> ! # <li>systemId - the external subset system identifier.</li></ul> # @return an instance of XML::DOM2::DocumentType #*/ sub createDocumentType { ! my ($this, $paramRef) = @_; my $doctype = XML::DOM2::DocumentType -> new(); ! $doctype -> { m_name } = $paramRef -> { qualifiedName }; ! $doctype -> { m_publicId } = $paramRef -> { publicId }; ! $doctype -> { m_systemId } = $paramRef -> { systemId }; $doctype -> { m_ownerDocument } = undef; return $doctype; --- 62,77 ---- # Creates an empty DocumentType node. # ! # @param the qualified name of the document type to be created. ! # @param the external subset public identifier ! # @param the external subset system identifier. # @return an instance of XML::DOM2::DocumentType #*/ sub createDocumentType { ! my ($this, $qualifiedName, $publicId, $systemId ) = @_; my $doctype = XML::DOM2::DocumentType -> new(); ! $doctype -> { m_name } = $qualifiedName; ! $doctype -> { m_publicId } = $publicId; ! $doctype -> { m_systemId } = $systemId; $doctype -> { m_ownerDocument } = undef; return $doctype; *************** *** 82,102 **** #/** # Creates an an XML Document object. ! # @param a hash reference containing the following key-value-pairs ! # <ul><li>namespaceURI - the namespace URI of the document element to create.</li> ! # <li>qualifiedName - the qualified name of the document element ! # to be created</li> ! # <li>doctype - the type of document to be created or undef.</li></ul> # @return an instance of XML::DOM2::Document #*/ sub createDocument { ! my ($this, $paramRef) = @_; ! my $doctype = $paramRef -> { doctype }; if (defined($doctype)) { ! if ( defined($doctype -> ownerDocument()) ) { ! my $exc = XML::DOM2::DOMException -> new ( { ! ErrCode => $XML::DOM2::DOMException::WRONG_DOCUMENT_ERR, ! ErrDesc => "The specified Doctype has been used with another document!" ! }); $exc -> raise(); return; --- 81,98 ---- #/** # Creates an an XML Document object. ! # @param the namespace URI of the document element to create. ! # @param the qualified name of the document element to be created ! # @param the type of document to be created or undef # @return an instance of XML::DOM2::Document #*/ sub createDocument { ! my ($this, $namespaceURI, $qualifiedName, $doctype) = @_; if (defined($doctype)) { ! if ( defined($doctype -> getOwnerDocument()) ) { ! my $exc = XML::DOM2::DOMException -> new ( ! $XML::DOM2::DOMException::WRONG_DOCUMENT_ERR, ! "The specified Doctype has been used with another document!" ! ); $exc -> raise(); return; *************** *** 106,113 **** my $doc = XML::DOM2::Document -> new(); $doc -> { m_implementation } = $this; ! $doc -> { m_doctype } = $paramRef -> { doctype }; $doc -> { m_ownerDocument } = $doc; ! my $rootElement = $doc -> createElementNS( $paramRef ); ! $doc -> appendChild( { newChild => $rootElement } ); if ( defined($doctype) ) { $doctype -> { m_ownerDocument } = $doc; --- 102,109 ---- my $doc = XML::DOM2::Document -> new(); $doc -> { m_implementation } = $this; ! $doc -> { m_doctype } = $doctype; $doc -> { m_ownerDocument } = $doc; ! my $rootElement = $doc -> createElementNS( $namespaceURI, $qualifiedName ); ! $doc -> appendChild( $rootElement ); if ( defined($doctype) ) { $doctype -> { m_ownerDocument } = $doc; Index: DOMParser.pm =================================================================== RCS file: /cvsroot/net-script/netscript2/src/perl/XML/DOM2/DOMParser.pm,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** DOMParser.pm 2 Jun 2002 19:37:40 -0000 1.5 --- DOMParser.pm 8 Jun 2002 12:14:29 -0000 1.6 *************** *** 56,67 **** # create new document $this -> { m_document } = ! $this -> { m_DOMImplementation } -> createDocument( { ! qualifiedName => "dummy", ! namespaceURI => "dummy" ! } ); # remove the dummy element. ! my $docEl = $this -> { m_document } -> documentElement(); ! $this -> { m_document } -> removeChild( { oldChild => $docEl } ); $this -> { m_contextElement } = $this -> { m_document }; --- 56,65 ---- # create new document $this -> { m_document } = ! $this -> { m_DOMImplementation } -> createDocument( ! "dummy", "dummy" ); # remove the dummy element. ! my $docEl = $this -> { m_document } -> getDocumentElement(); ! $this -> { m_document } -> removeChild( $docEl ); $this -> { m_contextElement } = $this -> { m_document }; *************** *** 89,94 **** #/** # Parses the given String. Returns the Document object. ! # @param a hash reference containing the following key-value-pairs: ! # string - a scalar holding the textual representation # of an XML Document. # @return an instance of XML::DOM2::Document, representing --- 87,91 ---- #/** # Parses the given String. Returns the Document object. ! # @param a scalar holding the textual representation # of an XML Document. # @return an instance of XML::DOM2::Document, representing *************** *** 97,102 **** #*/ sub parseString { ! my ($this, $paramRef) = @_; ! my $string = $paramRef -> { "string" }; $this -> { m_parser } -> parse( $string ); # return the parsed document --- 94,98 ---- #*/ sub parseString { ! my ($this, $string) = @_; $this -> { m_parser } -> parse( $string ); # return the parsed document *************** *** 139,150 **** my $prefix = $prefixMap{$namespaceURI}; ! $elementNode = $this -> { m_document } -> createElementNS( { ! qualifiedName => defined($prefix) ? $prefix.":".$element : $element, ! namespaceURI => $namespaceURI ! } ); # get currently innermost open Element. # and append this element to it. my $parentNode = $this -> { m_contextElement }; ! $parentNode -> appendChild( { newChild => $elementNode } ); # add any attributes --- 135,146 ---- my $prefix = $prefixMap{$namespaceURI}; ! $elementNode = $this -> { m_document } -> createElementNS( ! $namespaceURI, ! defined($prefix) ? $prefix.":".$element : $element ); ! # get currently innermost open Element. # and append this element to it. my $parentNode = $this -> { m_contextElement }; ! $parentNode -> appendChild( $elementNode ); # add any attributes *************** *** 155,163 **** my $aPrefix = $prefixMap{$aNamespaceURI}; ! $elementNode -> setAttributeNS({ ! qualifiedName => defined($aPrefix) ? $aPrefix.":".$name : $name, ! namespaceURI => $aNamespaceURI, ! value => $value ! }); } --- 151,158 ---- my $aPrefix = $prefixMap{$aNamespaceURI}; ! $elementNode -> setAttributeNS( ! $aNamespaceURI, ! defined($aPrefix) ? $aPrefix.":".$name : $name, ! $value ); } *************** *** 179,183 **** # now it's quite easy, we put the parent of the contextElement # as new context element ! $this -> { m_contextElement } = $contextElement -> parentNode(); } --- 174,178 ---- # now it's quite easy, we put the parent of the contextElement # as new context element ! $this -> { m_contextElement } = $contextElement -> getParentNode(); } *************** *** 189,198 **** my ($this, $expat, $string) = @_; # first, create a text node ! my $textNode = $this -> { m_document } -> createTextNode( { ! data => $string ! }); # append it to the context element ! $this -> { m_contextElement } -> appendChild( { newChild => $textNode } ); } --- 184,191 ---- my ($this, $expat, $string) = @_; # first, create a text node ! my $textNode = $this -> { m_document } -> createTextNode( $string ); # append it to the context element ! $this -> { m_contextElement } -> appendChild( $textNode ); } *************** *** 205,215 **** my ($this, $expat, $target, $data) = @_; # first, create a processing instruction node ! my $procNode = $this -> { m_document } -> createProcessingInstruction( { ! target => $target, ! data => $data ! }); # append it to the context element ! $this -> { m_contextElement } -> appendChild( { newChild => $procNode } ); } --- 198,206 ---- my ($this, $expat, $target, $data) = @_; # first, create a processing instruction node ! my $procNode = $this -> { m_document } -> createProcessingInstruction( ! $target, $data ); # append it to the context element ! $this -> { m_contextElement } -> appendChild( $procNode ); } *************** *** 222,231 **** my ($this, $expat, $data) = @_; # first, create a text node ! my $commentNode = $this -> { m_document } -> createComment( { ! data => $data ! }); # append it to the context element ! $this -> { m_contextElement } -> appendChild( { newChild => $commentNode } ); } --- 213,221 ---- my ($this, $expat, $data) = @_; # first, create a text node ! my $commentNode = $this -> { m_document } -> createComment( ! $data ); # append it to the context element ! $this -> { m_contextElement } -> appendChild( $commentNode ); } *************** *** 237,244 **** my ($this, $expat) = @_; # no idea what happens here, CDATA is currently not supported. ! my $exc = XML::DOM2::DOMException -> new( { ! ErrCode => $XML::DOM2::DOMException::ERR_NOT_SUPPORTED, ! ErrDesc => "The DOMParser currently does not support CDATA sections." ! }); $exc -> raise(); } --- 227,234 ---- my ($this, $expat) = @_; # no idea what happens here, CDATA is currently not supported. ! my $exc = XML::DOM2::DOMException -> new( ! $XML::DOM2::DOMException::ERR_NOT_SUPPORTED, ! "The DOMParser currently does not support CDATA sections." ! ); $exc -> raise(); } *************** *** 251,258 **** my ($this, $expat) = @_; # no idea what happens here, CDATA is currently not supported. ! my $exc = XML::DOM2::DOMException -> new( { ! ErrCode => $XML::DOM2::DOMException::ERR_NOT_SUPPORTED, ! ErrDesc => "The DOMParser currently does not support CDATA sections." ! }); $exc -> raise(); } --- 241,248 ---- my ($this, $expat) = @_; # no idea what happens here, CDATA is currently not supported. ! my $exc = XML::DOM2::DOMException -> new( ! $XML::DOM2::DOMException::ERR_NOT_SUPPORTED, ! "The DOMParser currently does not support CDATA sections." ! ); $exc -> raise(); } Index: DOMWriter.pm =================================================================== RCS file: /cvsroot/net-script/netscript2/src/perl/XML/DOM2/DOMWriter.pm,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** DOMWriter.pm 2 Jun 2002 19:37:40 -0000 1.4 --- DOMWriter.pm 8 Jun 2002 12:14:29 -0000 1.5 *************** *** 36,48 **** #/** # Writes the given DOM to a string, using the given DOMWriterStyle ! # @param a hash reference containing the following key-value-pairs: ! # <ul><li>document - instance of XML::DOM2::Document</li> ! # <li>style - an instance of XML::DOM2::DOMWriterStyle or a subclass of it</li></ul> # @return the document as a string represenation. #*/ sub writeDOMToString { ! my ($this, $paramRef ) = @_; ! my $document = $paramRef -> { document }; ! my $style = $paramRef -> { style }; my @childrenList = ( $document ); my @elements = (); --- 36,45 ---- #/** # Writes the given DOM to a string, using the given DOMWriterStyle ! # @param instance of XML::DOM2::Document ! # @param an instance of XML::DOM2::DOMWriterStyle or a subclass of it # @return the document as a string represenation. #*/ sub writeDOMToString { ! my ($this, $document, $style ) = @_; my @childrenList = ( $document ); my @elements = (); *************** *** 58,62 **** } #check node type ! my $nodeType = $child -> nodeType(); $style -> processElement( $child ) if ($nodeType == $XML::DOM2::Node::ELEMENT_NODE ); --- 55,59 ---- } #check node type ! my $nodeType = $child -> getNodeType(); $style -> processElement( $child ) if ($nodeType == $XML::DOM2::Node::ELEMENT_NODE ); *************** *** 76,83 **** } ! my $childNodes = $child -> childNodes(); ! my $length = $childNodes -> length() - 1; for( 0..$length ){ ! unshift( @childrenList, $childNodes -> item( {index => $length - $_} ) ); } $child = shift( @childrenList ); --- 73,80 ---- } ! my $childNodes = $child -> getChildNodes(); ! my $length = $childNodes -> getLength() - 1; for( 0..$length ){ ! unshift( @childrenList, $childNodes -> item( $length - $_ ) ); } $child = shift( @childrenList ); *************** *** 88,100 **** #/** # Writes the given DOM to a file, using the given DOMWriterStyle ! # @param a hash reference containing the following key-value-pairs: ! # document - instance of XML::DOM2::Document ! # style - an instance of XML::DOM2::DOMWriterStyle or a subclass of it ! # file - the file to write the converted DOM to. (local file system,only) #*/ sub writeDOMToFile { ! my ($this, $paramRef ) = @_; ! my $result = $this -> writeDOMToString( $paramRef ); ! my $filename = $paramRef -> { file }; open( AFILE, ">$filename" ); print AFILE $result; --- 85,95 ---- #/** # Writes the given DOM to a file, using the given DOMWriterStyle ! # @param instance of XML::DOM2::Document ! # @param an instance of XML::DOM2::DOMWriterStyle or a subclass of it ! # @param the file to write the converted DOM to. (local file system,only) #*/ sub writeDOMToFile { ! my ($this, $document, $style, $filename ) = @_; ! my $result = $this -> writeDOMToString( $document, $style ); open( AFILE, ">$filename" ); print AFILE $result; Index: Document.pm =================================================================== RCS file: /cvsroot/net-script/netscript2/src/perl/XML/DOM2/Document.pm,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Document.pm 2 Jun 2002 19:37:40 -0000 1.8 --- Document.pm 8 Jun 2002 12:14:29 -0000 1.9 *************** *** 53,57 **** # @public #*/ ! sub doctype { my ($this) = @_; $this -> { m_doctype }; --- 53,57 ---- # @public #*/ ! sub getDoctype { my ($this) = @_; $this -> { m_doctype }; *************** *** 63,67 **** # @public #*/ ! sub documentElement { my ($this) = @_; $this -> { m_documentElement }; --- 63,67 ---- # @public #*/ ! sub getDocumentElement { my ($this) = @_; $this -> { m_documentElement }; *************** *** 73,77 **** # @public #*/ ! sub implementation { my ($this) = @_; $this -> { m_implementation }; --- 73,77 ---- # @public #*/ ! sub getImplementation { my ($this) = @_; $this -> { m_implementation }; *************** *** 81,98 **** # Creates an Attr node of the given name. Note that the Attr instance # can then be set on an element using the setAttributeNode method. ! # @param a hash reference containing the following key-value-pairs: ! # <ul><li>name - the name of the attribute.</li></ul> # @return an instance of XML::DOM2::Attr # @public #*/ sub createAttribute { ! my ($this, $paramRef) = @_; my $attr = XML::DOM2::Attr -> new(); $attr -> { m_ownerDocument } = $this; ! $attr -> { m_nodeName } = $paramRef -> { "name" }; $attr -> { m_localName } = undef; $attr -> { m_prefix } = undef; $attr -> { m_namespaceURI } = undef; ! $attr -> nodeValue( { "value" => ""} ); $attr; } --- 81,97 ---- # Creates an Attr node of the given name. Note that the Attr instance # can then be set on an element using the setAttributeNode method. ! # @param the name of the attribute. # @return an instance of XML::DOM2::Attr # @public #*/ sub createAttribute { ! my ($this, $name) = @_; my $attr = XML::DOM2::Attr -> new(); $attr -> { m_ownerDocument } = $this; ! $attr -> { m_nodeName } = $name; $attr -> { m_localName } = undef; $attr -> { m_prefix } = undef; $attr -> { m_namespaceURI } = undef; ! $attr -> setValue( "" ); $attr; } *************** *** 100,114 **** #/** # Creates an attribute of the given qualified name and namespace URI. ! # @param a hash reference containing the following key-value-pairs: ! # <ul><li>namespaceURI - the namespace URI of the attribute</li> ! # <li>qualifiedName - the qualified name of the attribute</li></ul> # @return an instance of XML::DOM2::Attr # @public #*/ sub createAttributeNS { ! my ($this, $paramRef ) = @_; ! my ( $prefix, $localname ) = split(/:/, $paramRef -> { qualifiedName }); ! my $namespaceURI = $paramRef -> { namespaceURI }; if ( defined( $prefix ) && !defined($localname) ) { --- 99,111 ---- #/** # Creates an attribute of the given qualified name and namespace URI. ! # @param the namespace URI of the attribute ! # @param the qualified name of the attribute # @return an instance of XML::DOM2::Attr # @public #*/ sub createAttributeNS { ! my ($this, $namespaceURI, $qualifiedName ) = @_; ! my ( $prefix, $localname ) = split(/:/, $qualifiedName ); if ( defined( $prefix ) && !defined($localname) ) { *************** *** 118,125 **** if ( defined($prefix) && !defined($namespaceURI) ) { ! my $exc = XML::DOM2::DOMException -> new ( { ! ErrCode => $XML::DOM2::DOMException::NAMESPACE_ERR, ! ErrDesc => "The qualified name (".$paramRef -> { qualifiedName }.") has a prefix, but the namespace URI is undef!" ! }); $exc -> raise(); return; --- 115,122 ---- if ( defined($prefix) && !defined($namespaceURI) ) { ! my $exc = XML::DOM2::DOMException -> new ( ! $XML::DOM2::DOMException::NAMESPACE_ERR, ! "The qualified name (".$qualifiedName.") has a prefix, but the namespace URI is undef!" ! ); $exc -> raise(); return; *************** *** 129,136 **** $namespaceURI ne "http://www.w3.org/XML/1998/namespace" ) { ! my $exc = XML::DOM2::DOMException -> new ( { ! ErrCode => $XML::DOM2::DOMException::NAMESPACE_ERR, ! ErrDesc => "The prefix is 'xml' but the namespace URI is different from 'http://www.w3.org/XML/1998/namespace'!" ! }); $exc -> raise(); } --- 126,133 ---- $namespaceURI ne "http://www.w3.org/XML/1998/namespace" ) { ! my $exc = XML::DOM2::DOMException -> new ( ! $XML::DOM2::DOMException::NAMESPACE_ERR, ! "The prefix is 'xml' but the namespace URI is different from 'http://www.w3.org/XML/1998/namespace'!" ! ); $exc -> raise(); } *************** *** 139,155 **** $namespaceURI ne "http://www.w3.org/2000/xmlns" ) { ! my $exc = XML::DOM2::DOMException -> new ( { ! ErrCode => $XML::DOM2::DOMException::NAMESPACE_ERR, ! ErrDesc => "The prefix is 'xmlns' but the namespace URI is different from 'http://www.w3.org/2000/xmlsn'!" ! }); $exc -> raise(); } my $attr = XML::DOM2::Attr -> new(); $attr -> { m_ownerDocument } = $this; ! $attr -> { m_nodeName } = $paramRef -> { qualifiedName }; $attr -> { m_namespaceURI } = $namespaceURI; $attr -> { m_prefix } = $prefix; $attr -> { m_localName } = $localname; ! $attr -> nodeValue( { "value" => ""} ) ; $attr; } --- 136,152 ---- $namespaceURI ne "http://www.w3.org/2000/xmlns" ) { ! my $exc = XML::DOM2::DOMException -> new ( ! $XML::DOM2::DOMException::NAMESPACE_ERR, ! "The prefix is 'xmlns' but the namespace URI is different from 'http://www.w3.org/2000/xmlsn'!" ! ); $exc -> raise(); } my $attr = XML::DOM2::Attr -> new(); $attr -> { m_ownerDocument } = $this; ! $attr -> { m_nodeName } = $qualifiedName; $attr -> { m_namespaceURI } = $namespaceURI; $attr -> { m_prefix } = $prefix; $attr -> { m_localName } = $localname; ! $attr -> setValue( "" ) ; $attr; } *************** *** 157,189 **** #/** # Creates a CDATASection node whose value is the specified String. ! # @param a hash reference containing the following key-value-pairs: ! # <ul><li>data - the data for the CDATASection contents.</li></ul> # @return an instance of XML::DOM2::CDATASection # @public #*/ sub createCDATASection { ! my ($this, $paramRef) = @_; my $cdata = XML::DOM2::CDATASection -> new(); $cdata -> { m_ownerDocument } = $this; ! $cdata -> data( $paramRef ); $cdata; } #/** # Creates a Comment node given the specified String. ! # @param a hash reference containing the following key-value-pairs: ! # <ul><li>data - the data for the node.</li></ul> # @return an instance of XML::DOM2::Comment # @public #*/ sub createComment { ! my ($this, $paramRef) = @_; my $comment = XML::DOM2::Comment -> new(); $comment -> { m_ownerDocument } = $this; ! $comment -> data( $paramRef ); $comment; } #/** # Creates an empty DocumentFragment object. --- 154,185 ---- #/** # Creates a CDATASection node whose value is the specified String. ! # @param the data for the CDATASection contents. # @return an instance of XML::DOM2::CDATASection # @public #*/ sub createCDATASection { ! my ($this, $data ) = @_; my $cdata = XML::DOM2::CDATASection -> new(); $cdata -> { m_ownerDocument } = $this; ! $cdata -> setData( $data ); $cdata; } #/** # Creates a Comment node given the specified String. ! # @param the data for the node. # @return an instance of XML::DOM2::Comment # @public #*/ sub createComment { ! my ($this, $data) = @_; my $comment = XML::DOM2::Comment -> new(); $comment -> { m_ownerDocument } = $this; ! $comment -> setData( $data ); $comment; } + #/** # Creates an empty DocumentFragment object. *************** *** 202,216 **** # Creates an element of the type specified. Attributes can be specified # directly on the returned object. ! # @param a hash reference containing the following key-value-pairs: ! # <ul><li>tagName - the name of the element type to instantiate.</li></ul> # @return an instance of XML::DOM2::Element # @public #*/ sub createElement { ! my ($this, $paramRef) = @_; my $element = XML::DOM2::Element -> new(); $element -> { m_ownerDocument } = $this; ! $element -> { m_nodeName } = $paramRef -> { tagName }; $element -> { m_localName } = undef; $element -> { m_prefix } = undef; --- 198,211 ---- # Creates an element of the type specified. Attributes can be specified # directly on the returned object. ! # @param the name of the element type to instantiate. # @return an instance of XML::DOM2::Element # @public #*/ sub createElement { ! my ($this, $name) = @_; my $element = XML::DOM2::Element -> new(); $element -> { m_ownerDocument } = $this; ! $element -> { m_nodeName } = $name; $element -> { m_localName } = undef; $element -> { m_prefix } = undef; *************** *** 222,235 **** #/** # Creates an element of the given qualified name and namespaceURI ! # @param a hash reference containing the following key-value-pairs: ! # <ul><li>namespaceURI - the namespace URI of the element to create</li> ! # <li>qualifiedName - the qualified name of the element type to instantiate</li></ul> # @return an instance of XML::DOM2::Element # @public #*/ sub createElementNS { ! my ($this, $paramRef) = @_; ! my ( $prefix, $localname ) = split(/:/, $paramRef -> { qualifiedName }); ! my $namespaceURI = $paramRef -> { namespaceURI }; if ( defined( $prefix ) && !defined($localname) ) { --- 217,228 ---- #/** # Creates an element of the given qualified name and namespaceURI ! # @param the namespace URI of the element to create ! # @param the qualified name of the element type to instantiate # @return an instance of XML::DOM2::Element # @public #*/ sub createElementNS { ! my ($this, $namespaceURI, $qualifiedName ) = @_; ! my ( $prefix, $localname ) = split(/:/, $qualifiedName); if ( defined( $prefix ) && !defined($localname) ) { *************** *** 239,246 **** if ( defined($prefix) && !defined($namespaceURI) ) { ! my $exc = XML::DOM2::DOMException -> new ( { ! ErrCode => $XML::DOM2::DOMException::NAMESPACE_ERR, ! ErrDesc => "The qualified name (".$paramRef->{ qualifiedName }.") has a prefix, but the namespace URI is undef!" ! }); $exc -> raise(); return; --- 232,239 ---- if ( defined($prefix) && !defined($namespaceURI) ) { ! my $exc = XML::DOM2::DOMException -> new ( ! $XML::DOM2::DOMException::NAMESPACE_ERR, ! "The qualified name (".$qualifiedName.") has a prefix, but the namespace URI is undef!" ! ); $exc -> raise(); return; *************** *** 250,257 **** $namespaceURI ne "http://www.w3.org/XML/1998/namespace" ) { ! my $exc = XML::DOM2::DOMException -> new ( { ! ErrCode => $XML::DOM2::DOMException::NAMESPACE_ERR, ! ErrDesc => "The prefix is 'xml' but the namespace URI is different from 'http://www.w3.org/XML/1998/namespace'!" ! }); $exc -> raise(); } --- 243,250 ---- $namespaceURI ne "http://www.w3.org/XML/1998/namespace" ) { ! my $exc = XML::DOM2::DOMException -> new ( ! $XML::DOM2::DOMException::NAMESPACE_ERR, ! "The prefix is 'xml' but the namespace URI is different from 'http://www.w3.org/XML/1998/namespace'!" ! ); $exc -> raise(); } *************** *** 260,267 **** $namespaceURI ne "http://www.w3.org/2000/xmlns" ) { ! my $exc = XML::DOM2::DOMException -> new ( { ! ErrCode => $XML::DOM2::DOMException::NAMESPACE_ERR, ! ErrDesc => "The prefix is 'xmlns' but the namespace URI is different from 'http://www.w3.org/2000/xmlsn'!" ! }); $exc -> raise(); } --- 253,260 ---- $namespaceURI ne "http://www.w3.org/2000/xmlns" ) { ! my $exc = XML::DOM2::DOMException -> new ( ! $XML::DOM2::DOMException::NAMESPACE_ERR, ! "The prefix is 'xmlns' but the namespace URI is different from 'http://www.w3.org/2000/xmlsn'!" ! ); $exc -> raise(); } *************** *** 271,279 **** $element -> { m_ownerDocument } = $this; ! $element -> { m_nodeName } = $paramRef -> { qualifiedName }; $element -> { m_namespaceURI } = $namespaceURI; $element -> { m_prefix } = $prefix; $element -> { m_localName } = $localname; ! $element -> { m_tagName } = $paramRef -> { qualifiedName }; $element; } --- 264,272 ---- $element -> { m_ownerDocument } = $this; ! $element -> { m_nodeName } = $qualifiedName; $element -> { m_namespaceURI } = $namespaceURI; $element -> { m_prefix } = $prefix; $element -> { m_localName } = $localname; ! $element -> { m_tagName } = $qualifiedName; $element; } *************** *** 283,288 **** # known, the child list of the EntityReference node is made the same as that # of the corresponding Entity node. ! # @param a hash reference containing the following key-value-pairs: ! # <ul><li> name - the name of the entity to reference.</li></ul> # @return an instance of XML::DOM2::EntityReference # @public --- 276,280 ---- # known, the child list of the EntityReference node is made the same as that # of the corresponding Entity node. ! # @param the name of the entity to reference. # @return an instance of XML::DOM2::EntityReference # @public *************** *** 294,298 **** #*/ sub createEntityReference { ! my ($this, $paramRef) = @_; my $eref = XML::DOM2::EntityReference -> new(); $eref -> { m_ownerDocument } = $this; --- 286,290 ---- #*/ sub createEntityReference { ! my ($this, $name) = @_; my $eref = XML::DOM2::EntityReference -> new(); $eref -> { m_ownerDocument } = $this; *************** *** 303,319 **** # Creates a processing instruction node given the specified # name and data strings. ! # @param a hash reference containing the following key-value-pairs: ! # <ul><li>target - the target part of the processing instruction</li> ! # <li>data - the data for the node</li></ul> # @return an instance of XML::DOM2::ProcessingInstruction # @public #*/ sub createProcessingInstruction { ! my ($this, $paramRef) = @_; my $pi = XML::DOM2::ProcessingInstruction -> new(); $pi -> { m_ownerDocument } = $this; ! $pi -> target( $paramRef ); ! $pi -> data( $paramRef ); $pi; } --- 295,310 ---- # Creates a processing instruction node given the specified # name and data strings. ! # @param the target part of the processing instruction ! # @param the data for the node # @return an instance of XML::DOM2::ProcessingInstruction # @public #*/ sub createProcessingInstruction { ! my ($this, $target, $data) = @_; my $pi = XML::DOM2::ProcessingInstruction -> new(); $pi -> { m_... [truncated message content] |