#!/usr/bin/perl ## This file is automatically generated ## at 2006-12-30T04:24:35+00:00, ## from file "Document.dis", ## module , ## for . ## Don't edit by hand! use strict; require Message::DOM::DOMCore; require Message::DOM::TreeCore; require Message::Util::Error::DOMException; package Message::DOM::Document; our $VERSION = 20061230.0424; package Message::DOM::Document::ManakaiDOMImplementationDocument; our $VERSION = 20061230.0424; push @Message::DOM::DOMCore::ManakaiDOMImplementation::ISA, q unless Message::DOM::DOMCore::ManakaiDOMImplementation->isa (q); sub create_document ($;$$$) { my ($self, $namespaceURI, $qualifiedName, $doctype) = @_; { if (CORE::defined $namespaceURI and CORE::length $namespaceURI == 0) { require Message::DOM::DOMMain; report Message::DOM::DOMCore::ManakaiDOMError -object => $self, '-type' => 'http://suika.fam.cx/~wakaba/archive/2004/dom/main#empty-namespace-uri', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:tag:suika.fam.cx,2005-09:1167450139:7187:cCkYT15288+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest'; ; { $namespaceURI = undef; } ; } } my $r; { require Scalar::Util; $r = bless \{ 'child' => [], 'impl' => $self, 'http://www.w3.org/2001/04/infoset#version' => '1.0', 'chk' => 1, }, 'Message::DOM::Document::ManakaiDOMDocument' ; if (defined $doctype) { { local $Error::Depth = $Error::Depth + 1; { $r-> append_child ($doctype); } ;} ; } if (defined $qualifiedName) { { local $Error::Depth = $Error::Depth + 1; { my $el = $r-> create_element_ns ($namespaceURI, $qualifiedName); $r-> append_child ($el); $r = $el-> owner_document ; ## Choose the class based on document element type } ;} ; } elsif (defined $namespaceURI) { report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NAMESPACE_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#method' => 'create_document', 'http://www.w3.org/2001/04/infoset#namespaceURI' => $namespaceURI, 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#MDOM_NS_NULL_QNAME_WITH_NON_NULL_URI', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMImplementationDocument', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'namespaceURI'; ; } } $r} $Message::DOM::DOMFeature::ClassInfo->{q}->{has_feature} = {}; $Message::DOM::ClassPoint{q} = 0; package Message::DOM::IFLatest::Document; our $VERSION = 20061230.0424; package Message::DOM::Document::ManakaiDOMDocument; our $VERSION = 20061230.0424; push our @ISA, 'Message::DOM::TreeCore::ManakaiDOMNode', 'Message::DOM::IFLatest::Document', 'Message::DOM::IFLatest::Node'; sub node_type ($;$) { if (@_ == 1) {my ($self) = @_; my $r; $r = 9; $r; } else {my ($self) = @_; report Message::Util::Error::DOMException::CoreException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#on' => 'get', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2005/manakai/Util/Error/DOMException#READ_ONLY_ATTRIBUTE_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#attr' => 'node_type'; } } sub append_child ($$) { my ($self, $newChild) = @_; my $r; { my $strictc = $self-> dom_config -> get_parameter ( 'http://suika.fam.cx/www/2006/dom-config/strict-document-children' ); my $child_od = $newChild-> owner_document || $self; my $child_nt = $newChild-> node_type ; if ($strictc and $self-> strict_error_checking ) { { local $Error::Depth = $Error::Depth + 1; { my $has_el; my $has_dt; if ($child_nt == 1 ) { $has_el = 1 ; } elsif ($child_nt == 10 ) { $has_dt = 1 ; } elsif ($child_nt == 11 ) { for my $cn (@{$newChild-> child_nodes }) { my $cnt = $cn-> node_type ; if ($cnt == 1 ) { if ($has_el) { { local $Error::Depth = $Error::Depth - 1; { report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'HIERARCHY_REQUEST_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#method' => 'append_child', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#MDOM_SECOND_DOC_ELEMENT', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'newChild', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $newChild; } ;} ; } $has_el = 1 ; } # DocumentType node cannot be contained in DocumentFragments } } if ($has_el) { my $anode = $self-> last_child ; while (defined $anode) { if ($anode-> node_type == 1 ) { { local $Error::Depth = $Error::Depth - 1; { report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'HIERARCHY_REQUEST_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#method' => 'append_child', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#MDOM_SECOND_DOC_ELEMENT', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'newChild', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $newChild; } ;} ; } $anode = $anode-> previous_sibling ; } } # has_el if ($has_dt) { my $anode = $self-> last_child ; while (defined $anode) { my $ant = $anode-> node_type ; if ($ant == 1 ) { { local $Error::Depth = $Error::Depth - 1; { report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'HIERARCHY_REQUEST_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#method' => 'append_child', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#HIERARCHY_WRONG_DOCTYPE_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'newChild', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $newChild; } ;} ; } elsif ($ant == 10 ) { { local $Error::Depth = $Error::Depth - 1; { report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'HIERARCHY_REQUEST_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#method' => 'append_child', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#MDOM_SECOND_DOCTYPE', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'newChild', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $newChild; } ;} ; } $anode = $anode-> previous_sibling ; } } # has_dt } ;} ; } { { local $Error::Depth = $Error::Depth + 1; { my $strict = $self-> strict_error_checking ; ## -- Node Type check my @new_child; if ({ 3 => (not $strictc), 5 => (not $strictc), 1 => 1, 4 => (not $strictc), 7 => 1, 8 => 1, 10 => 1, }->{$child_nt}) { push @new_child, $newChild; } elsif ($child_nt == 11 ) { for my $cn (@{$newChild-> child_nodes }) { unless ({ 3 => (not $strictc), 5 => (not $strictc), 1 => 1, 4 => (not $strictc), 7 => 1, 8 => 1, 10 => 1, }->{$cn-> node_type }) { { local $Error::Depth = $Error::Depth - 1; { report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'HIERARCHY_REQUEST_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#HIERARCHY_BAD_TYPE', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/appendChildImpl1+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'newChild', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $newChild; } ;} ; } push @new_child, $cn; } } else { { local $Error::Depth = $Error::Depth - 1; { report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'HIERARCHY_REQUEST_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#HIERARCHY_BAD_TYPE', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/appendChildImpl1+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'newChild', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $newChild; } ;} ; } my $nc_parent = @new_child ? $new_child[0]-> parent_node : undef ; if ($strict) { ## -- Wrong-document check unless ($self eq $child_od) { { local $Error::Depth = $Error::Depth - 1; { report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'WRONG_DOCUMENT_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#DIFFERENT_DOCUMENT_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/appendChildImpl1+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'newChild', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $newChild; } ;} ; } ## -- Read-onlyness check if ($self-> manakai_read_only ) { { local $Error::Depth = $Error::Depth - 1; { report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#NOMOD_THIS', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/appendChildImpl1+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest'; } ;} ; } if (@new_child) { if ($nc_parent and $nc_parent-> manakai_read_only ) { { local $Error::Depth = $Error::Depth - 1; { report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#NOMOD_SRC_PARENT', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/appendChildImpl1+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest'; } ;} ; } } } ## -- Insert at... my $index = -1; # last ; # FOR !tc:ForAppendChild ## -- Removes from parent if ($nc_parent) { if ($child_nt == 11 ) { $$newChild->{ 'child' } = []; } else { my $v = $$nc_parent->{ 'child' }; RP: for my $i (0..$#$v) { if ($v->[$i] eq $new_child[0]) { splice @$v, $i, 1, (); last RP; } } # RP } } ## -- Rewrite the |parentNode| properties for my $nc (@new_child) { $$nc->{ 'parent' } = $self; Scalar::Util::weaken ($$nc->{ 'parent' }); } my $children = $$self->{ 'child' }; { ## -- Adds to children list push @$children, @new_child; $r = $newChild; } ; ; ; } ;} ; } ; if ($child_nt == 10 and not defined $newChild-> owner_document ) { CORE::delete $$newChild->{ 'impl' }; $$newChild->{ 'od' } = $self; Scalar::Util::weaken ($$newChild->{ 'od' }); } } $r} sub insert_before ($$;$) { my ($self, $newChild, $refChild) = @_; my $r; { my $strictc = $self-> dom_config -> get_parameter ( 'http://suika.fam.cx/www/2006/dom-config/strict-document-children' ); my $child_od = $newChild-> owner_document || $self; my $child_nt = $newChild-> node_type ; if ($strictc and $self-> strict_error_checking ) { { local $Error::Depth = $Error::Depth + 1; { my $has_el; my $has_dt; if ($child_nt == 1 ) { $has_el = 1 ; } elsif ($child_nt == 10 ) { $has_dt = 1 ; } elsif ($child_nt == 11 ) { for my $cn (@{$newChild-> child_nodes }) { my $cnt = $cn-> node_type ; if ($cnt == 1 ) { if ($has_el) { { local $Error::Depth = $Error::Depth - 1; { report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'HIERARCHY_REQUEST_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#method' => 'insert_before', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#MDOM_SECOND_DOC_ELEMENT', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'newChild', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $newChild; } ;} ; } $has_el = 1 ; } # DocumentType node cannot be contained in DocumentFragments } } if ($has_el) { my $anode = $refChild ? $refChild-> previous_sibling : $self-> last_child ; while (defined $anode) { if ($anode-> node_type == 1 ) { { local $Error::Depth = $Error::Depth - 1; { report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'HIERARCHY_REQUEST_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#method' => 'insert_before', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#MDOM_SECOND_DOC_ELEMENT', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'newChild', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $newChild; } ;} ; } $anode = $anode-> previous_sibling ; } $anode = $refChild; while (defined $anode) { my $ant = $anode-> node_type ; if ($ant == 1 ) { { local $Error::Depth = $Error::Depth - 1; { report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'HIERARCHY_REQUEST_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#method' => 'insert_before', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#MDOM_SECOND_DOC_ELEMENT', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'newChild', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $newChild; } ;} ; } elsif ($ant == 10 ) { { local $Error::Depth = $Error::Depth - 1; { report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'HIERARCHY_REQUEST_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#method' => 'insert_before', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#HIERARCHY_WRONG_DOCTYPE_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'newChild', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $newChild; } ;} ; } $anode = $anode-> next_sibling ; } } # has_el if ($has_dt) { my $anode = $refChild ? $refChild-> previous_sibling : $self-> last_child ; while (defined $anode) { my $ant = $anode-> node_type ; if ($ant == 1 ) { { local $Error::Depth = $Error::Depth - 1; { report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'HIERARCHY_REQUEST_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#method' => 'insert_before', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#HIERARCHY_WRONG_DOCTYPE_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'newChild', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $newChild; } ;} ; } elsif ($ant == 10 ) { { local $Error::Depth = $Error::Depth - 1; { report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'HIERARCHY_REQUEST_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#method' => 'insert_before', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#MDOM_SECOND_DOCTYPE', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'newChild', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $newChild; } ;} ; } $anode = $anode-> previous_sibling ; } $anode = $refChild; while (defined $anode) { if ($anode-> node_type == 10 ) { { local $Error::Depth = $Error::Depth - 1; { report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'HIERARCHY_REQUEST_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#method' => 'insert_before', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#MDOM_SECOND_DOCTYPE', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'newChild', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $newChild; } ;} ; } $anode = $anode-> next_sibling ; } } # has_dt } ;} ; } { { local $Error::Depth = $Error::Depth + 1; { my $strict = $self-> strict_error_checking ; ## -- Node Type check my @new_child; if ({ 3 => (not $strictc), 5 => (not $strictc), 1 => 1, 4 => (not $strictc), 7 => 1, 8 => 1, 10 => 1, }->{$child_nt}) { push @new_child, $newChild; } elsif ($child_nt == 11 ) { for my $cn (@{$newChild-> child_nodes }) { unless ({ 3 => (not $strictc), 5 => (not $strictc), 1 => 1, 4 => (not $strictc), 7 => 1, 8 => 1, 10 => 1, }->{$cn-> node_type }) { { local $Error::Depth = $Error::Depth - 1; { report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'HIERARCHY_REQUEST_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#HIERARCHY_BAD_TYPE', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/insertBeforeImpl1+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'newChild', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $newChild; } ;} ; } push @new_child, $cn; } } else { { local $Error::Depth = $Error::Depth - 1; { report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'HIERARCHY_REQUEST_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#HIERARCHY_BAD_TYPE', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/insertBeforeImpl1+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'newChild', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $newChild; } ;} ; } my $nc_parent = @new_child ? $new_child[0]-> parent_node : undef ; if ($strict) { ## -- Wrong-document check unless ($self eq $child_od) { { local $Error::Depth = $Error::Depth - 1; { report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'WRONG_DOCUMENT_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#DIFFERENT_DOCUMENT_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/insertBeforeImpl1+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'newChild', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $newChild; } ;} ; } ## -- Read-onlyness check if ($self-> manakai_read_only ) { { local $Error::Depth = $Error::Depth - 1; { report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#NOMOD_THIS', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/insertBeforeImpl1+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest'; } ;} ; } if (@new_child) { if ($nc_parent and $nc_parent-> manakai_read_only ) { { local $Error::Depth = $Error::Depth - 1; { report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#NOMOD_SRC_PARENT', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/insertBeforeImpl1+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest'; } ;} ; } } } ## -- Insert at... my $index = -1; # last { # tc:ForAppendChild & tc:ForReplaceChild if (defined $refChild) { if ($refChild eq $newChild) { { { local $Error::Depth = $Error::Depth - 1; { report Message::DOM::DOMCore::ManakaiDOMError -object => $self, '-type' => 'http://suika.fam.cx/~wakaba/archive/2004/dom/tree#insert-before-itself', 'rdata' => $refChild, 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/insertBeforeImpl1+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest'; } ;} ; } ; ; } my $cns = $self-> child_nodes ; my $cnsl = @$cns; C: { $index = 0; for my $i (0..($cnsl-1)) { my $cn = $cns->[$i]; if ($cn eq $refChild) { $index += $i; last C; } elsif ($cn eq $newChild) { $index = -1; # offset } } { { local $Error::Depth = $Error::Depth - 1; { report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NOT_FOUND_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#NOT_CHILD_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/insertBeforeImpl1+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'refChild', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $refChild; } ;} ; } ; ; } # C } else { # |oldChild| is not defined ; } } ; # FOR !tc:ForAppendChild ## -- Removes from parent if ($nc_parent) { if ($child_nt == 11 ) { $$newChild->{ 'child' } = []; } else { my $v = $$nc_parent->{ 'child' }; RP: for my $i (0..$#$v) { if ($v->[$i] eq $new_child[0]) { splice @$v, $i, 1, (); last RP; } } # RP } } ## -- Rewrite the |parentNode| properties for my $nc (@new_child) { $$nc->{ 'parent' } = $self; Scalar::Util::weaken ($$nc->{ 'parent' }); } my $children = $$self->{ 'child' }; ; { ## -- Adds to children list if ($index == -1) { push @$children, @new_child; } else { splice @$children, $index, 0, @new_child; } $r = $newChild; } ; ; } ;} ; } ; if ($child_nt == 10 and not defined $newChild-> owner_document ) { CORE::delete $$newChild->{ 'impl' }; $$newChild->{ 'od' } = $self; Scalar::Util::weaken ($$newChild->{ 'od' }); } } $r} sub replace_child ($$$) { my ($self, $newChild, $oldChild) = @_; my $r; { my $strictc = $self-> dom_config -> get_parameter ( 'http://suika.fam.cx/www/2006/dom-config/strict-document-children' ); my $child_od = $newChild-> owner_document || $self; my $child_nt = $newChild-> node_type ; if ($strictc and $self-> strict_error_checking ) { { local $Error::Depth = $Error::Depth + 1; { my $has_el; my $has_dt; if ($child_nt == 1 ) { $has_el = 1 ; } elsif ($child_nt == 10 ) { $has_dt = 1 ; } elsif ($child_nt == 11 ) { for my $cn (@{$newChild-> child_nodes }) { my $cnt = $cn-> node_type ; if ($cnt == 1 ) { if ($has_el) { { local $Error::Depth = $Error::Depth - 1; { report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'HIERARCHY_REQUEST_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#method' => 'replace_child', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#MDOM_SECOND_DOC_ELEMENT', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'newChild', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $newChild; } ;} ; } $has_el = 1 ; } # DocumentType node cannot be contained in DocumentFragments } } if ($has_el) { my $anode = $oldChild-> previous_sibling ; while (defined $anode) { if ($anode-> node_type == 1 ) { { local $Error::Depth = $Error::Depth - 1; { report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'HIERARCHY_REQUEST_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#method' => 'replace_child', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#MDOM_SECOND_DOC_ELEMENT', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'newChild', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $newChild; } ;} ; } $anode = $anode-> previous_sibling ; } $anode = $oldChild-> next_sibling ; while (defined $anode) { my $ant = $anode-> node_type ; if ($ant == 1 ) { { local $Error::Depth = $Error::Depth - 1; { report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'HIERARCHY_REQUEST_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#method' => 'replace_child', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#MDOM_SECOND_DOC_ELEMENT', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'newChild', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $newChild; } ;} ; } elsif ($ant == 10 ) { { local $Error::Depth = $Error::Depth - 1; { report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'HIERARCHY_REQUEST_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#method' => 'replace_child', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#HIERARCHY_WRONG_DOCTYPE_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'newChild', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $newChild; } ;} ; } $anode = $anode-> next_sibling ; } } # has_el if ($has_dt) { my $anode = $oldChild-> previous_sibling ; while (defined $anode) { my $ant = $anode-> node_type ; if ($ant == 1 ) { { local $Error::Depth = $Error::Depth - 1; { report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'HIERARCHY_REQUEST_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#method' => 'replace_child', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#HIERARCHY_WRONG_DOCTYPE_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'newChild', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $newChild; } ;} ; } elsif ($ant == 10 ) { { local $Error::Depth = $Error::Depth - 1; { report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'HIERARCHY_REQUEST_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#method' => 'replace_child', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#MDOM_SECOND_DOCTYPE', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'newChild', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $newChild; } ;} ; } $anode = $anode-> previous_sibling ; } $anode = $oldChild-> next_sibling ; while (defined $anode) { if ($anode-> node_type == 10 ) { { local $Error::Depth = $Error::Depth - 1; { report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'HIERARCHY_REQUEST_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#method' => 'replace_child', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#MDOM_SECOND_DOCTYPE', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'newChild', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $newChild; } ;} ; } $anode = $anode-> next_sibling ; } } # has_dt } ;} ; } { { local $Error::Depth = $Error::Depth + 1; { my $strict = $self-> strict_error_checking ; ## -- Node Type check my @new_child; if ({ 3 => (not $strictc), 5 => (not $strictc), 1 => 1, 4 => (not $strictc), 7 => 1, 8 => 1, 10 => 1, }->{$child_nt}) { push @new_child, $newChild; } elsif ($child_nt == 11 ) { for my $cn (@{$newChild-> child_nodes }) { unless ({ 3 => (not $strictc), 5 => (not $strictc), 1 => 1, 4 => (not $strictc), 7 => 1, 8 => 1, 10 => 1, }->{$cn-> node_type }) { { local $Error::Depth = $Error::Depth - 1; { report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'HIERARCHY_REQUEST_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#HIERARCHY_BAD_TYPE', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/replaceChildImpl1+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'newChild', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $newChild; } ;} ; } push @new_child, $cn; } } else { { local $Error::Depth = $Error::Depth - 1; { report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'HIERARCHY_REQUEST_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#HIERARCHY_BAD_TYPE', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/replaceChildImpl1+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'newChild', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $newChild; } ;} ; } my $nc_parent = @new_child ? $new_child[0]-> parent_node : undef ; if ($strict) { ## -- Wrong-document check unless ($self eq $child_od) { { local $Error::Depth = $Error::Depth - 1; { report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'WRONG_DOCUMENT_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#DIFFERENT_DOCUMENT_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/replaceChildImpl1+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'newChild', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $newChild; } ;} ; } ## -- Read-onlyness check if ($self-> manakai_read_only ) { { local $Error::Depth = $Error::Depth - 1; { report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#NOMOD_THIS', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/replaceChildImpl1+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest'; } ;} ; } if (@new_child) { if ($nc_parent and $nc_parent-> manakai_read_only ) { { local $Error::Depth = $Error::Depth - 1; { report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#NOMOD_SRC_PARENT', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/replaceChildImpl1+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest'; } ;} ; } } } ## -- Insert at... my $index = -1; # last { # tc:ForAppendChild & tc:ForReplaceChild if (defined $oldChild) { if ($oldChild eq $newChild) { ; { { local $Error::Depth = $Error::Depth - 1; { report Message::DOM::DOMCore::ManakaiDOMError -object => $self, '-type' => 'http://suika.fam.cx/~wakaba/archive/2004/dom/tree#replace-by-itself', 'rdata' => $oldChild, 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/replaceChildImpl1+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest'; } ;} ; } ; } my $cns = $self-> child_nodes ; my $cnsl = @$cns; C: { $index = 0; for my $i (0..($cnsl-1)) { my $cn = $cns->[$i]; if ($cn eq $oldChild) { $index += $i; last C; } elsif ($cn eq $newChild) { $index = -1; # offset } } ; { { local $Error::Depth = $Error::Depth - 1; { report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NOT_FOUND_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#NOT_CHILD_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/replaceChildImpl1+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'oldChild', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $oldChild; } ;} ; } ; } # C } else { # |oldChild| is not defined { { local $Error::Depth = $Error::Depth - 1; { report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NOT_FOUND_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#NOT_CHILD_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/replaceChildImpl1+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'oldChild', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $oldChild; } ;} ; } ; } } ; # FOR !tc:ForAppendChild ## -- Removes from parent if ($nc_parent) { if ($child_nt == 11 ) { $$newChild->{ 'child' } = []; } else { my $v = $$nc_parent->{ 'child' }; RP: for my $i (0..$#$v) { if ($v->[$i] eq $new_child[0]) { splice @$v, $i, 1, (); last RP; } } # RP } } ## -- Rewrite the |parentNode| properties for my $nc (@new_child) { $$nc->{ 'parent' } = $self; Scalar::Util::weaken ($$nc->{ 'parent' }); } my $children = $$self->{ 'child' }; ; ; { ## -- Replaces the node splice @$children, $index, 1, @new_child; CORE::delete $$oldChild->{ 'parent' }; $r = $oldChild; } ; } ;} ; } ; if ($child_nt == 10 and not defined $newChild-> owner_document ) { CORE::delete $$newChild->{ 'impl' }; $$newChild->{ 'od' } = $self; Scalar::Util::weaken ($$newChild->{ 'od' }); } } $r} sub manakai_append_text ($$) { my ($self, $string) = @_; my $r; { { local $Error::Depth = $Error::Depth + 1; { unless ($self-> dom_config -> get_parameter ( 'http://suika.fam.cx/www/2006/dom-config/strict-document-children' )) { my $lc = $self-> last_child ; if (defined $lc and $lc-> node_type == 3 ) { $lc-> manakai_append_text (ref $string eq 'SCALAR' ? $string : \$string); } else { my $text = $self-> create_text_node (ref $string eq 'SCALAR' ? $$string : $string); $self-> append_child ($text); } } $r = $self; } ;} ; } $r} sub remove_child ($$) { my ($self, $oldChild) = @_; my $r; { if ($self-> strict_error_checking and $self-> manakai_read_only ) { report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#method' => 'remove_child', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#NOMOD_THIS', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument'; ; } { F: { my $i = -1; my $v = $$self->{ 'child' }; for my $cld (@$v) { $i++; if ($cld eq $oldChild) { splice @$v, $i, 1, (); CORE::delete $$oldChild->{ 'parent' }; $r = $oldChild; last F; } } report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NOT_FOUND_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#NOT_CHILD_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/removeChildImpl+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'oldChild', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $oldChild; ; } # F } ; } $r} sub node_name ($;$) { if (@_ == 1) {my ($self) = @_; my $r = ''; $r = '#document'; $r; } else {my ($self) = @_; report Message::Util::Error::DOMException::CoreException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#on' => 'get', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2005/manakai/Util/Error/DOMException#READ_ONLY_ATTRIBUTE_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#attr' => 'node_name'; } } sub text_content ($;$) { if (@_ == 1) {my ($self) = @_; my $r = ''; { { local $Error::Depth = $Error::Depth + 1; { if ($self-> dom_config -> get_parameter ( 'http://suika.fam.cx/www/2006/dom-config/strict-document-children' )) { $r = undef ; } else { $r = ''; my @target = @{$self-> child_nodes }; C: for my $node (@target) { my $nt = $node-> node_type ; if ($nt == 3 or $nt == 4 ) { $r .= $node-> data unless $node-> is_element_content_whitespace ; } elsif ($nt == 1 or $nt == 5 ) { unshift @target, @{$node-> child_nodes }; } } } } ;} ; } $r; } else {my ($self, $given) = @_; { if ($self-> dom_config -> get_parameter ( 'http://suika.fam.cx/www/2006/dom-config/strict-document-children' )) { report Message::DOM::DOMCore::ManakaiDOMError -object => $self, '-type' => 'http://suika.fam.cx/~wakaba/archive/2004/dom/tree#setting-node-value-no-effect', 'rdata' => $self, 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#on' => 'set', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#attr' => 'text_content'; ; } else { { { if ($self-> manakai_read_only ) { report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#NOMOD_THIS', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/NodeReadOnlyError+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest'; ; } } ; for my $__old_child (@{${$self}->{ 'child' }}) { CORE::delete $$__old_child->{ 'parent' }; } my @__new_children; if (defined $given and length $given) { my $__text = $self-> create_text_node ($given); push @__new_children, $__text; $$__text->{ 'parent' } = $self; Scalar::Util::weaken ($$__text->{ 'parent' }); } ${$self}->{ 'child' } = \@__new_children; } ; } } } } sub get_feature ($$$) { my ($self, $feature, $version) = @_; { $feature = lc $feature; } { $version = '' unless defined $version; } my $r; { $feature =~ s/^\+//; { if ($Message::Util::AutoLoad::Registry::Feature->{$feature}->{$version}) { $r = $self; } } ; unless (defined $r) { { local $Error::Depth = $Error::Depth + 1; { $r = $self->SUPER::get_feature ($feature, $version); } ;} ; } } $r} sub base_uri ($;$) { if (@_ == 1) {my ($self) = @_; my $r = ''; { $r = $$self->{ 'buri' }; unless (defined $r) { $r = $$self->{ 'duri' }; } } $r; } else {my ($self) = @_; report Message::Util::Error::DOMException::CoreException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#on' => 'get', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2005/manakai/Util/Error/DOMException#READ_ONLY_ATTRIBUTE_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#attr' => 'base_uri'; } } sub create_document_fragment ($) { my ($self) = @_; my $r; { $r = bless \{ 'od' => $self, 'child' => [], }, 'Message::DOM::Document::ManakaiDOMDocumentFragment' ; Scalar::Util::weaken ($$r->{ 'od' }); } $r} sub strict_error_checking ($;$) { if (@_ == 1) {my ($self) = @_; my $r = 0; { $r = $$self->{ 'chk' }; } $r; } else {my ($self, $given) = @_; { $$self->{ 'chk' } = $given; } } } sub dom_config ($;$) { if (@_ == 1) {my ($self) = @_; my $r; { { $r = bless [$self, $$self, 'Message::DOM::IFLatest::Document'], 'Message::DOM::DOMCore::ManakaiDOMConfiguration' ; } ; } $r; } else {my ($self) = @_; report Message::Util::Error::DOMException::CoreException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#on' => 'get', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2005/manakai/Util/Error/DOMException#READ_ONLY_ATTRIBUTE_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#attr' => 'dom_config'; } } sub document_element ($;$) { if (@_ == 1) {my ($self) = @_; my $r; { { local $Error::Depth = $Error::Depth + 1; { F: for my $child (@{$self-> child_nodes }) { if ($child-> node_type == 1 ) { $r = $child; last F; } } # F } ;} ; } $r; } else {my ($self) = @_; report Message::Util::Error::DOMException::CoreException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#on' => 'get', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2005/manakai/Util/Error/DOMException#READ_ONLY_ATTRIBUTE_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#attr' => 'document_element'; } } sub implementation ($;$) { if (@_ == 1) {my ($self) = @_; my $r; { $r = $$self->{ 'impl' }; } $r; } else {my ($self) = @_; report Message::Util::Error::DOMException::CoreException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#on' => 'get', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2005/manakai/Util/Error/DOMException#READ_ONLY_ATTRIBUTE_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#attr' => 'implementation'; } } sub xml_version ($;$) { if (@_ == 1) {my ($self) = @_; my $r = ''; { $r = $$self->{ 'http://www.w3.org/2001/04/infoset#version' }; } $r; } else {my ($self, $given) = @_; { { if ($self-> manakai_read_only ) { report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#NOMOD_THIS', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/NodeReadOnlyError+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest'; ; } } ; if (defined $given and ($given eq '1.0' or $given eq '1.1' or not $self-> strict_error_checking )) { $$self->{ 'http://www.w3.org/2001/04/infoset#version' } = $given; } else { report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NOT_SUPPORTED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#on' => 'set', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#MDOM_IMPL_NOSUPPORT_XMLVER', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#attr' => 'xml_version', 'http://www.w3.org/2001/04/infoset#version' => $given; ; } } } } sub doctype ($;$) { if (@_ == 1) {my ($self) = @_; my $r; { { local $Error::Depth = $Error::Depth + 1; { F: for my $child (@{$self-> child_nodes }) { my $nt = $child-> node_type ; if ($nt == 10 ) { $r = $child; last F; } elsif ($nt == 1 ) { # document element last F; } } # F } ;} ; } $r; } else {my ($self) = @_; report Message::Util::Error::DOMException::CoreException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#on' => 'get', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2005/manakai/Util/Error/DOMException#READ_ONLY_ATTRIBUTE_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#attr' => 'doctype'; } } sub document_uri ($;$) { if (@_ == 1) {my ($self) = @_; my $r = ''; { $r = $$self->{ 'duri' }; } $r; } else {my ($self, $given) = @_; { { if ($self-> manakai_read_only ) { report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#NOMOD_THIS', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/NodeReadOnlyError+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest'; ; } } ; $$self->{ 'duri' } = $given; } } } sub input_encoding ($;$) { if (@_ == 1) {my ($self) = @_; my $r = ''; { $r = $$self->{ 'ces' }; } $r; } else {my ($self, $given) = @_; { { if ($self-> manakai_read_only ) { report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#NOMOD_THIS', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/NodeReadOnlyError+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest'; ; } } ; $$self->{ 'ces' } = $given; } } } sub xml_encoding ($;$) { if (@_ == 1) {my ($self) = @_; my $r = ''; { $r = $$self->{ 'xcs' }; } $r; } else {my ($self, $given) = @_; { { if ($self-> manakai_read_only ) { report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#NOMOD_THIS', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/NodeReadOnlyError+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest'; ; } } ; $$self->{ 'xcs' } = $given; } } } sub xml_standalone ($;$) { if (@_ == 1) {my ($self) = @_; my $r = 0; { $r = $$self->{ 'http://www.w3.org/2001/04/infoset#standalone' }; } $r; } else {my ($self, $given) = @_; { { if ($self-> manakai_read_only ) { report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#NOMOD_THIS', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/NodeReadOnlyError+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest'; ; } } ; $$self->{ 'http://www.w3.org/2001/04/infoset#standalone' } = $given; } } } sub adopt_node ($$) { my ($self, $source) = @_; my $r; { ADOPT: { last ADOPT unless $source->isa ( 'Message::DOM::TreeCore::ManakaiDOMNode' ); my $strict = $self-> strict_error_checking ; if ($strict and $self-> manakai_read_only ) { report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#method' => 'adopt_node', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#NOMOD_THIS', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'source', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => 'source'; ; } my $parent = $source-> parent_node ; if ($strict and defined $parent and $parent-> manakai_read_only ) { report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#method' => 'adopt_node', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#NOMOD_PARENT', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'source', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => 'parent'; ; } my $nt = $source-> node_type ; my $oe; if ($nt == 2 ) { $oe = $source-> owner_element ; if ($strict and defined $oe and $oe-> manakai_read_only ) { report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#method' => 'adopt_node', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#NOMOD_PARENT', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'source', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => 'oe'; ; } } elsif ($nt == 9 or $nt == 10 or $nt == 6 or $nt == 12 ) { report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NOT_SUPPORTED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#method' => 'adopt_node', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#ADOPT_NODE_TYPE_NOT_SUPPORTED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'source', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => 'source'; ; } my @change_od; my @nodes = ($source); while (@nodes) { my $node = shift @nodes; my $nt = $node-> node_type ; if ($strict and $node-> manakai_read_only ) { report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#method' => 'adopt_node', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#NOMOD_DESCENDANT_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'source', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $node; ; } if ($nt == 1 ) { push @change_od, $node; push @nodes, @{$node-> child_nodes }; my $attrs = $node-> attributes ; my $attrsLength = $attrs-> length ; for my $i (0..($attrsLength - 1)) { push @nodes, $attrs-> item ($i); } } elsif ($nt == 2 or $nt == 5 or $nt == 11 ) { push @change_od, $node; push @nodes, @{$node-> child_nodes }; } elsif ($nt == 3 or $nt == 8 or $nt == 7 or $nt == 4 ) { push @change_od, $node; } else { ## TODO: assertion } } # nodes { local $Error::Depth = $Error::Depth + 1; { if (defined $parent) { $parent-> remove_child ($source); } elsif (defined $oe) { $oe-> remove_attribute_node ($source); } } ;} ; $r = $source; my $old_od = $change_od[0]-> owner_document ; ## NOTE: The array must have more than zero ## nodes by definition. In addition, ## it cannot contain document or document ## type nodes in current implementation. if ($old_od eq $self) { last ADOPT; } for my $n (@change_od) { $$n->{ 'od' } = $self; Scalar::Util::weaken ($$n->{ 'od' }); } for my $src (@change_od) { my $src_ud = $$src->{ 'ud' }; for my $key (keys %{$src_ud or {}}) { my $dh = $src_ud->{$key}->[1]; if ($dh) { $dh-> handle ( 5 , $key, $src_ud->{$key}->[0], $src, undef ); } } } } # ADOPT } $r} sub get_element_by_id ($$) { my ($self, $elementId) = @_; my $r; { { local $Error::Depth = $Error::Depth + 1; { my @nodes = @{$self-> child_nodes }; N: while (@nodes) { my $node = shift @nodes; next N unless $node-> node_type == 1 ; for my $attr (@{$node-> attributes }) { if ($attr-> is_id and $attr-> value eq $elementId) { $r = $attr; last N; } } unshift @nodes, @{$node-> child_nodes }; } # N } ;} ; } $r} sub get_elements_by_tag_name ($$) { my ($self, $name) = @_; my $r; { $name = "$name"; my $chk; if ($name eq '*') { $chk = sub { 1 }; } else { $chk = sub { my $node = shift; my $nodeName = $node-> node_name ; ($nodeName eq $name); }; } { $r = bless \[$self, $chk], 'Message::DOM::TreeCore::ManakaiDOMGetElementsNodeList' ; } ; } $r} sub get_elements_by_tag_name_ns ($$$) { my ($self, $namespaceURI, $localName) = @_; { if (CORE::defined $namespaceURI and CORE::length $namespaceURI == 0) { require Message::DOM::DOMMain; report Message::DOM::DOMCore::ManakaiDOMError -object => $self, '-type' => 'http://suika.fam.cx/~wakaba/archive/2004/dom/main#empty-namespace-uri', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:tag:suika.fam.cx,2005-09:1167450139:7187:cCkYT15288+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest'; ; { $namespaceURI = undef; } ; } } my $r; { $namespaceURI = "$namespaceURI" if defined $namespaceURI; $localName = "$localName"; my $chk; if (not defined $namespaceURI) { if ($localName eq '*') { $chk = sub { my $node = shift; (not defined $node-> namespace_uri ); }; } else { $chk = sub { my $node = shift; (not defined $node-> namespace_uri and $node-> local_name eq $localName); }; } } elsif ($namespaceURI eq '*') { if ($localName eq '*') { $chk = sub { 1 }; } else { $chk = sub { my $node = shift; ($node-> local_name eq $localName); }; } } else { if ($localName eq '*') { $chk = sub { my $node = shift; my $nsuri = $node-> namespace_uri ; (defined $nsuri and $nsuri eq $namespaceURI); }; } else { $chk = sub { my $node = shift; my $nsuri = $node-> namespace_uri ; (defined $nsuri and $nsuri eq $namespaceURI and $node-> local_name eq $localName); }; } } { $r = bless \[$self, $chk], 'Message::DOM::TreeCore::ManakaiDOMGetElementsNodeList' ; } ; } $r} sub import_node ($$;$) { my ($self, $importedNode, $deep) = @_; my $r; report Message::Util::Error::DOMException::CoreException -object => $self, '-type' => 'NOT_SUPPORTED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#method' => 'import_node', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#MDOM_IMPL_METHOD_NOT_IMPLEMENTED', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument'; $r} sub normalize_document ($) { my ($self) = @_; report Message::Util::Error::DOMException::CoreException -object => $self, '-type' => 'NOT_SUPPORTED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#method' => 'normalize_document', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#MDOM_IMPL_METHOD_NOT_IMPLEMENTED', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument'; } sub rename_node ($$$$) { my ($self, $n, $namespaceURI, $qualifiedName) = @_; { if (CORE::defined $namespaceURI and CORE::length $namespaceURI == 0) { require Message::DOM::DOMMain; report Message::DOM::DOMCore::ManakaiDOMError -object => $self, '-type' => 'http://suika.fam.cx/~wakaba/archive/2004/dom/main#empty-namespace-uri', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:tag:suika.fam.cx,2005-09:1167450139:7187:cCkYT15288+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest'; ; { $namespaceURI = undef; } ; } } my $r; report Message::Util::Error::DOMException::CoreException -object => $self, '-type' => 'NOT_SUPPORTED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#method' => 'rename_node', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#MDOM_IMPL_METHOD_NOT_IMPLEMENTED', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocument'; $r} sub manakai_entity_base_uri ($;$) { if (@_ == 1) {my ($self) = @_; my $r = ''; { $r = $$self->{ 'buri' }; unless (defined $r) { $r = $$self->{ 'duri' }; } } $r; } else {my ($self, $given) = @_; { { if ($self-> manakai_read_only ) { report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#NOMOD_THIS', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/NodeReadOnlyError+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest'; ; } } ; $$self->{ 'buri' } = $given; } } } sub all_declarations_processed ($;$) { if (@_ == 1) {my ($self) = @_; my $r = 0; { $r = $$self->{ 'http://www.w3.org/2001/04/infoset#allDeclarationsProcessed' }; } $r; } else {my ($self, $given) = @_; { { if ($self-> manakai_read_only ) { report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#NOMOD_THIS', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/NodeReadOnlyError+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest'; ; } } ; $$self->{ 'http://www.w3.org/2001/04/infoset#allDeclarationsProcessed' } = $given; } } } $Message::DOM::DOMFeature::ClassInfo->{q}->{has_feature} = {'core', {'', '1', '1.0', '1', '2.0', '1', '3.0', '1'}, 'xml', {'', '1', '1.0', '1', '2.0', '1', '3.0', '1'}, 'xmlversion', {'', '1', '1.0', '1', '1.1', '1'}}; $Message::DOM::ClassPoint{q} = 14.1; package Message::DOM::IFLatest::DocumentFragment; our $VERSION = 20061230.0424; package Message::DOM::Document::ManakaiDOMDocumentFragment; our $VERSION = 20061230.0424; push our @ISA, 'Message::DOM::TreeCore::ManakaiDOMNode', 'Message::DOM::IFLatest::DocumentFragment', 'Message::DOM::IFLatest::Node'; sub node_type ($;$) { if (@_ == 1) {my ($self) = @_; my $r; $r = 11; $r; } else {my ($self) = @_; report Message::Util::Error::DOMException::CoreException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#on' => 'get', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2005/manakai/Util/Error/DOMException#READ_ONLY_ATTRIBUTE_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocumentFragment', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#attr' => 'node_type'; } } sub append_child ($$) { my ($self, $newChild) = @_; my $r; { if ($self eq $newChild) { report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'HIERARCHY_REQUEST_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#method' => 'append_child', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/dom/tree#HIERARCHY_DOCUMENT_FRAGMENT_ITSELF_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocumentFragment', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'newChild'; ; } my $self_od = $self-> owner_document ; my $child_od = $newChild-> owner_document ; my $child_nt = $newChild-> node_type ; { { local $Error::Depth = $Error::Depth + 1; { my $strict = $self_od-> strict_error_checking ; ## -- Node Type check my @new_child; if ({ 3 => 1, 5 => 1, 1 => 1, 7 => 1, 4 => 1, 8 => 1, }->{$child_nt}) { push @new_child, $newChild; } elsif ($child_nt == 11 ) { for my $cn (@{$newChild-> child_nodes }) { unless ({ 3 => 1, 5 => 1, 1 => 1, 7 => 1, 4 => 1, 8 => 1, }->{$cn-> node_type }) { { local $Error::Depth = $Error::Depth - 1; { report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'HIERARCHY_REQUEST_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#HIERARCHY_BAD_TYPE', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/appendChildImpl1+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'newChild', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $newChild; } ;} ; } push @new_child, $cn; } } else { { local $Error::Depth = $Error::Depth - 1; { report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'HIERARCHY_REQUEST_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#HIERARCHY_BAD_TYPE', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/appendChildImpl1+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'newChild', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $newChild; } ;} ; } my $nc_parent = @new_child ? $new_child[0]-> parent_node : undef ; if ($strict) { ## -- Wrong-document check unless ($self_od eq $child_od) { { local $Error::Depth = $Error::Depth - 1; { report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'WRONG_DOCUMENT_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#DIFFERENT_DOCUMENT_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/appendChildImpl1+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'newChild', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $newChild; } ;} ; } ## -- Read-onlyness check if ($self-> manakai_read_only ) { { local $Error::Depth = $Error::Depth - 1; { report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#NOMOD_THIS', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/appendChildImpl1+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest'; } ;} ; } if (@new_child) { if ($nc_parent and $nc_parent-> manakai_read_only ) { { local $Error::Depth = $Error::Depth - 1; { report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#NOMOD_SRC_PARENT', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/appendChildImpl1+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest'; } ;} ; } } } ## -- Insert at... my $index = -1; # last ; # FOR !tc:ForAppendChild ## -- Removes from parent if ($nc_parent) { if ($child_nt == 11 ) { $$newChild->{ 'child' } = []; } else { my $v = $$nc_parent->{ 'child' }; RP: for my $i (0..$#$v) { if ($v->[$i] eq $new_child[0]) { splice @$v, $i, 1, (); last RP; } } # RP } } ## -- Rewrite the |parentNode| properties for my $nc (@new_child) { $$nc->{ 'parent' } = $self; Scalar::Util::weaken ($$nc->{ 'parent' }); } my $children = $$self->{ 'child' }; { ## -- Adds to children list push @$children, @new_child; $r = $newChild; } ; ; ; } ;} ; } ; } $r} sub insert_before ($$;$) { my ($self, $newChild, $refChild) = @_; my $r; { if ($self eq $newChild) { report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'HIERARCHY_REQUEST_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#method' => 'insert_before', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/dom/tree#HIERARCHY_DOCUMENT_FRAGMENT_ITSELF_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocumentFragment', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'newChild'; ; } my $self_od = $self-> owner_document ; my $child_od = $newChild-> owner_document ; my $child_nt = $newChild-> node_type ; { { local $Error::Depth = $Error::Depth + 1; { my $strict = $self_od-> strict_error_checking ; ## -- Node Type check my @new_child; if ({ 3 => 1, 5 => 1, 1 => 1, 7 => 1, 4 => 1, 8 => 1, }->{$child_nt}) { push @new_child, $newChild; } elsif ($child_nt == 11 ) { for my $cn (@{$newChild-> child_nodes }) { unless ({ 3 => 1, 5 => 1, 1 => 1, 7 => 1, 4 => 1, 8 => 1, }->{$cn-> node_type }) { { local $Error::Depth = $Error::Depth - 1; { report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'HIERARCHY_REQUEST_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#HIERARCHY_BAD_TYPE', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/insertBeforeImpl1+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'newChild', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $newChild; } ;} ; } push @new_child, $cn; } } else { { local $Error::Depth = $Error::Depth - 1; { report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'HIERARCHY_REQUEST_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#HIERARCHY_BAD_TYPE', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/insertBeforeImpl1+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'newChild', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $newChild; } ;} ; } my $nc_parent = @new_child ? $new_child[0]-> parent_node : undef ; if ($strict) { ## -- Wrong-document check unless ($self_od eq $child_od) { { local $Error::Depth = $Error::Depth - 1; { report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'WRONG_DOCUMENT_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#DIFFERENT_DOCUMENT_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/insertBeforeImpl1+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'newChild', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $newChild; } ;} ; } ## -- Read-onlyness check if ($self-> manakai_read_only ) { { local $Error::Depth = $Error::Depth - 1; { report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#NOMOD_THIS', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/insertBeforeImpl1+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest'; } ;} ; } if (@new_child) { if ($nc_parent and $nc_parent-> manakai_read_only ) { { local $Error::Depth = $Error::Depth - 1; { report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#NOMOD_SRC_PARENT', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/insertBeforeImpl1+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest'; } ;} ; } } } ## -- Insert at... my $index = -1; # last { # tc:ForAppendChild & tc:ForReplaceChild if (defined $refChild) { if ($refChild eq $newChild) { { { local $Error::Depth = $Error::Depth - 1; { report Message::DOM::DOMCore::ManakaiDOMError -object => $self, '-type' => 'http://suika.fam.cx/~wakaba/archive/2004/dom/tree#insert-before-itself', 'rdata' => $refChild, 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/insertBeforeImpl1+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest'; } ;} ; } ; ; } my $cns = $self-> child_nodes ; my $cnsl = @$cns; C: { $index = 0; for my $i (0..($cnsl-1)) { my $cn = $cns->[$i]; if ($cn eq $refChild) { $index += $i; last C; } elsif ($cn eq $newChild) { $index = -1; # offset } } { { local $Error::Depth = $Error::Depth - 1; { report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NOT_FOUND_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#NOT_CHILD_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/insertBeforeImpl1+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'refChild', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $refChild; } ;} ; } ; ; } # C } else { # |oldChild| is not defined ; } } ; # FOR !tc:ForAppendChild ## -- Removes from parent if ($nc_parent) { if ($child_nt == 11 ) { $$newChild->{ 'child' } = []; } else { my $v = $$nc_parent->{ 'child' }; RP: for my $i (0..$#$v) { if ($v->[$i] eq $new_child[0]) { splice @$v, $i, 1, (); last RP; } } # RP } } ## -- Rewrite the |parentNode| properties for my $nc (@new_child) { $$nc->{ 'parent' } = $self; Scalar::Util::weaken ($$nc->{ 'parent' }); } my $children = $$self->{ 'child' }; ; { ## -- Adds to children list if ($index == -1) { push @$children, @new_child; } else { splice @$children, $index, 0, @new_child; } $r = $newChild; } ; ; } ;} ; } ; } $r} sub replace_child ($$$) { my ($self, $newChild, $oldChild) = @_; my $r; { if ($self eq $newChild) { report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'HIERARCHY_REQUEST_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#method' => 'replace_child', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/dom/tree#HIERARCHY_DOCUMENT_FRAGMENT_ITSELF_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocumentFragment', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'newChild'; ; } my $self_od = $self-> owner_document ; my $child_od = $newChild-> owner_document ; my $child_nt = $newChild-> node_type ; { { local $Error::Depth = $Error::Depth + 1; { my $strict = $self_od-> strict_error_checking ; ## -- Node Type check my @new_child; if ({ 3 => 1, 5 => 1, 1 => 1, 7 => 1, 4 => 1, 8 => 1, }->{$child_nt}) { push @new_child, $newChild; } elsif ($child_nt == 11 ) { for my $cn (@{$newChild-> child_nodes }) { unless ({ 3 => 1, 5 => 1, 1 => 1, 7 => 1, 4 => 1, 8 => 1, }->{$cn-> node_type }) { { local $Error::Depth = $Error::Depth - 1; { report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'HIERARCHY_REQUEST_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#HIERARCHY_BAD_TYPE', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/replaceChildImpl1+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'newChild', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $newChild; } ;} ; } push @new_child, $cn; } } else { { local $Error::Depth = $Error::Depth - 1; { report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'HIERARCHY_REQUEST_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#HIERARCHY_BAD_TYPE', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/replaceChildImpl1+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'newChild', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $newChild; } ;} ; } my $nc_parent = @new_child ? $new_child[0]-> parent_node : undef ; if ($strict) { ## -- Wrong-document check unless ($self_od eq $child_od) { { local $Error::Depth = $Error::Depth - 1; { report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'WRONG_DOCUMENT_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#DIFFERENT_DOCUMENT_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/replaceChildImpl1+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'newChild', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $newChild; } ;} ; } ## -- Read-onlyness check if ($self-> manakai_read_only ) { { local $Error::Depth = $Error::Depth - 1; { report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#NOMOD_THIS', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/replaceChildImpl1+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest'; } ;} ; } if (@new_child) { if ($nc_parent and $nc_parent-> manakai_read_only ) { { local $Error::Depth = $Error::Depth - 1; { report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#NOMOD_SRC_PARENT', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/replaceChildImpl1+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest'; } ;} ; } } } ## -- Insert at... my $index = -1; # last { # tc:ForAppendChild & tc:ForReplaceChild if (defined $oldChild) { if ($oldChild eq $newChild) { ; { { local $Error::Depth = $Error::Depth - 1; { report Message::DOM::DOMCore::ManakaiDOMError -object => $self, '-type' => 'http://suika.fam.cx/~wakaba/archive/2004/dom/tree#replace-by-itself', 'rdata' => $oldChild, 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/replaceChildImpl1+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest'; } ;} ; } ; } my $cns = $self-> child_nodes ; my $cnsl = @$cns; C: { $index = 0; for my $i (0..($cnsl-1)) { my $cn = $cns->[$i]; if ($cn eq $oldChild) { $index += $i; last C; } elsif ($cn eq $newChild) { $index = -1; # offset } } ; { { local $Error::Depth = $Error::Depth - 1; { report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NOT_FOUND_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#NOT_CHILD_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/replaceChildImpl1+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'oldChild', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $oldChild; } ;} ; } ; } # C } else { # |oldChild| is not defined { { local $Error::Depth = $Error::Depth - 1; { report Message::DOM::DOMCore::ManakaiDOMException -object => $self, '-type' => 'NOT_FOUND_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#NOT_CHILD_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#resourceURI' => 'tag:suika.fam.cx,2005-09:http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/replaceChildImpl1+http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom%23ManakaiDOMLatest', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#param-name' => 'oldChild', 'http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#node' => $oldChild; } ;} ; } ; } } ; # FOR !tc:ForAppendChild ## -- Removes from parent if ($nc_parent) { if ($child_nt == 11 ) { $$newChild->{ 'child' } = []; } else { my $v = $$nc_parent->{ 'child' }; RP: for my $i (0..$#$v) { if ($v->[$i] eq $new_child[0]) { splice @$v, $i, 1, (); last RP; } } # RP } } ## -- Rewrite the |parentNode| properties for my $nc (@new_child) { $$nc->{ 'parent' } = $self; Scalar::Util::weaken ($$nc->{ 'parent' }); } my $children = $$self->{ 'child' }; ; ; { ## -- Replaces the node splice @$children, $index, 1, @new_child; CORE::delete $$oldChild->{ 'parent' }; $r = $oldChild; } ; } ;} ; } ; } $r} sub node_name ($;$) { if (@_ == 1) {my ($self) = @_; my $r = ''; $r = '#document-fragment'; $r; } else {my ($self) = @_; report Message::Util::Error::DOMException::CoreException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#on' => 'get', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2005/manakai/Util/Error/DOMException#READ_ONLY_ATTRIBUTE_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocumentFragment', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#attr' => 'node_name'; } } sub manakai_append_text ($$) { my ($self, $string) = @_; my $r; { { local $Error::Depth = $Error::Depth + 1; { my $lc = $self-> last_child ; if (defined $lc and $lc-> node_type == 3 ) { $lc-> manakai_append_text (ref $string eq 'SCALAR' ? $string : \$string); } else { my $text = $self-> owner_document -> create_text_node (ref $string eq 'SCALAR' ? $$string : $string); $self-> append_child ($text); } $r = $self; } ;} ; } $r} sub get_feature ($$$) { my ($self, $feature, $version) = @_; { $feature = lc $feature; } { $version = '' unless defined $version; } my $r; { $feature =~ s/^\+//; { if ($Message::Util::AutoLoad::Registry::Feature->{$feature}->{$version}) { $r = $self; } } ; unless (defined $r) { { local $Error::Depth = $Error::Depth + 1; { $r = $self->SUPER::get_feature ($feature, $version); } ;} ; } } $r} sub base_uri ($;$) { if (@_ == 1) {my ($self) = @_; my $r = ''; { { local $Error::Depth = $Error::Depth + 1; { $r = $self-> owner_document -> base_uri ; } ;} ; } $r; } else {my ($self) = @_; report Message::Util::Error::DOMException::CoreException -object => $self, '-type' => 'NO_MODIFICATION_ALLOWED_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#on' => 'get', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#subtype' => 'http://suika.fam.cx/~wakaba/archive/2005/manakai/Util/Error/DOMException#READ_ONLY_ATTRIBUTE_ERR', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#class' => 'Message::DOM::Document::ManakaiDOMDocumentFragment', 'http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#attr' => 'base_uri'; } } $Message::DOM::DOMFeature::ClassInfo->{q}->{has_feature} = {'core', {'', '1', '1.0', '1', '2.0', '1', '3.0', '1'}, 'xml', {'', '1', '1.0', '1', '2.0', '1', '3.0', '1'}, 'xmlversion', {'', '1', '1.0', '1', '1.1', '1'}}; $Message::DOM::ClassPoint{q} = 14.1; for ($Message::DOM::IFLatest::Node::){} ## License: 1;