From 399da01ae4eb5c5e3e9349bacc2063c946c3d4a1 Mon Sep 17 00:00:00 2001 From: Bo Yang Date: Tue, 11 Aug 2009 11:17:23 +0000 Subject: Merge the branches/struggleyb/libdom-remain back to trunk. svn path=/trunk/dom/; revision=9191 --- test/DOMTSHandler.pm | 1541 +++++++++++++++ test/INDEX | 4 - test/Makefile | 13 +- test/binding.c | 35 - test/build-test.sh | 31 + test/data/Aliases | 303 +++ test/data/binding/Aliases | 302 --- test/data/binding/sample.html | 11 - test/data/binding/staff.xml | 57 - test/dom1-interfaces.xml | 3665 ++++++++++++++++++++++++++++++++++++ test/dom2-core-interface.xml | 35 + test/dom3-core-interface.xml | 45 + test/leak-test.sh | 45 + test/lib/comparators.c | 5 - test/lib/comparators.h | 18 - test/lib/exceptions.h | 42 - test/lib/list.c | 154 -- test/lib/list.h | 57 - test/lib/testassert.c | 64 - test/lib/testassert.h | 34 - test/lib/testobject.c | 233 --- test/lib/testobject.h | 22 - test/lib/utils.c | 34 - test/lib/utils.h | 35 - test/run-single-test.sh | 144 ++ test/run-test.sh | 146 ++ test/test-list.c | 56 - test/testutils.h | 11 - test/testutils/comparators.c | 80 + test/testutils/comparators.h | 23 + test/testutils/domts.h | 25 + test/testutils/domtsasserts.c | 253 +++ test/testutils/domtsasserts.h | 61 + test/testutils/domtscondition.c | 32 + test/testutils/domtscondition.h | 18 + test/testutils/foreach.c | 96 + test/testutils/foreach.h | 41 + test/testutils/list.c | 171 ++ test/testutils/list.h | 70 + test/testutils/load.c | 151 ++ test/testutils/utils.c | 34 + test/testutils/utils.h | 35 + test/transform.pl | 21 + test/transform/ctypes.xml | 71 - test/transform/dom1-interfaces.xml | 3665 ------------------------------------ test/transform/string.xsl | 1233 ------------ test/transform/test-to-c.xsl | 511 ----- test/xml/tests/dom1.dtd | 2500 ------------------------ 48 files changed, 7072 insertions(+), 9161 deletions(-) create mode 100644 test/DOMTSHandler.pm delete mode 100644 test/INDEX delete mode 100644 test/binding.c create mode 100755 test/build-test.sh create mode 100644 test/data/Aliases delete mode 100644 test/data/binding/Aliases delete mode 100644 test/data/binding/sample.html delete mode 100644 test/data/binding/staff.xml create mode 100644 test/dom1-interfaces.xml create mode 100644 test/dom2-core-interface.xml create mode 100644 test/dom3-core-interface.xml create mode 100755 test/leak-test.sh delete mode 100644 test/lib/comparators.c delete mode 100644 test/lib/comparators.h delete mode 100644 test/lib/exceptions.h delete mode 100644 test/lib/list.c delete mode 100644 test/lib/list.h delete mode 100644 test/lib/testassert.c delete mode 100644 test/lib/testassert.h delete mode 100644 test/lib/testobject.c delete mode 100644 test/lib/testobject.h delete mode 100644 test/lib/utils.c delete mode 100644 test/lib/utils.h create mode 100755 test/run-single-test.sh create mode 100755 test/run-test.sh delete mode 100644 test/test-list.c delete mode 100644 test/testutils.h create mode 100644 test/testutils/comparators.c create mode 100644 test/testutils/comparators.h create mode 100644 test/testutils/domts.h create mode 100644 test/testutils/domtsasserts.c create mode 100644 test/testutils/domtsasserts.h create mode 100644 test/testutils/domtscondition.c create mode 100644 test/testutils/domtscondition.h create mode 100644 test/testutils/foreach.c create mode 100644 test/testutils/foreach.h create mode 100644 test/testutils/list.c create mode 100644 test/testutils/list.h create mode 100644 test/testutils/load.c create mode 100644 test/testutils/utils.c create mode 100644 test/testutils/utils.h create mode 100755 test/transform.pl delete mode 100644 test/transform/ctypes.xml delete mode 100644 test/transform/dom1-interfaces.xml delete mode 100644 test/transform/string.xsl delete mode 100644 test/transform/test-to-c.xsl delete mode 100644 test/xml/tests/dom1.dtd (limited to 'test') diff --git a/test/DOMTSHandler.pm b/test/DOMTSHandler.pm new file mode 100644 index 0000000..c7dd61d --- /dev/null +++ b/test/DOMTSHandler.pm @@ -0,0 +1,1541 @@ +# This is the PerSAX Handlers Package + +package DOMTSHandler; + +use Switch; + +use XML::XPath; +use XML::XPath::XMLParser; + +our $description = 0; +our $string_index = 0; +our $ret_index = 0; +our $condition_index = 0; +our $test_index = 0; +our $iterator_index = 0; +our $temp_index = 0; +# Sometimes, we need temp nodes +our $tnode_index = 0; +our $dom_feature = "\"XML\""; +our %bootstrap_api = ( + dom_implementation_create_document_type => "", + dom_implementation_create_document => "", +); +our %native_interface = ( + DOMString => \&generate_domstring_interface, + DOMTimeStamp => "", + DOMUserData => "", + DOMObject =>"", +); +our %special_type = ( + # Some of the type are not defined now! + boolean => "bool ", + int => "unsigned long ", + "unsigned long" => "unsigned long ", + DOMString => "dom_string *", + List => "list *", + Collection => "list *", + DOMImplementation => "dom_implementation *", + NamedNodeMap => "dom_namednodemap *", + NodeList => "dom_nodelist *", + CharacterData => "dom_characterdata *", + CDATASection => "dom_cdata_section *", +); +our %special_prefix = ( + DOMString => "dom_string", + DOMImplementation => "dom_implementation", + NamedNodeMap => "dom_namednodemap", + NodeList => "dom_nodelist", + CharacterData => "dom_characterdata", + CDATASection => "dom_cdata_section *", +); + +our %unref_prefix = ( + DOMString => "dom_string", + NamedNodeMap => "dom_namednodemap", + NodeList => "dom_nodelist", +); + +our %special_method = ( +); + +our %special_attribute = ( + namespaceURI => "namespace", +); + +our %no_unref = ( + "boolean" => 1, + "int" => 1, + "unsigned int" => 1, + "List" => 1, + "Collection" => 1, +); + +our %override_suffix = ( + boolean => "bool", + int => "int", + "unsigned long" => "unsigned_long", + DOMString => "domstring", + DOMImplementation => "domimplementation", + NamedNodeMap => "domnamednodemap", + NodeList => "domnodelist", + Collection => "list", + List => "list", +); + +our %exceptions = ( + + DOM_NO_ERR => 0, + DOM_INDEX_SIZE_ERR => 1, + DOM_DOMSTRING_SIZE_ERR => 2, + DOM_HIERARCHY_REQUEST_ERR => 3, + DOM_WRONG_DOCUMENT_ERR => 4, + DOM_INVALID_CHARACTER_ERR => 5, + DOM_NO_DATA_ALLOWED_ERR => 6, + DOM_NO_MODIFICATION_ALLOWED_ERR => 7, + DOM_NOT_FOUND_ERR => 8, + DOM_NOT_SUPPORTED_ERR => 9, + DOM_INUSE_ATTRIBUTE_ERR => 10, + DOM_INVALID_STATE_ERR => 11, + DOM_SYNTAX_ERR => 12, + DOM_INVALID_MODIFICATION_ERR => 13, + DOM_NAMESPACE_ERR => 14, + DOM_INVALID_ACCESS_ERR => 15, + DOM_VALIDATION_ERR => 16, + DOM_TYPE_MISMATCH_ERR => 17, + DOM_NO_MEM_ERR => (1<<16) +); + +our @condition = qw(same equals notEquals less lessOrEquals greater greaterOrEquals isNull notNull and or xor not instanceOf isTrue isFalse hasSize contentType hasFeature implementationAttribute); + +our @exception = qw(INDEX_SIZE_ERR DOMSTRING_SIZE_ERR HIERARCHY_REQUEST_ERR WRONG_DOCUMENT_ERR INVALID_CHARACTER_ERR NO_DATA_ALLOWED_ERR NO_MODIFICATION_ALLOWED_ERR NOT_FOUND_ERR NOT_SUPPORTED_ERR INUSE_ATTRIBUTE_ERR NAMESPACE_ERR); + +our @assertion = qw(assertTrue assertFalse assertNull assertNotNull assertEquals assertNotEquals assertSame assertInstanceOf assertSize assertEventCount assertURIEquals); + +our @control = qw(if while for-each else); + +our @framework_statement = qw(assign increment decrement append plus subtract mult divide load implementation comment hasFeature implementationAttribute EventMonitor.setUserObj EventMonitor.getAtEvents EventMonitor.getCaptureEvents EventMonitor.getBubbleEvents EventMonitor.getAllEvents wait); + +sub new { + my $type = shift; + my $dtd = shift; + my $dd = XML::XPath->new(filename => $dtd); + my $self = { + # The DTD file of the xml files + dd => $dd, + # To indicate whether we are in comments + comment => 0, + # To indicate that whether we are in element + inline_comment => 0, + # The stack of elements encountered utill now + context => [], + # The map for name => type + var => {}, + # See the comment on generate_condition2 for this member + condition_stack => [], + # The list for UNREF + unref => [], + string_unref => [], + # The indent of current statement + indent => "", + # The variables for List/Collection + # We now, declare an array for a list and then add them into a list + # The map for all the List/Collection in one test + # "List Name" => "Member type" + list_map => {}, + # The name of the current List/Collection + list_name => "", + # The number of items of the current List/Collection + list_num => 0, + # Whether List/Collection has members + list_hasmem => 0, + # The type of the current List/Collection + list_type => "", + # Whether we are in exception assertion + exception => 0, + + }; + + return bless $self, $type; +} + +sub start_element { + my ($self, $element) = @_; + + my $en = $element->{Name}; + + my $dd = $self->{dd}; + my $ct = $self->{context}; + push(@$ct, $en); + + switch ($en) { + case "test" { + ; + } + case "metadata" { + # start comments here + print "/*\n"; + $self->{comment} = 1; + } + + # Print the var definition + case "var" { + $self->generate_var($element->{Attributes}); + } + + case "member" { + if ($self->{context}->[-2] eq "var") { + if ($self->{"list_hasmem"} eq 1) { + print ", "; + } + $self->{"list_hasmem"} = 1; + $self->{"list_num"} ++; + } + } + + + # The framework statements + case [@framework_statement] { + # Because the implementationAttribute & hasFeature belongs to both + # framework-statement and condition, we should distinct the two + # situation here. Let the generate_condtion to do the work. + if ($en eq "hasFeature" || $en eq "implementationAttribute") { + next; + } + + $self->generate_framework_statement($en, $element->{Attributes}); + } + + case [@control] { + $self->generate_control_statement($en, $element->{Attributes}); + } + + # Test condition + case [@condition] { + $self->generate_condition($en, $element->{Attributes}); + } + + # The assertsions + case [@assertion] { + $self->generate_assertion($en, $element->{Attributes}); + } + + case "assertDOMException" { + # Indeed, nothing to do here! + } + + # Deal with exception + case [@exception] { + # Just see end_element + $self->{'exception'} = 1; + } + + # Then catch other case + else { + # we don't care the comment nodes + if ($self->{comment} eq 0) { + $self->generate_interface($en, $element->{Attributes}); + } + } + } +} + +sub end_element { + my ($self, $element) = @_; + + my @ct = @{$self->{context}}; + my $name = pop(@{$self->{context}}); + + switch ($name) { + case "metadata" { + print "*/\n"; + $self->{comment} = 0; + $self->generate_main(); + } + case "test" { + $self->cleanup(); + } + + case "var" { + $self->generate_list(); + } + + # End of condition + case [@condition] { + $self->complete_condition($name); + } + + # The assertion + case [@assertion] { + $self->complete_assertion($name); + } + + case [@control] { + $self->complete_control_statement($name); + } + + case [@exception] { + $name = "DOM_".$name; + print "assert(exp == $exceptions{$name});\n"; + $self->{'exception'} = 0; + } + + } +} + +sub characters { + my ($self, $data) = @_; + our $description; + + my $ct = $self->{context}; + + if ($self->{"inline_comment"} eq 1) { + print "$data->{Data}"; + return ; + } + + # We print the comments here + if ($self->{comment} eq 1) { + # So, we are in comments state + my $top = $ct->[$#{$ct}]; + if ($top eq "metadata") { + return; + } + + if ($top eq "description") { + if ($description eq 0) { + print "description: \n"; + $description = 1; + } + print "$data->{Data}"; + } else { + print "$top: $data->{Data}\n"; + } + return; + } + + if ($self->{context}->[-1] eq "member") { + # We should mark that the List/Collection has members + $self->{"list_hasmem"} = 1; + + # Here, we should detect the characters type + # whether it is a integer or string (now, we only take care + # of the two types, because I did not find any other type). + if ($self->{"list_type"} eq "") { + if ($data->{Data} =~ /^\"/) { + $self->{"list_type"} = "char *"; + print "char *".$self->{"list_name"}."Array[] = \{ $data->{Data}"; + } else { + if ($data->{Data} =~ /^[0-9]+/) { + $self->{"list_type"} = "int *"; + print "int ".$self->{"list_name"}."Array[] = \{ $data->{Data}"; + } else { + die "Some data in the we can't process: \"$data->{Data}\""; + } + } + } else { + # So, we must have known the type, just output the member + print "$data->{Data}"; + } + } +} + +sub generate_main { + my $self = shift; + # Firstly, push a new "b" to the string_unref list + push(@{$self->{"string_unref"}}, "b"); + + print << "__EOF__" + +#include +#include +#include + +#include +#include + +#include + +dom_implementation *doc_impl; +lwc_context *ctx; + +int main(int argc, char **argv) +{ + dom_exception exp; + lwc_error lerr; + + /* Firstly, initialise dom and dom implementations */ + exp = dom_initialise(myrealloc, NULL); + if (exp != DOM_NO_ERR) + return exp; + + lerr = lwc_create_context(myrealloc, NULL, &ctx); + if (lerr != lwc_error_ok) + return -1; + +__EOF__ +} + +# Note that, we have not just declare variables here +# we should also define EventListener here! +# I think this should be done after the EventListener design +# is complete +sub generate_var { + my ($self, $ats) = @_; + + my $type = ""; + my $dstring = ""; + + # For the case like {"type"} eq "DOMString" and exists $ats->{"value"}) { + $dstring = $self->generate_domstring($ats->{"value"}); + $ats->{"value"} = $dstring; + } + + $type = type_to_ctype($ats->{"type"}); + if ($type eq "") { + print "Not implement this type now\n"; + return; + } + + print "\t$type$ats->{'name'}"; + if (exists $ats->{"value"}) { + print " = $ats->{'value'};\n"; + } else { + if ($type =~ m/\*/) { + print " = NULL;"; + } else { + print ";\n"; + } + } + + my $var = $self->{"var"}; + $var->{$ats->{"name"}} = $ats->{"type"}; + + # If the type is List/Collection, we should take care of it + if ($ats->{"type"} =~ /^(List|Collection)$/) { + $self->{"list_name"} = $ats->{"name"}; + } +} + +sub generate_list { + my $self = shift; + + # We should deal with the end of when the is declaring a List/Collection + if ($self->{"list_hasmem"} eq 1) { + # Yes, we are in List/Collection declaration + # Firstly, enclose the Array declaration + print "};\n"; + + # Now, we should create the list * for the List/Collection + # Note, we should deal with "int" or "string" type with different params. + if ($self->{"list_type"} eq "char *") { + print $self->{"list_name"}." = list_new(STRING);\n"; + } + if ($self->{"list_type"} eq "int *") { + print $self->{"list_name"}." = list_new(INT);\n"; + } + if ($self->{"list_type"} eq "") { + die "A List/Collection has children member but no type is impossible!"; + } + for (my $i = 0; $i < $self->{"list_num"}; $i++) { + # Use *(char **) to convert char *[] to char * + print "list_add(".$self->{"list_name"}.", *(char **)(".$self->{"list_name"}."Array + $i));\n"; + } + } else { + if ($self->{"list_name"} ne "") { + #TODO: generally, we set the list type as dom_string, but it may be dom_node + print $self->{"list_name"}." = list_new(DOM_STRING);\n"; + $self->{"list_type"} = "DOMString"; + } + } + + # Add the List/Collection to map + $self->{"list_map"}->{$self->{"list_name"}} = $self->{"list_type"}; + + # Reset the List/Collection member state + $self->{"list_hasmem"} = 0; + $self->{"list_name"} = ""; + $self->{"list_type"} = ""; + $self->{"list_num"} = 0; +} + +sub generate_load { + my ($self, $a) = @_; + my %ats = %$a; + my $doc = $ats{"var"}; + + $test_index ++; + # define the test file path, use HTML if there is, otherwise using XML + # Attention: I intend to copy the test files to the program excuting dir + print "\tchar *test$test_index = \"$ats{'href'}.html\";\n\n"; + print "$doc = load_html(test$test_index, $ats{'willBeModified'});"; + print "if ($doc == NULL) {"; + $test_index ++; + print " char *test$test_index = \"$ats{'href'}.xml\";\n\n"; + print " $doc = load_xml(test$test_index, $ats{'willBeModified'});"; + print " if ($doc == NULL)"; + print " return 1;"; + print "}"; + print << "__EOF__"; +exp = dom_document_get_implementation($doc, &doc_impl); +if (exp != DOM_NO_ERR) + return exp; +__EOF__ + + $self->addto_cleanup($doc); +} + +sub generate_framework_statement { + my ($self, $name, $ats) = @_; + + switch($name) { + case "load" { + $self->generate_load($ats); + } + + case "assign" { + my $var = $ats->{"var"}; + my $value = "0"; + if (exists $ats->{"value"}) { + $value = $ats->{"value"}; + } + + # Assign with strong-type-conversion, this is necessary in C. + # And we may need to do deep-copy in the future. FIXME + my $type = type_to_ctype($self->{"var"}->{$var}); + print "$var = \($type\) $value;\n"; + } + + case "increment" { + my $var = $ats->{"var"}; + my $value = $ats->{"value"}; + + print "$var += $value;\n"; + } + + case "decrement" { + my $var = $ats->{"var"}; + my $value = $ats->{"value"}; + + print "$var -= $value;\n"; + } + + case "append" { + my $col = $ats->{"collection"}; + my $obj = ""; + + # God, the DTD said, there should be a "OBJ" attribute, but there may not! + if (exists $ats->{"obj"}) { + $obj = $ats->{"obj"}; + } else { + $obj = $ats->{"item"} + } + + if (not $self->{"var"}->{$col} =~ /^(List|Collection)/) { + die "Append data to some non-list type!"; + } + + print "list_add($col, $obj);\n"; + } + + case [qw(plus subtract mult divide)] { + my $var = $ats->{"var"}; + my $op1 = $ats->{"op1"}; + my $op2 = $ats->{"op2"}; + + my %table = ("plus", "+", "subtract", "-", "mult", "*", "divide", "/"); + print "$var = $op1 $table{$name} $op2;\n"; + } + + case "comment" { + print "\*"; + $self->{"inline_comment"} = 1; + } + + case "implementation" { + if (not exists $ats->{"obj"}) { + my $var = $ats->{"var"}; + my $dstring = generate_domstring($self, $dom_feature); + print "exp = dom_implregistry_get_dom_implementation($dstring, \&$var);"; + print "if (exp != DOM_NO_ERR) {"; + $self->cleanup_fail("\t\t"); + print "return exp;}"; + last; + } + + my $obj = $ats->{"obj"}; + my $var = $ats->{"var"}; + # Here we directly output the libDOM's get_implementation API + print "exp = dom_document_get_implementation($obj, \&$var);"; + print "if (exp != DOM_NO_ERR) {"; + $self->cleanup_fail("\t\t"); + print "return exp;}"; + } + + # We deal with hasFeaturn and implementationAttribute in the generate_condition + case "hasFeature" { + die "No, never can be here!"; + } + case "implementaionAttribute" { + die "No, never can be here!"; + } + + # Here, we die because we did not implement other statements + # We did not implement these statements, because there are no use of them in the W3C DOMTS now + case [@framework_statement] { + die "The statement \"$name\" is not implemented yet!"; + } + + } +} + +sub complete_framework_statement { + my ($self, $name) = @_; + + switch($name) { + case "comment" { + print "*/\n"; + $self->{"inline_comment"} = 0; + } + } +} + +sub generate_interface { + my ($self, $en, $a) = @_; + my %ats = %$a; + my $dd = $self->{dd}; + + if (exists $ats{'interface'}) { + # Firstly, test whether it is a DOM native interface + if (exists $native_interface{$ats{'interface'}}) { + if ($native_interface{$ats{'interface'}} eq "") { + die "Unkown how to deal with $en of $ats{'interface'}"; + } + + return $native_interface{$ats{'interface'}}($self, $en, $a); + } + + my $ns = $dd->find("/library/interface[\@name=\"$ats{'interface'}\"]/method[\@name=\"$en\"]"); + if ($ns->size() != 0) { + my $node = $ns->get_node(1); + $self->generate_method($en, $node, %ats); + } else { + my $ns = $dd->find("/library/interface[\@name=\"$ats{'interface'}\"]/attribute[\@name=\"$en\"]"); + if ($ns->size() != 0) { + my $node = $ns->get_node(1); + $self->generate_attribute_accessor($en, $node, %ats); + } + } + } else { + my $ns = $dd->find("/library/interface/method[\@name=\"$en\"]"); + if ($ns->size() != 0) { + my $node = $ns->get_node(1); + $self->generate_method($en, $node, %ats); + } else { + my $ns = $dd->find("/library/interface/attribute[\@name=\"$en\"]"); + if ($ns->size() != 0) { + my $node = $ns->get_node(1); + $self->generate_attribute_accessor($en, $node, %ats); + } else { + die "Oh, Can't find how to deal with the element $en\n"; + } + } + } +} + +sub generate_method { + my ($self, $en, $node, %ats) = @_; + my $dd = $self->{dd}; + if (! exists $ats{'interface'}) { + my $n = $node; + while($n->getLocalName() ne "interface") { + $n = $n->getParentNode(); + } + $ats{'interface'} = $n->getAttribute("name"); + } + + $method = to_cmethod($ats{'interface'}, $en); + + my $ns = $dd->find("parameters/param", $node); + my $params = "$ats{'obj'}"; + for ($count = 1; $count <= $ns->size; $count++) { + my $n = $ns->get_node($count); + my $p = $n->getAttribute("name"); + my $t = $n->getAttribute("type"); + + # Change the raw string and the char * to dom_string + if ($t eq "DOMString") { + if ($ats{$p} =~ /^"/ or $self->{"var"}->{$ats{$p}} eq "char *") { + $self->generate_domstring($ats{$p}); + $params = $params.", dstring$string_index"; + next; + } + } + + # For the case that the testcase did not provide the param, we just pass a NULL + # Because we are in C, not like C++ which can overriden functions + if (not exists $ats{$p}) { + $params = $params.", NULL"; + next; + } + + $params = $params.", $ats{$p}"; + } + + #$ns = $dd->find("returns", $node); + #my $n = $ns->get_node(1); + #my $t = $n->getAttribute("type"); + # declare the return value + #my $tp = type_to_ctype($t); + #print "\t$tp ret$ret_index;\n"; + my $unref = 0; + my $temp_node = 0; + if (exists $ats{'var'}) { + # Add the bootstrap params + if (exists $bootstrap_api{$method}) { + $params = $params.", myrealloc, NULL, ctx"; + } + # Deal with the situation like + # + # dom_node_append_child(node, new_node, &node); + # + # Here, we should import a tempNode, and change this expression to + # + # dom_node *tnode1 = NULL; + # dom_node_append_child(node, new_node, &tnode1); + # dom_node_unref(node); + # node = tnode1; + # + # Over. + if ($ats{'obj'} eq $ats{'var'}) { + my $t = type_to_ctype($self->{'var'}->{$ats{'var'}}); + $tnode_index ++; + print "$t tnode$tnode_index = NULL;"; + $params = $params.", \&tnode$tnode_index"; + # The ats{'obj'} must have been added to cleanup stack + $unref = 1; + # Indicate that we have created a temp node + $temp_node = 1; + } else { + $params = $params.", (void *) \&$ats{'var'}"; + $unref = $self->param_unref($ats{'var'}); + } + } + + print "exp = $method($params);"; + + if ($self->{'exception'} eq 0) { + print << "__EOF__"; + if (exp != DOM_NO_ERR) { + fprintf(stderr, "Exception raised from %s\\n", "$method"); +__EOF__ + + $self->cleanup_fail("\t\t"); + print << "__EOF__"; + return exp; + } +__EOF__ + } + + if (exists $ats{'var'} and $unref eq 0) { + $self->addto_cleanup($ats{'var'}); + } + + if ($temp_node eq 1) { + my $t = $self->{'var'}->{$ats{'var'}}; + if (not exists $no_unref{$t}) { + my $prefix = "dom_node"; + if (exists $unref_prefix{$t}) { + $prefix = $unref_prefix{$t}; + } + print $prefix."_unref(".$ats{'obj'}.");\n"; + } + print "$ats{'var'} = tnode$tnode_index;"; + } +} + +sub generate_attribute_accessor { + my ($self, $en, $node, %ats) = @_; + + if (defined($ats{'var'})) { + generate_attribute_fetcher(@_); + } else { + if (defined($ats{'value'})) { + generate_attribute_setter(@_); + } + } +} + +sub generate_attribute_fetcher { + my ($self, $en, $node, %ats) = @_; + my $dd = $self->{dd}; + if (! exists $ats{'interface'}) { + my $n = $node; + while($n->getLocalName() ne "interface") { + $n = $n->getParentNode(); + } + $ats{'interface'} = $n->getAttribute("name"); + } + + my $fetcher = to_attribute_fetcher($ats{'interface'}, "$en"); + + my $unref = 0; + my $temp_node = 0; + # Deal with the situation like + # + # dom_node_get_next_sibling(child, &child); + # + # Here, we should import a tempNode, and change this expression to + # + # dom_node *tnode1 = NULL; + # dom_node_get_next_sibling(child, &tnode1); + # dom_node_unref(child); + # child = tnode1; + # + # Over. + if ($ats{'obj'} eq $ats{'var'}) { + my $t = type_to_ctype($self->{'var'}->{$ats{'var'}}); + $tnode_index ++; + print "$t tnode$tnode_index = NULL;"; + print "exp = $fetcher($ats{'obj'}, \&tnode$tnode_index);"; + # The ats{'obj'} must have been added to cleanup stack + $unref = 1; + # Indicate that we have created a temp node + $temp_node = 1; + } else { + $unref = $self->param_unref($ats{'var'}); + print "exp = $fetcher($ats{'obj'}, \&$ats{'var'});"; + } + + + if ($self->{'exception'} eq 0) { + print << "__EOF__"; + if (exp != DOM_NO_ERR) { + fprintf(stderr, "Exception raised when fetch attribute %s", "$en"); +__EOF__ + $self->cleanup_fail("\t\t"); + print << "__EOF__"; + return exp; + } +__EOF__ + } + + if ($temp_node eq 1) { + my $t = $self->{'var'}->{$ats{'var'}}; + if (not exists $no_unref{$t}) { + my $prefix = "dom_node"; + if (exists $unref_prefix{$t}) { + $prefix = $unref_prefix{$t}; + } + print $prefix."_unref(".$ats{'obj'}.");\n"; + } + print "$ats{'var'} = tnode$tnode_index;"; + } + + if ($unref eq 0) { + $self->addto_cleanup($ats{'var'}); + } +} + +sub generate_attribute_setter { + my ($self, $en, $node, %ats) = @_; + my $dd = $self->{dd}; + if (! exists $ats{'interface'}) { + my $n = $node; + while($n->getLocalName() ne "interface") { + $n = $n->getParentNode(); + } + $ats{'interface'} = $n->getAttribute("name"); + } + + my $setter = to_attribute_setter($ats{'interface'}, "$en"); + my $param = "$ats{'obj'}"; + + # For DOMString, we should deal specially + my $lp = $ats{'value'}; + if ($node->getAttribute("type") eq "DOMString") { + if ($ats{'value'} =~ /^"/ or $self->{"var"}->{$ats{'value'}} eq "char *") { + $lp = $self->generate_domstring($ats{'value'}); + } + } + + $param = $param.", $lp"; + + print "exp = $setter($param);"; + + if ($self->{'exception'} eq 0) { + print << "__EOF__"; + if (exp != DOM_NO_ERR) { + fprintf(stderr, "Exception raised when fetch attribute %s", "$en"); +__EOF__ + $self->cleanup_fail("\t\t"); + print << "__EOF__"; + return exp; + } +__EOF__ + } + +} + + +sub generate_condition { + my ($self, $name, $ats) = @_; + + # If we are in nested or/and/xor/not, we should put a operator before test + my @array = @{$self->{condition_stack}}; + if ($#array ge 0) { + switch ($array[-1]) { + case "xor" { + print " ^ "; + } + case "or" { + print " || "; + } + case "and" { + print " && "; + } + # It is the indicator, just pop it. + case "new" { + pop(@{$self->{condition_stack}}); + } + } + } + + switch ($name) { + case [qw(less lessOrEquals greater greaterOrEquals)] { + my $actual = $ats->{actual}; + my $expected = $ats->{expected}; + my $method = $name; + $method =~ s/[A-Z]/_$&/g; + $method = lc $method; + print "$method($expected, $actual)"; + } + + case "same" { + my $actual = $ats->{actual}; + my $expected = $ats->{expected}; + my $func = $self->find_override("is_same", $actual, $expected); + print "$func($expected, $actual)"; + } + + case [qw(equals notEquals)]{ + my $actual = $ats->{actual}; + my $expected = $ats->{expected}; + my $ig; + if (exists $ats->{ignoreCase}){ + $ig = $ats->{ignoreCase}; + } else { + $ig = "false"; + } + $ig = adjust_ignore($ig); + + my $func = $self->find_override("is_equals", $actual, $expected); + if ($name =~ /not/i){ + print "(false == $func($expected, $actual, $ig))"; + } else { + print "$func($expected, $actual, $ig)"; + } + } + + case [qw(isNull notNull)]{ + my $obj = $ats->{obj}; + if ($name =~ /not/i) { + print "(false == is_null($obj))"; + } else { + print "is_null($obj)"; + } + } + + case "isTrue" { + my $value = $ats->{value}; + print "is_true($value)"; + } + + case "isFalse" { + my $value = $ats->{value}; + print "(false == is_true($value))"; + } + + case "hasSize" { + my $obj = $ats->{obj}; + my $size = $ats->{expected}; + my $func = $self->find_override("is_size", $obj, $size); + print "$func($size, $obj)"; + } + + case "contentType" { + my $type = $ats->{type}; + print "is_contenttype(\"$type\")"; + } + + case "instanceOf" { + my $obj = $ats->{obj}; + my $type = $ats->{type}; + print "instanceOf(\"$type\", $obj)"; + } + + case "hasFeature" { + if (exists $ats->{var}) { + $self->generate_interface($name, $ats); + } else { + my $feature = $ats->{feature}; + if (not ($feature =~ /^"/)) { + $feature = '"'.$feature.'"'; + } + my $version = "NULL"; + if (exists $ats->{version}) { + $version = $ats->{version}; + if (not ($version =~ /^"/)) { + $version = '"'.$version.'"'; + } + + } + + if ($self->{context}->[-2] ne "condition") { + # we are not in a %condition place, so we must be a statement + # we change this to assert + # print "assert(has_feature($feature, $version));\n" + # do nothing if we are not in condition. + } else { + print "has_feature($feature, $version)"; + } + } + } + + case "implementationAttribute" { + my $value = $ats->{value}; + my $name = $ats->{name}; + + if ($self->{context}->[-2] ne "condition") { + # print "assert(implementation_attribute(\"$name\", $value));"; + # Do nothing, and the same with hasFeature, this means we will + # run all test cases now and try to get a result whether we support + # such feature. + } else { + print "implementation_attribute(\"$name\", $value)"; + } + } + + case [qw(and or xor)] { + push(@{$self->{condition_stack}}, $name); + push(@{$self->{condition_stack}}, "new"); + print "("; + } + + case "not" { + push(@{$self->{condition_stack}}, $name); + print "(false == "; + } + } + +} + +sub complete_condition { + my ($self, $name) = @_; + + if ($name =~ /^(xor|or|and)$/i) { + print ")"; + my $top = pop(@{$self->{condition_stack}}); + die "Condition stack error! $top != $name" if $top ne $name; + } + + if ($name eq "not") { + my $top = pop(@{$self->{condition_stack}}); + die "Condition stack error! $top != $name" if $top ne $name; + print ")"; + } + + # we deal with the situation that the %condition is in a control statement such as + # or , and we should start a new '{' block here + if ($self->{context}->[-1] eq "condition") { + print ") {\n"; + pop(@{$self->{context}}); + } +} + +sub generate_assertion { + my ($self, $name, $ats) = @_; + + print "\tassert("; + switch($name){ + # Only assertTrue & assertFalse can have nested %conditions + case [qw(assertTrue assertFalse assertNull)] { + my $n = $name; + $n =~ s/assert/is/g; + if (exists $ats->{actual}){ + my $ta = { value => $ats->{actual}, obj => $ats->{actual}}; + $self->generate_condition($n,$ta); + } + } + + case [qw(assertNotNull assertEquals assertNotEquals assertSame)] { + my $n = $name; + $n =~ s/assert//g; + $n = lcfirst $n; + if (exists $ats->{actual}){ + my $ta = { + actual => $ats->{actual}, + value => $ats->{actual}, + obj => $ats->{actual}, + expected => $ats->{expected}, + ignoreCase => $ats->{ignoreCase}, + type => $ats->{type}, + }; + $self->generate_condition($n,$ta); + } + } + + case "assertInstanceOf" { + my $obj = $ats->{obj}; + my $type = $ats->{type}; + print "is_instanceof(\"$type\", $obj)"; + } + + case "assertSize" { + my $n = $name; + $n =~ s/assert/has/; + if (exists $ats->{collection}){ + my $ta = { obj => $ats->{collection}, expected => $ats->{size}}; + $self->generate_condition($n,$ta); + } + } + + case "assertEventCount" { + #todo + } + + case "assertURIEquals" { + my $actual = $ats->{actual}; + my ($scheme, $path, $host, $file, $query, $fragment, $isAbsolute) = qw(NULL NULL NULL NULL NULL NULL NULL); + if (exists $ats->{scheme}) { + $scheme = $ats->{scheme}; + } + if (exists $ats->{path}) { + $path = $ats->{path}; + } + if (exists $ats->{host}) { + $host = $ats->{host}; + } + if (exists $ats->{file}) { + $file = $ats->{file}; + } + if (exists $ats->{query}) { + $query = $ats->{query}; + } + if (exists $ats->{fragment}) { + $fragment = $ats->{fragment}; + } + if (exists $ats->{isAbsolute}) { + $isAbsolute = $ats->{isAbsolute}; + } + + print "is_uri_equals($scheme, $path, $host, $file, $query, $fragment, $isAbsolute, $actual)" + } + } + +} + +sub complete_assertion { + my ($self, $name) = @_; + + print ");\n"; +} + +sub generate_control_statement { + my ($self, $name, $ats) = @_; + + switch($name) { + case "if" { + print "\tif("; + push(@{$self->{"context"}}, "condition"); + } + + case "else" { + $self->cleanup_block_domstring(); + print "\t} else {"; + } + + case "while" { + print "\twhile ("; + push(@{$self->{"context"}}, "condition"); + } + + case "for-each" { + # Detect what is the collection type, if it is "string", we + # should also do some conversion work + my $coll = $ats->{"collection"}; + # The default member type is dom_node + my $type = "dom_node *"; + if (exists $self->{"list_map"}->{$coll}) { + $type = $self->{"list_map"}->{$coll}; + } + + # Find the member variable, if it is not declared before, declare it firstly + my $member = $ats->{"member"}; + if (not exists $self->{"var"}->{$member}) { + print "$type $member;\n"; + # Add the new variable to the {var} map + $self->{"var"}->{"$member"} = $type; + } + + # Now the member is conformed to be declared + if ($self->{"var"}->{$coll} =~ /^(List|Collection)$/) { + # The element in the list is not equal with the member object + # For now, there is only one case for this, it is "char *" <=> "DOMString" + my $conversion = 0; + if ($self->{"var"}->{"$member"} ne $type) { + if ($self->{"var"}->{"$member"} eq "DOMString") { + if ($type eq "char *") { + $conversion = 1; + } + } + } + + $iterator_index++; + print "unsigned int iterator$iterator_index = 0;"; + if ($conversion eq 1) { + print "char *tstring$temp_index = NULL;"; + } + print "foreach_initialise_list($coll, \&iterator$iterator_index);\n"; + print "while(get_next_list($coll, \&iterator$iterator_index, "; + if ($conversion eq 1) { + print "\&tstring$temp_index)) {\n"; + print "exp = dom_string_create(myrealloc, NULL, (const uint8_t *)tstring$temp_index,"; + print "strlen(tstring$temp_index), &$member);"; + print "if (exp != DOM_NO_ERR) {"; + print "fprintf(stderr, \"Can't create DOMString\\n\");"; + $self->cleanup_fail("\t\t"); + print "return exp; }"; + $temp_index ++; + } else { + print "\&$member)) {\n"; + } + } + + if ($self->{"var"}->{$coll} eq "NodeList") { + $iterator_index++; + print "unsigned int iterator$iterator_index = 0;"; + print "foreach_initialise_domnodelist($coll, \&iterator$iterator_index);\n"; + print "while(get_next_domnodelist($coll, \&iterator$iterator_index, \&$member)) {\n"; + } + + if ($self->{"var"}->{$coll} eq "NamedNodeMap") { + $iterator_index++; + print "unsigned int iterator$iterator_index = 0;"; + print "foreach_initialise_domnamednodemap($coll, \&iterator$iterator_index);\n"; + print "while(get_next_domnamednodemap($coll, \&iterator$iterator_index, \&$member)) {\n"; + } + } + } + + # Firstly, we enter a new block, so push a "b" into the string_unref list + push(@{$self->{"string_unref"}}, "b"); +} + +sub complete_control_statement { + my ($self, $name) = @_; + + # Note: we only print a '}' when element ended but not + # The reason is that there may be no element in and + # we when there is an element, it must nested in . ^_^ + switch($name) { + case [qw(if while for-each)] { + # Firstly, we should cleanup the dom_string in this block + $self->cleanup_block_domstring(); + + print "}\n"; + } + } +} + + +############################################################################### +# +# The helper functions +# +sub generate_domstring { + my ($self, $str) = @_; + $string_index = $string_index + 1; + + print << "__EOF__"; + const char *string$string_index = $str; + dom_string *dstring$string_index; + exp = dom_string_create(myrealloc, NULL, (const uint8_t *)string$string_index, + strlen(string$string_index), &dstring$string_index); + if (exp != DOM_NO_ERR) { + fprintf(stderr, "Can't create DOMString\\n"); +__EOF__ + $self->cleanup_fail("\t\t"); + print << "__EOF__"; + return exp; + } + +__EOF__ + + push(@{$self->{string_unref}}, "$string_index"); + + return "dstring$string_index"; +} + +sub cleanup_domstring { + my ($self, $indent) = @_; + + for (my $i = 0; $i <= $#{$self->{string_unref}}; $i++) { + if ($self->{string_unref}->[$i] ne "b") { + print $indent."dom_string_unref(dstring$self->{string_unref}->[$i]);\n"; + } + } +} + +sub cleanup_block_domstring { + my $self = shift; + + while ((my $num = pop(@{$self->{string_unref}})) ne "b" and $#{$self->{string_unref}} ne -1) { + print "dom_string_unref(dstring$num);\n"; + } +} + +sub type_to_ctype { + my $type = shift; + + if (exists $special_type{$type}) { + return $special_type{$type}; + } + + # If the type is not specially treated, we can transform it by rules + if ($type =~ m/^HTML/) { + # Don't deal with this now + return ""; + } + + # The core module comes here + $type =~ s/[A-Z]/_$&/g; + $type = lc $type; + return "dom".$type." *"; +} + +sub to_cmethod { + my ($type, $m) = @_; + my $prefix = get_prefix($type); + my $ret; + + if (exists $special_method{$m}) { + $ret = $prefix."_".$special_method{$m}; + } else { + $m =~ s/[A-Z]/_$&/g; + $m = lc $m; + $ret = $prefix."_".$m; + } + + $ret =~ s/h_t_m_l/html/; + $ret =~ s/c_d_a_t_a/cdata/; + $ret =~ s/_n_s$/_ns/; + return $ret; +} + +sub to_attribute_fetcher { + return to_attribute_accessor(@_, "get"); +} + +sub to_attribute_setter { + return to_attribute_accessor(@_, "set"); +} + +sub to_attribute_accessor { + my ($type, $af, $accessor) = @_; + my $prefix = get_prefix($type); + my $ret; + + if (exists $special_attribute{$af}) { + $ret = $prefix."_".$accessor."_".$special_attribute{$af}; + } else { + $af =~ s/[A-Z]/_$&/g; + $af = lc $af; + $ret = $prefix."_".$accessor."_".$af; + } + + $ret =~ s/h_t_m_l/html/; + return $ret; +} + +sub get_prefix { + my $type = shift; + + if (exists $special_prefix{$type}) { + $prefix = $special_prefix{$type}; + } else { + $type =~ s/[A-Z]/_$&/g; + $prefix = lc $type; + $prefix = "dom".$prefix; + } + return $prefix; +} + +# This function remain unsed +sub get_suffix { + my $type = shift; + my $suffix = "default"; + + if (exists $override_suffix{$type}) { + $suffix = $override_suffix{$type}; + } else { + $type =~ s/[A-Z]/_$&/g; + $suffix = lc $type; + $suffix = "dom".$suffix; + } + return $suffix; +} + +#asserttions sometimes can contain sub-statements according the DTD. Like +# +# +# +# +# +# And assertion can contains assertions too! So, I use the assertion_stack +# to deal: +# +# when we encounter an assertion, we push $assertionName, "end", "start" to +# the stack, and when we encounter a statement, we examine the stack to see +# the top element, if it is: +# +# 1. "start", then we are in sub-statement of that assertion, and this is the +# the first sub-statement, so we should print a if (condtion==true) {, before +# print the real statement. +# 2. "end", then we are in sub-statement of that assertion, and we are not the +# first one, just print the statement. +# +# But after searching the whole testcases, I found no use of sub-statements of assertions. +# So, this function left unsed! + +sub end_half_assertion { + my ($self, $name) = @_; + + my $top = pop(@{$self->{assertion_stack}}); + if ($top eq "end") { + print "$self->{indent}"."}\n"; + } else { + if ($top eq "start") { + pop(@{$self->{assertion_stack}}); + pop(@{$self->{assertion_stack}}); + } + } + + pop(@{$self->{assertion_stack}}); +} +### Enclose an unsed function +############################################################################################## + + +sub cleanup_domvar { + my ($self, $indent) = @_; + + my $str = join($indent, @{$self->{unref}}); + print $indent.$str."\n"; +} + +sub cleanup_fail { + my ($self, $indent) = @_; + + $self->cleanup_domstring($indent); + $self->cleanup_domvar($indent); +} + +sub cleanup { + my $self = shift; + + print "\n\n"; + $self->cleanup_domstring("\t"); + $self->cleanup_domvar("\t"); + print "\n\treturn 0;\n"; + print "\n\}\n"; +} + +sub addto_cleanup { + my ($self, $var) = @_; + + my $type = $self->{'var'}->{$var}; + if (not exists $no_unref{$type}) { + my $prefix = "dom_node"; + if (exists $unref_prefix{$type}) { + $prefix = $unref_prefix{$type}; + } + push(@{$self->{unref}}, $prefix."_unref(".$var.");\n"); + } +} + +sub adjust_ignore { + my $ig = shift; + + if ($ig eq "auto"){ + return "true"; + } + return $ig; +} + +sub find_override { + my ($self, $func, $var, $expected) = @_; + my $vn = $self->{var}->{$var}; + + # Deal with string types + if ($expected eq "DOMString") { + return $func."_domstring"; + } else { + if ($expected =~ /^\"/ or $self->{"var"}->{$expected} eq "char *") { + return $func."_string"; + } + } + + if (exists $override_suffix{$vn}) { + $func = $func."_".$override_suffix{$vn} + } + return $func; +} + +sub param_unref { + my ($self, $var) = @_; + + my $type = $self->{'var'}->{$var}; + if (not exists $no_unref{$type}) { + my $prefix = "dom_node"; + if (exists $unref_prefix{$type}) { + $prefix = $unref_prefix{$type}; + } + print "if ($var != NULL) {"; + print $prefix."_unref(".$var.");\n"; + print "$var = NULL;"; + print "}"; + } + + foreach my $item (@{$self->{unref}}) { + $item =~ m/.*\((.*)\).*/; + if ($var eq $1) { + return 1; + } + } + + foreach my $item (@{$self->{string_unref}}) { + if ($var eq $item) { + return 1; + } + } + + return 0; +} + +sub generate_domstring_interface { + my ($self, $en, $a) = @_; + + switch ($en) { + case "length" { + print "$a->{'var'} = dom_string_length($a->{'obj'});"; + } + + else { + die "Can't generate method/attribute $en for DOMString"; + } + } +} + +1; diff --git a/test/INDEX b/test/INDEX deleted file mode 100644 index a1b7297..0000000 --- a/test/INDEX +++ /dev/null @@ -1,4 +0,0 @@ -# Index for libdom testcases -# -# Test Description DataDir - diff --git a/test/Makefile b/test/Makefile index 3d50686..2d20d02 100644 --- a/test/Makefile +++ b/test/Makefile @@ -1,18 +1,17 @@ -testlib_files := lib/comparators.c;lib/list.c;lib/testassert.c -testlib_files := $(testlib_files);lib/testobject.c;lib/utils.c +testutils_files := testutils/comparators.c;testutils/list.c;testutils/domasserts.c +testutils_files := $(testutils_files);testutils/utils.c;testutils/foreach.c;testutils/load.c -TESTCFLAGS := $(TESTCFLAGS) -I$(CURDIR) -I$(CURDIR)/$(DIR) +TESTCFLAGS := $(TESTCFLAGS) -I$(CURDIR) -I$(CURDIR)/testutils -DIR_TEST_ITEMS := binding:binding.c;$(testlib_files) \ - test-list:test-list.c;$(testlib_files) +DIR_TEST_ITEMS := $(testutils_files) define add_xml_test ifeq ($$(WANT_TEST),yes) - $(DIR)xml/c/$1.c: $(DIR)xml/tests/$1.xml + $(DIR)xml/c/$1.c: $(DIR)xml/tests/$1.xml $$(Q)$$(XSLTPROC) $$(XSLTPROCFLAGS) -o $$@ \ $(DIR)transform/test-to-c.xsl $$< - DIR_TEST_ITEMS := $$(DIR_TEST_ITEMS) $1:xml/c/$1.c;$$(testlib_files) + DIR_TEST_ITEMS := $$(DIR_TEST_ITEMS) $1:xml/c/$1.c;$$(testlib_files) endif DISTCLEAN_ITEMS := $$(DISTCLEAN_ITEMS) $(DIR)xml/c/$1.c diff --git a/test/binding.c b/test/binding.c deleted file mode 100644 index e7d824f..0000000 --- a/test/binding.c +++ /dev/null @@ -1,35 +0,0 @@ -#include - -#include -#include "testutils.h" - -int main(int argc, char **argv) -{ - struct dom_document *doc; - struct dom_element *element; - struct dom_string *elementName; - dom_exception err; - TestObject *staff; - TestObject *html; - - staff = test_object_create(argc, argv, "staff.xml", false); - assert(staff != NULL); - - html = test_object_create(argc, argv, "sample.html", false); - assert(html != NULL); - - doc = test_object_get_doc(staff); - assert(doc != NULL); - - err = dom_document_get_document_element(doc, &element); - assert(err == DOM_NO_ERR); - assert(element != NULL); - - err = dom_element_get_tag_name(element, &elementName); - assert(err == DOM_NO_ERR); - assert(elementName != NULL); - - printf("PASS\n"); - - return 0; -} diff --git a/test/build-test.sh b/test/build-test.sh new file mode 100755 index 0000000..a353298 --- /dev/null +++ b/test/build-test.sh @@ -0,0 +1,31 @@ +#!/bin/bash +# +# This is a simple script to recompile a C test file. +# Usage: +# This script is designed to run under test output directory. +# +# You should firstly run "run-test.sh", which will genrate a test output directory. In that +# directory, there are C source files and corresponding executables. +# +# ../../../build-test.sh some-test-converted-c-file.c +# +# This file is part of libdom test suite. +# Licensed under the MIT License, +# http://www.opensource.org/licenses/mit-license.php +# Copyright 2009 Bo Yang + +src="testutils/comparators.c testutils/domtsasserts.c testutils/foreach.c testutils/list.c testutils/load.c testutils/utils.c testutils/domtscondition.c" +domdir="../build-Linux-Linux-debug-lib-static" +ldflags="-L$domdir -ldom -L/usr/local/lib -lwapcaplet -L/usr/lib -lxml2 -lhubbub -lparserutils" +#ldflags="-L/usr/lib -lm -lz -L$domdir -ldom -L/usr/local/lib -lwapcaplet -lxml2 -lhubbub -lparserutils" +cflags="-Itestutils/ -I../bindings/xml -I../include -I../bindings/hubbub -I/usr/local/include" + +sf="$1"; +echo $sf; +cwd=$(pwd); +cd ../../../ +exe=${sf%%.c}; +cfile="$cwd"/"$sf"; +gcc -g $cflags $src $cfile $ldflags -o $exe; +mv $exe $cwd; +cd $cwd; diff --git a/test/data/Aliases b/test/data/Aliases new file mode 100644 index 0000000..8978ede --- /dev/null +++ b/test/data/Aliases @@ -0,0 +1,303 @@ +# > Unicode:Files.Aliases +# Mapping of character set encoding names to their canonical form +# +# Lines starting with a '#' are comments, blank lines are ignored. +# +# Based on http://www.iana.org/assignments/character-sets and +# http://www.iana.org/assignments/ianacharset-mib +# +# Canonical Form MIBenum Aliases... +# +US-ASCII 3 iso-ir-6 ANSI_X3.4-1986 ISO_646.irv:1991 ASCII ISO646-US ANSI_X3.4-1968 us IBM367 cp367 csASCII +ISO-10646-UTF-1 27 csISO10646UTF1 +ISO_646.basic:1983 28 ref csISO646basic1983 +INVARIANT 29 csINVARIANT +ISO_646.irv:1983 30 iso-ir-2 irv csISO2IntlRefVersion +BS_4730 20 iso-ir-4 ISO646-GB gb uk csISO4UnitedKingdom +NATS-SEFI 31 iso-ir-8-1 csNATSSEFI +NATS-SEFI-ADD 32 iso-ir-8-2 csNATSSEFIADD +NATS-DANO 33 iso-ir-9-1 csNATSDANO +NATS-DANO-ADD 34 iso-ir-9-2 csNATSDANOADD +SEN_850200_B 35 iso-ir-10 FI ISO646-FI ISO646-SE se csISO10Swedish +SEN_850200_C 21 iso-ir-11 ISO646-SE2 se2 csISO11SwedishForNames +KS_C_5601-1987 36 iso-ir-149 KS_C_5601-1989 KSC_5601 korean csKSC56011987 +ISO-2022-KR 37 csISO2022KR +EUC-KR 38 csEUCKR EUCKR +ISO-2022-JP 39 csISO2022JP +ISO-2022-JP-2 40 csISO2022JP2 +ISO-2022-CN 104 +ISO-2022-CN-EXT 105 +JIS_C6220-1969-jp 41 JIS_C6220-1969 iso-ir-13 katakana x0201-7 csISO13JISC6220jp +JIS_C6220-1969-ro 42 iso-ir-14 jp ISO646-JP csISO14JISC6220ro +IT 22 iso-ir-15 ISO646-IT csISO15Italian +PT 43 iso-ir-16 ISO646-PT csISO16Portuguese +ES 23 iso-ir-17 ISO646-ES csISO17Spanish +greek7-old 44 iso-ir-18 csISO18Greek7Old +latin-greek 45 iso-ir-19 csISO19LatinGreek +DIN_66003 24 iso-ir-21 de ISO646-DE csISO21German +NF_Z_62-010_(1973) 46 iso-ir-25 ISO646-FR1 csISO25French +Latin-greek-1 47 iso-ir-27 csISO27LatinGreek1 +ISO_5427 48 iso-ir-37 csISO5427Cyrillic +JIS_C6226-1978 49 iso-ir-42 csISO42JISC62261978 +BS_viewdata 50 iso-ir-47 csISO47BSViewdata +INIS 51 iso-ir-49 csISO49INIS +INIS-8 52 iso-ir-50 csISO50INIS8 +INIS-cyrillic 53 iso-ir-51 csISO51INISCyrillic +ISO_5427:1981 54 iso-ir-54 ISO5427Cyrillic1981 +ISO_5428:1980 55 iso-ir-55 csISO5428Greek +GB_1988-80 56 iso-ir-57 cn ISO646-CN csISO57GB1988 +GB_2312-80 57 iso-ir-58 chinese csISO58GB231280 +NS_4551-1 25 iso-ir-60 ISO646-NO no csISO60DanishNorwegian csISO60Norwegian1 +NS_4551-2 58 ISO646-NO2 iso-ir-61 no2 csISO61Norwegian2 +NF_Z_62-010 26 iso-ir-69 ISO646-FR fr csISO69French +videotex-suppl 59 iso-ir-70 csISO70VideotexSupp1 +PT2 60 iso-ir-84 ISO646-PT2 csISO84Portuguese2 +ES2 61 iso-ir-85 ISO646-ES2 csISO85Spanish2 +MSZ_7795.3 62 iso-ir-86 ISO646-HU hu csISO86Hungarian +JIS_C6226-1983 63 iso-ir-87 x0208 JIS_X0208-1983 csISO87JISX0208 +greek7 64 iso-ir-88 csISO88Greek7 +ASMO_449 65 ISO_9036 arabic7 iso-ir-89 csISO89ASMO449 +iso-ir-90 66 csISO90 +JIS_C6229-1984-a 67 iso-ir-91 jp-ocr-a csISO91JISC62291984a +JIS_C6229-1984-b 68 iso-ir-92 ISO646-JP-OCR-B jp-ocr-b csISO92JISC62991984b +JIS_C6229-1984-b-add 69 iso-ir-93 jp-ocr-b-add csISO93JIS62291984badd +JIS_C6229-1984-hand 70 iso-ir-94 jp-ocr-hand csISO94JIS62291984hand +JIS_C6229-1984-hand-add 71 iso-ir-95 jp-ocr-hand-add csISO95JIS62291984handadd +JIS_C6229-1984-kana 72 iso-ir-96 csISO96JISC62291984kana +ISO_2033-1983 73 iso-ir-98 e13b csISO2033 +ANSI_X3.110-1983 74 iso-ir-99 CSA_T500-1983 NAPLPS csISO99NAPLPS +ISO-8859-1 4 iso-ir-100 ISO_8859-1 ISO_8859-1:1987 latin1 l1 IBM819 CP819 csISOLatin1 8859_1 ISO8859-1 +ISO-8859-2 5 iso-ir-101 ISO_8859-2 ISO_8859-2:1987 latin2 l2 csISOLatin2 8859_2 ISO8859-2 +T.61-7bit 75 iso-ir-102 csISO102T617bit +T.61-8bit 76 T.61 iso-ir-103 csISO103T618bit +ISO-8859-3 6 iso-ir-109 ISO_8859-3 ISO_8859-3:1988 latin3 l3 csISOLatin3 8859_3 ISO8859-3 +ISO-8859-4 7 iso-ir-110 ISO_8859-4 ISO_8859-4:1988 latin4 l4 csISOLatin4 8859_4 ISO8859-4 +ECMA-cyrillic 77 iso-ir-111 KOI8-E csISO111ECMACyrillic +CSA_Z243.4-1985-1 78 iso-ir-121 ISO646-CA csa7-1 ca csISO121Canadian1 +CSA_Z243.4-1985-2 79 iso-ir-122 ISO646-CA2 csa7-2 csISO122Canadian2 +CSA_Z243.4-1985-gr 80 iso-ir-123 csISO123CSAZ24341985gr +ISO-8859-6 9 iso-ir-127 ISO_8859-6 ISO_8859-6:1987 ECMA-114 ASMO-708 arabic csISOLatinArabic +ISO-8859-6-E 81 csISO88596E ISO_8859-6-E +ISO-8859-6-I 82 csISO88596I ISO_8859-6-I +ISO-8859-7 10 iso-ir-126 ISO_8859-7 ISO_8859-7:1987 ELOT_928 ECMA-118 greek greek8 csISOLatinGreek 8859_7 ISO8859-7 +T.101-G2 83 iso-ir-128 csISO128T101G2 +ISO-8859-8 11 iso-ir-138 ISO_8859-8 ISO_8859-8:1988 hebrew csISOLatinHebrew 8859_8 ISO8859-8 +ISO-8859-8-E 84 csISO88598E ISO_8859-8-E +ISO-8859-8-I 85 csISO88598I ISO_8859-8-I +CSN_369103 86 iso-ir-139 csISO139CSN369103 +JUS_I.B1.002 87 iso-ir-141 ISO646-YU js yu csISO141JUSIB1002 +ISO_6937-2-add 14 iso-ir-142 csISOTextComm +IEC_P27-1 88 iso-ir-143 csISO143IECP271 +ISO-8859-5 8 iso-ir-144 ISO_8859-5 ISO_8859-5:1988 cyrillic csISOLatinCyrillic 8859_5 ISO8859-5 +JUS_I.B1.003-serb 89 iso-ir-146 serbian csISO146Serbian +JUS_I.B1.003-mac 90 macedonian iso-ir-147 csISO147Macedonian +ISO-8859-9 12 iso-ir-148 ISO_8859-9 ISO_8859-9:1989 latin5 l5 csISOLatin5 8859_9 ISO8859-9 +greek-ccitt 91 iso-ir-150 csISO150 csISO150GreekCCITT +NC_NC00-10:81 92 cuba iso-ir-151 ISO646-CU csISO151Cuba +ISO_6937-2-25 93 iso-ir-152 csISO6937Add +GOST_19768-74 94 ST_SEV_358-88 iso-ir-153 csISO153GOST1976874 +ISO_8859-supp 95 iso-ir-154 latin1-2-5 csISO8859Supp +ISO_10367-box 96 iso-ir-155 csISO10367Box +ISO-8859-10 13 iso-ir-157 l6 ISO_8859-10:1992 csISOLatin6 latin6 8859_10 ISO8859-10 +latin-lap 97 lap iso-ir-158 csISO158Lap +JIS_X0212-1990 98 x0212 iso-ir-159 csISO159JISX02121990 +DS_2089 99 DS2089 ISO646-DK dk csISO646Danish +us-dk 100 csUSDK +dk-us 101 csDKUS +JIS_X0201 15 X0201 csHalfWidthKatakana +KSC5636 102 ISO646-KR csKSC5636 +ISO-10646-UCS-2 1000 csUnicode UCS-2 UCS2 +ISO-10646-UCS-4 1001 csUCS4 UCS-4 UCS4 +DEC-MCS 2008 dec csDECMCS +hp-roman8 2004 roman8 r8 csHPRoman8 +macintosh 2027 mac csMacintosh MACROMAN MAC-ROMAN X-MAC-ROMAN +IBM037 2028 cp037 ebcdic-cp-us ebcdic-cp-ca ebcdic-cp-wt ebcdic-cp-nl csIBM037 +IBM038 2029 EBCDIC-INT cp038 csIBM038 +IBM273 2030 CP273 csIBM273 +IBM274 2031 EBCDIC-BE CP274 csIBM274 +IBM275 2032 EBCDIC-BR cp275 csIBM275 +IBM277 2033 EBCDIC-CP-DK EBCDIC-CP-NO csIBM277 +IBM278 2034 CP278 ebcdic-cp-fi ebcdic-cp-se csIBM278 +IBM280 2035 CP280 ebcdic-cp-it csIBM280 +IBM281 2036 EBCDIC-JP-E cp281 csIBM281 +IBM284 2037 CP284 ebcdic-cp-es csIBM284 +IBM285 2038 CP285 ebcdic-cp-gb csIBM285 +IBM290 2039 cp290 EBCDIC-JP-kana csIBM290 +IBM297 2040 cp297 ebcdic-cp-fr csIBM297 +IBM420 2041 cp420 ebcdic-cp-ar1 csIBM420 +IBM423 2042 cp423 ebcdic-cp-gr csIBM423 +IBM424 2043 cp424 ebcdic-cp-he csIBM424 +IBM437 2011 cp437 437 csPC8CodePage437 +IBM500 2044 CP500 ebcdic-cp-be ebcdic-cp-ch csIBM500 +IBM775 2087 cp775 csPC775Baltic +IBM850 2009 cp850 850 csPC850Multilingual +IBM851 2045 cp851 851 csIBM851 +IBM852 2010 cp852 852 csPCp852 +IBM855 2046 cp855 855 csIBM855 +IBM857 2047 cp857 857 csIBM857 +IBM860 2048 cp860 860 csIBM860 +IBM861 2049 cp861 861 cp-is csIBM861 +IBM862 2013 cp862 862 csPC862LatinHebrew +IBM863 2050 cp863 863 csIBM863 +IBM864 2051 cp864 csIBM864 +IBM865 2052 cp865 865 csIBM865 +IBM866 2086 cp866 866 csIBM866 +IBM868 2053 CP868 cp-ar csIBM868 +IBM869 2054 cp869 869 cp-gr csIBM869 +IBM870 2055 CP870 ebcdic-cp-roece ebcdic-cp-yu csIBM870 +IBM871 2056 CP871 ebcdic-cp-is csIBM871 +IBM880 2057 cp880 EBCDIC-Cyrillic csIBM880 +IBM891 2058 cp891 csIBM891 +IBM903 2059 cp903 csIBM903 +IBM904 2060 cp904 904 csIBBM904 +IBM905 2061 CP905 ebcdic-cp-tr csIBM905 +IBM918 2062 CP918 ebcdic-cp-ar2 csIBM918 +IBM1026 2063 CP1026 csIBM1026 +EBCDIC-AT-DE 2064 csIBMEBCDICATDE +EBCDIC-AT-DE-A 2065 csEBCDICATDEA +EBCDIC-CA-FR 2066 csEBCDICCAFR +EBCDIC-DK-NO 2067 csEBCDICDKNO +EBCDIC-DK-NO-A 2068 csEBCDICDKNOA +EBCDIC-FI-SE 2069 csEBCDICFISE +EBCDIC-FI-SE-A 2070 csEBCDICFISEA +EBCDIC-FR 2071 csEBCDICFR +EBCDIC-IT 2072 csEBCDICIT +EBCDIC-PT 2073 csEBCDICPT +EBCDIC-ES 2074 csEBCDICES +EBCDIC-ES-A 2075 csEBCDICESA +EBCDIC-ES-S 2076 csEBCDICESS +EBCDIC-UK 2077 csEBCDICUK +EBCDIC-US 2078 csEBCDICUS +UNKNOWN-8BIT 2079 csUnknown8BiT +MNEMONIC 2080 csMnemonic +MNEM 2081 csMnem +VISCII 2082 csVISCII +VIQR 2083 csVIQR +KOI8-R 2084 csKOI8R +KOI8-U 2088 +IBM00858 2089 CCSID00858 CP00858 PC-Multilingual-850+euro +IBM00924 2090 CCSID00924 CP00924 ebcdic-Latin9--euro +IBM01140 2091 CCSID01140 CP01140 ebcdic-us-37+euro +IBM01141 2092 CCSID01141 CP01141 ebcdic-de-273+euro +IBM01142 2093 CCSID01142 CP01142 ebcdic-dk-277+euro ebcdic-no-277+euro +IBM01143 2094 CCSID01143 CP01143 ebcdic-fi-278+euro ebcdic-se-278+euro +IBM01144 2095 CCSID01144 CP01144 ebcdic-it-280+euro +IBM01145 2096 CCSID01145 CP01145 ebcdic-es-284+euro +IBM01146 2097 CCSID01146 CP01146 ebcdic-gb-285+euro +IBM01147 2098 CCSID01147 CP01147 ebcdic-fr-297+euro +IBM01148 2099 CCSID01148 CP01148 ebcdic-international-500+euro +IBM01149 2100 CCSID01149 CP01149 ebcdic-is-871+euro +Big5-HKSCS 2101 +IBM1047 2102 IBM-1047 +PTCP154 2103 csPTCP154 PT154 CP154 Cyrillic-Asian +Amiga-1251 2104 Ami1251 Amiga1251 Ami-1251 +KOI7-switched 2105 +UNICODE-1-1 1010 csUnicode11 +SCSU 1011 +UTF-7 1012 +UTF-16BE 1013 +UTF-16LE 1014 +UTF-16 1015 +CESU-8 1016 csCESU-8 +UTF-32 1017 +UTF-32BE 1018 +UTF-32LE 1019 +BOCU-1 1020 csBOCU-1 +UNICODE-1-1-UTF-7 103 csUnicode11UTF7 +UTF-8 106 UNICODE-1-1-UTF-8 UNICODE-2-0-UTF-8 utf8 +ISO-8859-13 109 8859_13 ISO8859-13 +ISO-8859-14 110 iso-ir-199 ISO_8859-14:1998 ISO_8859-14 latin8 iso-celtic l8 8859_14 ISO8859-14 +ISO-8859-15 111 ISO_8859-15 Latin-9 8859_15 ISO8859-15 +ISO-8859-16 112 iso-ir-226 ISO_8859-16:2001 ISO_8859-16 latin10 l10 +GBK 113 CP936 MS936 windows-936 +GB18030 114 +OSD_EBCDIC_DF04_15 115 +OSD_EBCDIC_DF03_IRV 116 +OSD_EBCDIC_DF04_1 117 +JIS_Encoding 16 csJISEncoding +Shift_JIS 17 MS_Kanji csShiftJIS X-SJIS Shift-JIS +EUC-JP 18 csEUCPkdFmtJapanese Extended_UNIX_Code_Packed_Format_for_Japanese EUCJP +Extended_UNIX_Code_Fixed_Width_for_Japanese 19 csEUCFixWidJapanese +ISO-10646-UCS-Basic 1002 csUnicodeASCII +ISO-10646-Unicode-Latin1 1003 csUnicodeLatin1 ISO-10646 +ISO-Unicode-IBM-1261 1005 csUnicodeIBM1261 +ISO-Unicode-IBM-1268 1006 csUnicodeIBM1268 +ISO-Unicode-IBM-1276 1007 csUnicodeIBM1276 +ISO-Unicode-IBM-1264 1008 csUnicodeIBM1264 +ISO-Unicode-IBM-1265 1009 csUnicodeIBM1265 +ISO-8859-1-Windows-3.0-Latin-1 2000 csWindows30Latin1 +ISO-8859-1-Windows-3.1-Latin-1 2001 csWindows31Latin1 +ISO-8859-2-Windows-Latin-2 2002 csWindows31Latin2 +ISO-8859-9-Windows-Latin-5 2003 csWindows31Latin5 +Adobe-Standard-Encoding 2005 csAdobeStandardEncoding +Ventura-US 2006 csVenturaUS +Ventura-International 2007 csVenturaInternational +PC8-Danish-Norwegian 2012 csPC8DanishNorwegian +PC8-Turkish 2014 csPC8Turkish +IBM-Symbols 2015 csIBMSymbols +IBM-Thai 2016 csIBMThai +HP-Legal 2017 csHPLegal +HP-Pi-font 2018 csHPPiFont +HP-Math8 2019 csHPMath8 +Adobe-Symbol-Encoding 2020 csHPPSMath +HP-DeskTop 2021 csHPDesktop +Ventura-Math 2022 csVenturaMath +Microsoft-Publishing 2023 csMicrosoftPublishing +Windows-31J 2024 csWindows31J +GB2312 2025 csGB2312 EUC-CN EUCCN CN-GB +Big5 2026 csBig5 BIG-FIVE BIG-5 CN-BIG5 BIG_FIVE x-x-big5 +windows-1250 2250 CP1250 MS-EE +windows-1251 2251 CP1251 MS-CYRL +windows-1252 2252 CP1252 MS-ANSI +windows-1253 2253 CP1253 MS-GREEK +windows-1254 2254 CP1254 MS-TURK +windows-1255 2255 +windows-1256 2256 CP1256 MS-ARAB +windows-1257 2257 CP1257 WINBALTRIM +windows-1258 2258 +TIS-620 2259 +HZ-GB-2312 2085 + +# Additional encodings not defined by IANA + +# Arbitrary allocations +#CP737 3001 +#CP853 3002 +#CP856 3003 +CP874 3004 WINDOWS-874 +#CP922 3005 +#CP1046 3006 +#CP1124 3007 +#CP1125 3008 WINDOWS-1125 +#CP1129 3009 +#CP1133 3010 IBM-CP1133 +#CP1161 3011 IBM-1161 IBM1161 CSIBM1161 +#CP1162 3012 IBM-1162 IBM1162 CSIBM1162 +#CP1163 3013 IBM-1163 IBM1163 CSIBM1163 +#GEORGIAN-ACADEMY 3014 +#GEORGIAN-PS 3015 +#KOI8-RU 3016 +#KOI8-T 3017 +#MACARABIC 3018 X-MAC-ARABIC MAC-ARABIC +#MACCROATIAN 3019 X-MAC-CROATIAN MAC-CROATIAN +#MACGREEK 3020 X-MAC-GREEK MAC-GREEK +#MACHEBREW 3021 X-MAC-HEBREW MAC-HEBREW +#MACICELAND 3022 X-MAC-ICELAND MAC-ICELAND +#MACROMANIA 3023 X-MAC-ROMANIA MAC-ROMANIA +#MACTHAI 3024 X-MAC-THAI MAC-THAI +#MACTURKISH 3025 X-MAC-TURKISH MAC-TURKISH +#MULELAO-1 3026 +CP949 3027 WINDOWS-949 + +# From Unicode Lib +ISO-IR-182 4000 +ISO-IR-197 4002 +ISO-2022-JP-1 4008 +MACCYRILLIC 4009 X-MAC-CYRILLIC MAC-CYRILLIC +MACUKRAINE 4010 X-MAC-UKRAINIAN MAC-UKRAINIAN +MACCENTRALEUROPE 4011 X-MAC-CENTRALEURROMAN MAC-CENTRALEURROMAN +JOHAB 4012 +ISO-8859-11 4014 iso-ir-166 ISO_8859-11 ISO8859-11 8859_11 +X-CURRENT 4999 X-SYSTEM +X-ACORN-LATIN1 5001 +X-ACORN-FUZZY 5002 diff --git a/test/data/binding/Aliases b/test/data/binding/Aliases deleted file mode 100644 index db61ff1..0000000 --- a/test/data/binding/Aliases +++ /dev/null @@ -1,302 +0,0 @@ -# > Unicode:Files.Aliases -# Mapping of character set encoding names to their canonical form -# -# Lines starting with a '#' are comments, blank lines are ignored. -# -# Based on http://www.iana.org/assignments/character-sets and -# http://www.iana.org/assignments/ianacharset-mib -# -# Canonical Form MIBenum Aliases... -# -US-ASCII 3 iso-ir-6 ANSI_X3.4-1986 ISO_646.irv:1991 ASCII ISO646-US ANSI_X3.4-1968 us IBM367 cp367 csASCII -ISO-10646-UTF-1 27 csISO10646UTF1 -ISO_646.basic:1983 28 ref csISO646basic1983 -INVARIANT 29 csINVARIANT -ISO_646.irv:1983 30 iso-ir-2 irv csISO2IntlRefVersion -BS_4730 20 iso-ir-4 ISO646-GB gb uk csISO4UnitedKingdom -NATS-SEFI 31 iso-ir-8-1 csNATSSEFI -NATS-SEFI-ADD 32 iso-ir-8-2 csNATSSEFIADD -NATS-DANO 33 iso-ir-9-1 csNATSDANO -NATS-DANO-ADD 34 iso-ir-9-2 csNATSDANOADD -SEN_850200_B 35 iso-ir-10 FI ISO646-FI ISO646-SE se csISO10Swedish -SEN_850200_C 21 iso-ir-11 ISO646-SE2 se2 csISO11SwedishForNames -KS_C_5601-1987 36 iso-ir-149 KS_C_5601-1989 KSC_5601 korean csKSC56011987 -ISO-2022-KR 37 csISO2022KR -EUC-KR 38 csEUCKR EUCKR -ISO-2022-JP 39 csISO2022JP -ISO-2022-JP-2 40 csISO2022JP2 -ISO-2022-CN 104 -ISO-2022-CN-EXT 105 -JIS_C6220-1969-jp 41 JIS_C6220-1969 iso-ir-13 katakana x0201-7 csISO13JISC6220jp -JIS_C6220-1969-ro 42 iso-ir-14 jp ISO646-JP csISO14JISC6220ro -IT 22 iso-ir-15 ISO646-IT csISO15Italian -PT 43 iso-ir-16 ISO646-PT csISO16Portuguese -ES 23 iso-ir-17 ISO646-ES csISO17Spanish -greek7-old 44 iso-ir-18 csISO18Greek7Old -latin-greek 45 iso-ir-19 csISO19LatinGreek -DIN_66003 24 iso-ir-21 de ISO646-DE csISO21German -NF_Z_62-010_(1973) 46 iso-ir-25 ISO646-FR1 csISO25French -Latin-greek-1 47 iso-ir-27 csISO27LatinGreek1 -ISO_5427 48 iso-ir-37 csISO5427Cyrillic -JIS_C6226-1978 49 iso-ir-42 csISO42JISC62261978 -BS_viewdata 50 iso-ir-47 csISO47BSViewdata -INIS 51 iso-ir-49 csISO49INIS -INIS-8 52 iso-ir-50 csISO50INIS8 -INIS-cyrillic 53 iso-ir-51 csISO51INISCyrillic -ISO_5427:1981 54 iso-ir-54 ISO5427Cyrillic1981 -ISO_5428:1980 55 iso-ir-55 csISO5428Greek -GB_1988-80 56 iso-ir-57 cn ISO646-CN csISO57GB1988 -GB_2312-80 57 iso-ir-58 chinese csISO58GB231280 -NS_4551-1 25 iso-ir-60 ISO646-NO no csISO60DanishNorwegian csISO60Norwegian1 -NS_4551-2 58 ISO646-NO2 iso-ir-61 no2 csISO61Norwegian2 -NF_Z_62-010 26 iso-ir-69 ISO646-FR fr csISO69French -videotex-suppl 59 iso-ir-70 csISO70VideotexSupp1 -PT2 60 iso-ir-84 ISO646-PT2 csISO84Portuguese2 -ES2 61 iso-ir-85 ISO646-ES2 csISO85Spanish2 -MSZ_7795.3 62 iso-ir-86 ISO646-HU hu csISO86Hungarian -JIS_C6226-1983 63 iso-ir-87 x0208 JIS_X0208-1983 csISO87JISX0208 -greek7 64 iso-ir-88 csISO88Greek7 -ASMO_449 65 ISO_9036 arabic7 iso-ir-89 csISO89ASMO449 -iso-ir-90 66 csISO90 -JIS_C6229-1984-a 67 iso-ir-91 jp-ocr-a csISO91JISC62291984a -JIS_C6229-1984-b 68 iso-ir-92 ISO646-JP-OCR-B jp-ocr-b csISO92JISC62991984b -JIS_C6229-1984-b-add 69 iso-ir-93 jp-ocr-b-add csISO93JIS62291984badd -JIS_C6229-1984-hand 70 iso-ir-94 jp-ocr-hand csISO94JIS62291984hand -JIS_C6229-1984-hand-add 71 iso-ir-95 jp-ocr-hand-add csISO95JIS62291984handadd -JIS_C6229-1984-kana 72 iso-ir-96 csISO96JISC62291984kana -ISO_2033-1983 73 iso-ir-98 e13b csISO2033 -ANSI_X3.110-1983 74 iso-ir-99 CSA_T500-1983 NAPLPS csISO99NAPLPS -ISO-8859-1 4 iso-ir-100 ISO_8859-1 ISO_8859-1:1987 latin1 l1 IBM819 CP819 csISOLatin1 8859_1 ISO8859-1 -ISO-8859-2 5 iso-ir-101 ISO_8859-2 ISO_8859-2:1987 latin2 l2 csISOLatin2 8859_2 ISO8859-2 -T.61-7bit 75 iso-ir-102 csISO102T617bit -T.61-8bit 76 T.61 iso-ir-103 csISO103T618bit -ISO-8859-3 6 iso-ir-109 ISO_8859-3 ISO_8859-3:1988 latin3 l3 csISOLatin3 8859_3 ISO8859-3 -ISO-8859-4 7 iso-ir-110 ISO_8859-4 ISO_8859-4:1988 latin4 l4 csISOLatin4 8859_4 ISO8859-4 -ECMA-cyrillic 77 iso-ir-111 KOI8-E csISO111ECMACyrillic -CSA_Z243.4-1985-1 78 iso-ir-121 ISO646-CA csa7-1 ca csISO121Canadian1 -CSA_Z243.4-1985-2 79 iso-ir-122 ISO646-CA2 csa7-2 csISO122Canadian2 -CSA_Z243.4-1985-gr 80 iso-ir-123 csISO123CSAZ24341985gr -ISO-8859-6 9 iso-ir-127 ISO_8859-6 ISO_8859-6:1987 ECMA-114 ASMO-708 arabic csISOLatinArabic -ISO-8859-6-E 81 csISO88596E ISO_8859-6-E -ISO-8859-6-I 82 csISO88596I ISO_8859-6-I -ISO-8859-7 10 iso-ir-126 ISO_8859-7 ISO_8859-7:1987 ELOT_928 ECMA-118 greek greek8 csISOLatinGreek 8859_7 ISO8859-7 -T.101-G2 83 iso-ir-128 csISO128T101G2 -ISO-8859-8 11 iso-ir-138 ISO_8859-8 ISO_8859-8:1988 hebrew csISOLatinHebrew 8859_8 ISO8859-8 -ISO-8859-8-E 84 csISO88598E ISO_8859-8-E -ISO-8859-8-I 85 csISO88598I ISO_8859-8-I -CSN_369103 86 iso-ir-139 csISO139CSN369103 -JUS_I.B1.002 87 iso-ir-141 ISO646-YU js yu csISO141JUSIB1002 -ISO_6937-2-add 14 iso-ir-142 csISOTextComm -IEC_P27-1 88 iso-ir-143 csISO143IECP271 -ISO-8859-5 8 iso-ir-144 ISO_8859-5 ISO_8859-5:1988 cyrillic csISOLatinCyrillic 8859_5 ISO8859-5 -JUS_I.B1.003-serb 89 iso-ir-146 serbian csISO146Serbian -JUS_I.B1.003-mac 90 macedonian iso-ir-147 csISO147Macedonian -ISO-8859-9 12 iso-ir-148 ISO_8859-9 ISO_8859-9:1989 latin5 l5 csISOLatin5 8859_9 ISO8859-9 -greek-ccitt 91 iso-ir-150 csISO150 csISO150GreekCCITT -NC_NC00-10:81 92 cuba iso-ir-151 ISO646-CU csISO151Cuba -ISO_6937-2-25 93 iso-ir-152 csISO6937Add -GOST_19768-74 94 ST_SEV_358-88 iso-ir-153 csISO153GOST1976874 -ISO_8859-supp 95 iso-ir-154 latin1-2-5 csISO8859Supp -ISO_10367-box 96 iso-ir-155 csISO10367Box -ISO-8859-10 13 iso-ir-157 l6 ISO_8859-10:1992 csISOLatin6 latin6 8859_10 ISO8859-10 -latin-lap 97 lap iso-ir-158 csISO158Lap -JIS_X0212-1990 98 x0212 iso-ir-159 csISO159JISX02121990 -DS_2089 99 DS2089 ISO646-DK dk csISO646Danish -us-dk 100 csUSDK -dk-us 101 csDKUS -JIS_X0201 15 X0201 csHalfWidthKatakana -KSC5636 102 ISO646-KR csKSC5636 -ISO-10646-UCS-2 1000 csUnicode UCS-2 UCS2 -ISO-10646-UCS-4 1001 csUCS4 UCS-4 UCS4 -DEC-MCS 2008 dec csDECMCS -hp-roman8 2004 roman8 r8 csHPRoman8 -macintosh 2027 mac csMacintosh MACROMAN MAC-ROMAN X-MAC-ROMAN -IBM037 2028 cp037 ebcdic-cp-us ebcdic-cp-ca ebcdic-cp-wt ebcdic-cp-nl csIBM037 -IBM038 2029 EBCDIC-INT cp038 csIBM038 -IBM273 2030 CP273 csIBM273 -IBM274 2031 EBCDIC-BE CP274 csIBM274 -IBM275 2032 EBCDIC-BR cp275 csIBM275 -IBM277 2033 EBCDIC-CP-DK EBCDIC-CP-NO csIBM277 -IBM278 2034 CP278 ebcdic-cp-fi ebcdic-cp-se csIBM278 -IBM280 2035 CP280 ebcdic-cp-it csIBM280 -IBM281 2036 EBCDIC-JP-E cp281 csIBM281 -IBM284 2037 CP284 ebcdic-cp-es csIBM284 -IBM285 2038 CP285 ebcdic-cp-gb csIBM285 -IBM290 2039 cp290 EBCDIC-JP-kana csIBM290 -IBM297 2040 cp297 ebcdic-cp-fr csIBM297 -IBM420 2041 cp420 ebcdic-cp-ar1 csIBM420 -IBM423 2042 cp423 ebcdic-cp-gr csIBM423 -IBM424 2043 cp424 ebcdic-cp-he csIBM424 -IBM437 2011 cp437 437 csPC8CodePage437 -IBM500 2044 CP500 ebcdic-cp-be ebcdic-cp-ch csIBM500 -IBM775 2087 cp775 csPC775Baltic -IBM850 2009 cp850 850 csPC850Multilingual -IBM851 2045 cp851 851 csIBM851 -IBM852 2010 cp852 852 csPCp852 -IBM855 2046 cp855 855 csIBM855 -IBM857 2047 cp857 857 csIBM857 -IBM860 2048 cp860 860 csIBM860 -IBM861 2049 cp861 861 cp-is csIBM861 -IBM862 2013 cp862 862 csPC862LatinHebrew -IBM863 2050 cp863 863 csIBM863 -IBM864 2051 cp864 csIBM864 -IBM865 2052 cp865 865 csIBM865 -IBM866 2086 cp866 866 csIBM866 -IBM868 2053 CP868 cp-ar csIBM868 -IBM869 2054 cp869 869 cp-gr csIBM869 -IBM870 2055 CP870 ebcdic-cp-roece ebcdic-cp-yu csIBM870 -IBM871 2056 CP871 ebcdic-cp-is csIBM871 -IBM880 2057 cp880 EBCDIC-Cyrillic csIBM880 -IBM891 2058 cp891 csIBM891 -IBM903 2059 cp903 csIBM903 -IBM904 2060 cp904 904 csIBBM904 -IBM905 2061 CP905 ebcdic-cp-tr csIBM905 -IBM918 2062 CP918 ebcdic-cp-ar2 csIBM918 -IBM1026 2063 CP1026 csIBM1026 -EBCDIC-AT-DE 2064 csIBMEBCDICATDE -EBCDIC-AT-DE-A 2065 csEBCDICATDEA -EBCDIC-CA-FR 2066 csEBCDICCAFR -EBCDIC-DK-NO 2067 csEBCDICDKNO -EBCDIC-DK-NO-A 2068 csEBCDICDKNOA -EBCDIC-FI-SE 2069 csEBCDICFISE -EBCDIC-FI-SE-A 2070 csEBCDICFISEA -EBCDIC-FR 2071 csEBCDICFR -EBCDIC-IT 2072 csEBCDICIT -EBCDIC-PT 2073 csEBCDICPT -EBCDIC-ES 2074 csEBCDICES -EBCDIC-ES-A 2075 csEBCDICESA -EBCDIC-ES-S 2076 csEBCDICESS -EBCDIC-UK 2077 csEBCDICUK -EBCDIC-US 2078 csEBCDICUS -UNKNOWN-8BIT 2079 csUnknown8BiT -MNEMONIC 2080 csMnemonic -MNEM 2081 csMnem -VISCII 2082 csVISCII -VIQR 2083 csVIQR -KOI8-R 2084 csKOI8R -KOI8-U 2088 -IBM00858 2089 CCSID00858 CP00858 PC-Multilingual-850+euro -IBM00924 2090 CCSID00924 CP00924 ebcdic-Latin9--euro -IBM01140 2091 CCSID01140 CP01140 ebcdic-us-37+euro -IBM01141 2092 CCSID01141 CP01141 ebcdic-de-273+euro -IBM01142 2093 CCSID01142 CP01142 ebcdic-dk-277+euro ebcdic-no-277+euro -IBM01143 2094 CCSID01143 CP01143 ebcdic-fi-278+euro ebcdic-se-278+euro -IBM01144 2095 CCSID01144 CP01144 ebcdic-it-280+euro -IBM01145 2096 CCSID01145 CP01145 ebcdic-es-284+euro -IBM01146 2097 CCSID01146 CP01146 ebcdic-gb-285+euro -IBM01147 2098 CCSID01147 CP01147 ebcdic-fr-297+euro -IBM01148 2099 CCSID01148 CP01148 ebcdic-international-500+euro -IBM01149 2100 CCSID01149 CP01149 ebcdic-is-871+euro -Big5-HKSCS 2101 -IBM1047 2102 IBM-1047 -PTCP154 2103 csPTCP154 PT154 CP154 Cyrillic-Asian -Amiga-1251 2104 Ami1251 Amiga1251 Ami-1251 -KOI7-switched 2105 -UNICODE-1-1 1010 csUnicode11 -SCSU 1011 -UTF-7 1012 -UTF-16BE 1013 -UTF-16LE 1014 -UTF-16 1015 -CESU-8 1016 csCESU-8 -UTF-32 1017 -UTF-32BE 1018 -UTF-32LE 1019 -BOCU-1 1020 csBOCU-1 -UNICODE-1-1-UTF-7 103 csUnicode11UTF7 -UTF-8 106 UNICODE-1-1-UTF-8 UNICODE-2-0-UTF-8 utf8 -ISO-8859-13 109 8859_13 ISO8859-13 -ISO-8859-14 110 iso-ir-199 ISO_8859-14:1998 ISO_8859-14 latin8 iso-celtic l8 8859_14 ISO8859-14 -ISO-8859-15 111 ISO_8859-15 Latin-9 8859_15 ISO8859-15 -ISO-8859-16 112 iso-ir-226 ISO_8859-16:2001 ISO_8859-16 latin10 l10 -GBK 113 CP936 MS936 windows-936 -GB18030 114 -OSD_EBCDIC_DF04_15 115 -OSD_EBCDIC_DF03_IRV 116 -OSD_EBCDIC_DF04_1 117 -JIS_Encoding 16 csJISEncoding -Shift_JIS 17 MS_Kanji csShiftJIS X-SJIS Shift-JIS -EUC-JP 18 csEUCPkdFmtJapanese Extended_UNIX_Code_Packed_Format_for_Japanese EUCJP -Extended_UNIX_Code_Fixed_Width_for_Japanese 19 csEUCFixWidJapanese -ISO-10646-UCS-Basic 1002 csUnicodeASCII -ISO-10646-Unicode-Latin1 1003 csUnicodeLatin1 ISO-10646 -ISO-Unicode-IBM-1261 1005 csUnicodeIBM1261 -ISO-Unicode-IBM-1268 1006 csUnicodeIBM1268 -ISO-Unicode-IBM-1276 1007 csUnicodeIBM1276 -ISO-Unicode-IBM-1264 1008 csUnicodeIBM1264 -ISO-Unicode-IBM-1265 1009 csUnicodeIBM1265 -ISO-8859-1-Windows-3.0-Latin-1 2000 csWindows30Latin1 -ISO-8859-1-Windows-3.1-Latin-1 2001 csWindows31Latin1 -ISO-8859-2-Windows-Latin-2 2002 csWindows31Latin2 -ISO-8859-9-Windows-Latin-5 2003 csWindows31Latin5 -Adobe-Standard-Encoding 2005 csAdobeStandardEncoding -Ventura-US 2006 csVenturaUS -Ventura-International 2007 csVenturaInternational -PC8-Danish-Norwegian 2012 csPC8DanishNorwegian -PC8-Turkish 2014 csPC8Turkish -IBM-Symbols 2015 csIBMSymbols -IBM-Thai 2016 csIBMThai -HP-Legal 2017 csHPLegal -HP-Pi-font 2018 csHPPiFont -HP-Math8 2019 csHPMath8 -Adobe-Symbol-Encoding 2020 csHPPSMath -HP-DeskTop 2021 csHPDesktop -Ventura-Math 2022 csVenturaMath -Microsoft-Publishing 2023 csMicrosoftPublishing -Windows-31J 2024 csWindows31J -GB2312 2025 csGB2312 EUC-CN EUCCN CN-GB -Big5 2026 csBig5 BIG-FIVE BIG-5 CN-BIG5 BIG_FIVE -windows-1250 2250 CP1250 MS-EE -windows-1251 2251 CP1251 MS-CYRL -windows-1252 2252 CP1252 MS-ANSI -windows-1253 2253 CP1253 MS-GREEK -windows-1254 2254 CP1254 MS-TURK -windows-1255 2255 -windows-1256 2256 CP1256 MS-ARAB -windows-1257 2257 CP1257 WINBALTRIM -windows-1258 2258 -TIS-620 2259 -HZ-GB-2312 2085 - -# Additional encodings not defined by IANA - -# Arbitrary allocations -#CP737 3001 -#CP853 3002 -#CP856 3003 -CP874 3004 WINDOWS-874 -#CP922 3005 -#CP1046 3006 -#CP1124 3007 -#CP1125 3008 WINDOWS-1125 -#CP1129 3009 -#CP1133 3010 IBM-CP1133 -#CP1161 3011 IBM-1161 IBM1161 CSIBM1161 -#CP1162 3012 IBM-1162 IBM1162 CSIBM1162 -#CP1163 3013 IBM-1163 IBM1163 CSIBM1163 -#GEORGIAN-ACADEMY 3014 -#GEORGIAN-PS 3015 -#KOI8-RU 3016 -#KOI8-T 3017 -#MACARABIC 3018 X-MAC-ARABIC MAC-ARABIC -#MACCROATIAN 3019 X-MAC-CROATIAN MAC-CROATIAN -#MACGREEK 3020 X-MAC-GREEK MAC-GREEK -#MACHEBREW 3021 X-MAC-HEBREW MAC-HEBREW -#MACICELAND 3022 X-MAC-ICELAND MAC-ICELAND -#MACROMANIA 3023 X-MAC-ROMANIA MAC-ROMANIA -#MACTHAI 3024 X-MAC-THAI MAC-THAI -#MACTURKISH 3025 X-MAC-TURKISH MAC-TURKISH -#MULELAO-1 3026 - -# From Unicode Lib -ISO-IR-182 4000 -ISO-IR-197 4002 -ISO-2022-JP-1 4008 -MACCYRILLIC 4009 X-MAC-CYRILLIC MAC-CYRILLIC -MACUKRAINE 4010 X-MAC-UKRAINIAN MAC-UKRAINIAN -MACCENTRALEUROPE 4011 X-MAC-CENTRALEURROMAN MAC-CENTRALEURROMAN -JOHAB 4012 -ISO-8859-11 4014 iso-ir-166 ISO_8859-11 ISO8859-11 8859_11 -X-CURRENT 4999 X-SYSTEM -X-ACORN-LATIN1 5001 -X-ACORN-FUZZY 5002 diff --git a/test/data/binding/sample.html b/test/data/binding/sample.html deleted file mode 100644 index a090978..0000000 --- a/test/data/binding/sample.html +++ /dev/null @@ -1,11 +0,0 @@ - - - - -This is a title - - -

Here is some text with mismatched bold and italic tags. Here's some more text.

- - - diff --git a/test/data/binding/staff.xml b/test/data/binding/staff.xml deleted file mode 100644 index f89c510..0000000 --- a/test/data/binding/staff.xml +++ /dev/null @@ -1,57 +0,0 @@ - - - - - Element data"> - - - - -]> - - - - EMP0001 - Margaret Martin - Accountant - 56,000 - Female -
1230 North Ave. Dallas, Texas 98551
-
- - EMP0002 - Martha Raynolds - - Secretary - 35,000 - Female -
&ent2; Dallas, &ent3; - 98554
-
- - EMP0003 - Roger - Jones - Department Manager - 100,000 - &ent4; -
PO Box 27 Irving, texas 98553
-
- - EMP0004 - Jeny Oconnor - Personnel Director - 95,000 - Female -
27 South Road. Dallas, Texas 98556
-
- - EMP0005 - Robert Myers - Computer Specialist - 90,000 - male -
1821 Nordic. Road, Irving Texas 98558
-
-
diff --git a/test/dom1-interfaces.xml b/test/dom1-interfaces.xml new file mode 100644 index 0000000..0c2488e --- /dev/null +++ b/test/dom1-interfaces.xml @@ -0,0 +1,3665 @@ + + + + + + +

DOM operations only raise exceptions in "exceptional" circumstances, i.e., when an operation is impossible to perform (either for logical reasons, because data is lost, or because the implementation has become unstable). In general, DOM methods return specific error values in ordinary processing situation, such as out-of-bound errors when usingNodeList.

+

Implementations may raise other exceptions under other circumstances. For example, implementations may raise an implementation-dependent exception if anullargument is passed.

+

Some languages and object systems do not support the concept of exceptions. For such systems, error conditions may be indicated using native error reporting mechanisms. For some bindings, for example, methods may return error codes similar to those listed in the corresponding method descriptions.

+
+ +unsigned short + +
+ + +

An integer indicating the type of error generated.

+
+ + +

If index or size is negative, or greater than the allowed value

+
+
+ + +

If the specified range of text does not fit into a DOMString

+
+
+ + +

If any node is inserted somewhere it doesn't belong

+
+
+ + +

If a node is used in a different document than the one that created it (that doesn't support it)

+
+
+ + +

If an invalid character is specified, such as in a name.

+
+
+ + +

If data is specified for a node which does not support data

+
+
+ + +

If an attempt is made to modify an object where modifications are not allowed

+
+
+ + +

If an attempt was made to reference a node in a context where it does not exist

+
+
+ + +

If the implementation does not support the type of object requested

+
+
+ + +

If an attempt is made to add an attribute that is already inuse elsewhere

+
+
+
+ + +

TheDOMImplementationinterface provides a number of methods for performing operations that are independent of any particular instance of the document object model.

+

The DOM Level 1 does not specify a way of creating a document instance, and hence document creation is an operation specific to an implementation. Future Levels of the DOM specification are expected to provide methods for creating documents directly.

+
+ + +

Test if the DOM implementation implements a specific feature.

+
+ + + +

The package name of the feature to test. In Level 1, the legal values are "HTML" and "XML" (case-insensitive).

+
+ + + +

This is the version number of the package name to test. In Level 1, this is the string "1.0". If the version is not specified, supporting any version of the feature will cause the method to returntrue.

+
+ +
+ + +

+trueif the feature is implemented in the specified version,falseotherwise.

+
+
+ +
+
+ + +

+DocumentFragmentis a "lightweight" or "minimal"Documentobject. It is very common to want to be able to extract a portion of a document's tree or to create a new fragment of a document. Imagine implementing a user command like cut or rearranging a document by moving fragments around. It is desirable to have an object which can hold such fragments and it is quite natural to use a Node for this purpose. While it is true that aDocumentobject could fulfil this role, aDocumentobject can potentially be a heavyweight object, depending on the underlying implementation. What is really needed for this is a very lightweight object.DocumentFragmentis such an object.

+

Furthermore, various operations -- such as inserting nodes as children of anotherNode-- may takeDocumentFragmentobjects as arguments; this results in all the child nodes of theDocumentFragmentbeing moved to the child list of this node.

+

The children of aDocumentFragmentnode are zero or more nodes representing the tops of any sub-trees defining the structure of the document.DocumentFragmentnodes do not need to be well-formed XML documents (although they do need to follow the rules imposed upon well-formed XML parsed entities, which can have multiple top nodes). For example, aDocumentFragmentmight have only one child and that child node could be aTextnode. Such a structure model represents neither an HTML document nor a well-formed XML document.

+

When aDocumentFragmentis inserted into aDocument(or indeed any otherNodethat may take children) the children of theDocumentFragmentand not theDocumentFragmentitself are inserted into theNode. This makes theDocumentFragmentvery useful when the user wishes to create nodes that are siblings; theDocumentFragmentacts as the parent of these nodes so that the user can use the standard methods from theNodeinterface, such asinsertBefore()andappendChild().

+
+
+ + +

TheDocumentinterface represents the entire HTML or XML document. Conceptually, it is the root of the document tree, and provides the primary access to the document's data.

+

Since elements, text nodes, comments, processing instructions, etc. cannot exist outside the context of aDocument, theDocumentinterface also contains the factory methods needed to create these objects. TheNodeobjects created have aownerDocumentattribute which associates them with theDocumentwithin whose context they were created.

+
+ + +

The Document Type Declaration (seeDocumentType) associated with this document. For HTML documents as well as XML documents without a document type declaration this returnsnull. The DOM Level 1 does not support editing the Document Type Declaration, thereforedocTypecannot be altered in any way.

+
+
+ + +

TheDOMImplementationobject that handles this document. A DOM application may use objects from multiple implementations.

+
+
+ + +

This is a convenience attribute that allows direct access to the child node that is the root element of the document. For HTML documents, this is the element with the tagName "HTML".

+
+
+ + +

Creates an element of the type specified. Note that the instance returned implements theElementinterface, so attributes can be specified directly on the returned object.

+
+ + + +

The name of the element type to instantiate. For XML, this is case-sensitive. For HTML, thetagNameparameter may be provided in any case, but it must be mapped to the canonical uppercase form by the DOM implementation.

+
+ +
+ + +

A newElementobject.

+
+
+ + + +

INVALID_CHARACTER_ERR: Raised if the specified name contains an invalid character.

+
+
+
+
+ + +

Creates an emptyDocumentFragmentobject.

+
+ + + +

A newDocumentFragment.

+
+
+ +
+ + +

Creates aTextnode given the specified string.

+
+ + + +

The data for the node.

+
+ +
+ + +

The newTextobject.

+
+
+ +
+ + +

Creates aCommentnode given the specified string.

+
+ + + +

The data for the node.

+
+ +
+ + +

The newCommentobject.

+
+
+ +
+ + +

Creates aCDATASectionnode whose value is the specified string.

+
+ + + +

The data for theCDATASectioncontents.

+
+ +
+ + +

The newCDATASectionobject.

+
+
+ + + +

NOT_SUPPORTED_ERR: Raised if this document is an HTML document.

+
+
+
+
+ + +

Creates aProcessingInstructionnode given the specified name and data strings.

+
+ + + +

The target part of the processing instruction.

+
+ + + +

The data for the node.

+
+ +
+ + +

The newProcessingInstructionobject.

+
+
+ + + +

INVALID_CHARACTER_ERR: Raised if an invalid character is specified.

+

NOT_SUPPORTED_ERR: Raised if this document is an HTML document.

+
+
+
+
+ + +

Creates anAttrof the given name. Note that theAttrinstance can then be set on anElementusing thesetAttributemethod.

+
+ + + +

The name of the attribute.

+
+ +
+ + +

A newAttrobject.

+
+
+ + + +

INVALID_CHARACTER_ERR: Raised if the specified name contains an invalid character.

+
+
+
+
+ + +

Creates an EntityReference object.

+
+ + + +

The name of the entity to reference.

+
+ +
+ + +

The newEntityReferenceobject.

+
+
+ + + +

INVALID_CHARACTER_ERR: Raised if the specified name contains an invalid character.

+

NOT_SUPPORTED_ERR: Raised if this document is an HTML document.

+
+
+
+
+ + +

Returns aNodeListof all theElements with a given tag name in the order in which they would be encountered in a preorder traversal of theDocumenttree.

+
+ + + +

The name of the tag to match on. The special value "*" matches all tags.

+
+ +
+ + +

A newNodeListobject containing all the matchedElements.

+
+
+ +
+
+ + +

TheNodeinterface is the primary datatype for the entire Document Object Model. It represents a single node in the document tree. While all objects implementing theNodeinterface expose methods for dealing with children, not all objects implementing theNodeinterface may have children. For example,Textnodes may not have children, and adding children to such nodes results in aDOMExceptionbeing raised.

+

The attributesnodeName,nodeValueandattributesare included as a mechanism to getat node information without casting down to the specific derived interface. In cases where there is no obvious mapping of these attributes for a specificnodeType(e.g.,nodeValuefor an Element orattributesfor a Comment), this returnsnull. Note that the specialized interfaces may contain additional and more convenient mechanisms to get and set the relevant information.

+
+ + +

An integer indicating which type of node this is.

+
+ + +

The node is aElement.

+
+
+ + +

The node is anAttr.

+
+
+ + +

The node is aTextnode.

+
+
+ + +

The node is aCDATASection.

+
+
+ + +

The node is anEntityReference.

+
+
+ + +

The node is anEntity.

+
+
+ + +

The node is aProcessingInstruction.

+
+
+ + +

The node is aComment.

+
+
+ + +

The node is aDocument.

+
+
+ + +

The node is aDocumentType.

+
+
+ + +

The node is aDocumentFragment.

+
+
+ + +

The node is aNotation.

+
+
+
+

The values ofnodeName,nodeValue, andattributesvary according to the node type as follows: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+nodeNamenodeValueattributes
ElementtagNamenullNamedNodeMap
Attrname of attributevalue of attributenull
Text#textcontent of the text nodenull
CDATASection#cdata-sectioncontent of the CDATA Sectionnull
EntityReferencename of entity referencednullnull
Entityentity namenullnull
ProcessingInstructiontargetentire content excluding the targetnull
Comment#commentcontent of the commentnull
Document#documentnullnull
DocumentTypedocument type namenullnull
DocumentFragment#document-fragmentnullnull
Notationnotation namenullnull
+

+ + +

The name of this node, depending on its type; see the table above.

+
+
+ + +

The value of this node, depending on its type; see the table above.

+
+ + + +

NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.

+
+
+
+ + + +

DOMSTRING_SIZE_ERR: Raised when it would return more characters than fit in aDOMStringvariable on the implementation platform.

+
+
+
+
+ + +

A code representing the type of the underlying object, as defined above.

+
+
+ + +

The parent of this node. All nodes, exceptDocument,DocumentFragment, andAttrmay have a parent. However, if a node has just been created and not yet added to the tree, or if it has been removed from the tree, this isnull.

+
+
+ + +

ANodeListthat contains all children of this node. If there are no children, this is aNodeListcontaining no nodes. The content of the returnedNodeListis "live" in the sense that, for instance, changes to the children of the node object that it was created from are immediately reflected in the nodes returned by theNodeListaccessors; it is not a static snapshot of the content of the node. This is true for everyNodeList, including the ones returned by thegetElementsByTagNamemethod.

+
+
+ + +

The first child of this node. If there is no such node, this returnsnull.

+
+
+ + +

The last child of this node. If there is no such node, this returnsnull.

+
+
+ + +

The node immediately preceding this node. If there is no such node, this returnsnull.

+
+
+ + +

The node immediately following this node. If there is no such node, this returnsnull.

+
+
+ + +

ANamedNodeMapcontaining the attributes of this node (if it is anElement) ornullotherwise.

+
+
+ + +

TheDocumentobject associated with this node. This is also theDocumentobject used to create new nodes. When this node is aDocumentthis isnull.

+
+
+ + +

Inserts the nodenewChildbefore the existing child noderefChild. IfrefChildisnull, insertnewChildat the end of the list of children.

+

IfnewChildis aDocumentFragmentobject, all of its children are inserted, in the same order, beforerefChild. If thenewChildis already in the tree, it is first removed.

+
+ + + +

The node to insert.

+
+ + + +

The reference node, i.e., the node before which the new node must be inserted.

+
+ +
+ + +

The node being inserted.

+
+
+ + + +

HIERARCHY_REQUEST_ERR: Raised if this node is of a type that does not allow children of the type of thenewChildnode, or if the node to insert is one of this node's ancestors.

+

WRONG_DOCUMENT_ERR: Raised ifnewChildwas created from a different document than the one that created this node.

+

NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.

+

NOT_FOUND_ERR: Raised ifrefChildis not a child of this node.

+
+
+
+
+ + +

Replaces the child nodeoldChildwithnewChildin the list of children, and returns theoldChildnode. If thenewChildis already in the tree, it is first removed.

+
+ + + +

The new node to put in the child list.

+
+ + + +

The node being replaced in the list.

+
+ +
+ + +

The node replaced.

+
+
+ + + +

HIERARCHY_REQUEST_ERR: Raised if this node is of a type that does not allow children of the type of thenewChildnode, or it the node to put in is one of this node's ancestors.

+

WRONG_DOCUMENT_ERR: Raised ifnewChildwas created from a different document than the one that created this node.

+

NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.

+

NOT_FOUND_ERR: Raised ifoldChildis not a child of this node.

+
+
+
+
+ + +

Removes the child node indicated byoldChildfrom the list of children, and returns it.

+
+ + + +

The node being removed.

+
+ +
+ + +

The node removed.

+
+
+ + + +

NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.

+

NOT_FOUND_ERR: Raised ifoldChildis not a child of this node.

+
+
+
+
+ + +

Adds the nodenewChildto the end of the list of children of this node. If thenewChildis already in the tree, it is first removed.

+
+ + + +

The node to add.

+

If it is aDocumentFragmentobject, the entire contents of the document fragment are moved into the child list of this node

+
+ +
+ + +

The node added.

+
+
+ + + +

HIERARCHY_REQUEST_ERR: Raised if this node is of a type that does not allow children of the type of thenewChildnode, or if the node to append is one of this node's ancestors.

+

WRONG_DOCUMENT_ERR: Raised ifnewChildwas created from a different document than the one that created this node.

+

NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.

+
+
+
+
+ + +

This is a convenience method to allow easy determination of whether a node has any children.

+
+ + + +

+trueif the node has any children,falseif the node has no children.

+
+
+ +
+ + +

Returns a duplicate of this node, i.e., serves as a generic copy constructor for nodes. The duplicate node has no parent (parentNodereturnsnull.).

+

Cloning anElementcopies all attributes and their values, including those generated by the XML processor to represent defaulted attributes, but this method does not copy any text it contains unless it is a deep clone, since the text is contained in a childTextnode. Cloning any other type of node simply returns a copy of this node.

+
+ + + +

Iftrue, recursively clone the subtree under the specified node; iffalse, clone only the node itself (and its attributes, if it is anElement).

+
+ +
+ + +

The duplicate node.

+
+
+ +
+
+ + +

TheNodeListinterface provides the abstraction of an ordered collection of nodes, without defining or constraining how this collection is implemented.

+

The items in theNodeListare accessible via an integral index, starting from 0.

+
+ + +

Returns theindexth item in the collection. Ifindexis greater than or equal to the number of nodes in the list, this returnsnull.

+
+ + + +

Index into the collection.

+
+ +
+ + +

The node attheindexth position in theNodeList, ornullif that is not a valid index.

+
+
+ +
+ + +

The number of nodes in the list. The range of valid child node indices is 0 tolength-1inclusive.

+
+
+
+ + +

Objects implementing theNamedNodeMapinterface are used to represent collections of nodes that can be accessed by name. Note thatNamedNodeMapdoes not inherit fromNodeList;NamedNodeMaps are not maintained in any particular order. Objects contained in an object implementingNamedNodeMapmay also be accessed by an ordinal index, but this is simply to allow convenient enumeration of the contents of aNamedNodeMap, and does not imply that the DOM specifies an order to these Nodes.

+
+ + +

Retrieves a node specified by name.

+
+ + + +

Name of a node to retrieve.

+
+ +
+ + +

ANode(of any type) with the specified name, ornullif the specified name did not identify any node in the map.

+
+
+ +
+ + +

Adds a node using itsnodeNameattribute.

+

As thenodeNameattribute is used to derive the name which the node must be stored under, multiple nodes of certain types (those that have a "special" string value) cannot be stored as the names would clash. This is seen as preferable to allowing nodes to be aliased.

+
+ + + +

A node to store in a named node map. The node will later be accessible using the value of thenodeNameattribute of the node. If a node with that name is already present in the map, it is replaced by the new one.

+
+ +
+ + +

If the newNodereplaces an existing node with the same name the previously existingNodeis returned, otherwisenullis returned.

+
+
+ + + +

WRONG_DOCUMENT_ERR: Raised ifargwas created from a different document than the one that created theNamedNodeMap.

+

NO_MODIFICATION_ALLOWED_ERR: Raised if thisNamedNodeMapis readonly.

+

INUSE_ATTRIBUTE_ERR: Raised ifargis anAttrthat is already an attribute of anotherElementobject. The DOM user must explicitly cloneAttrnodes to re-use them in other elements.

+
+
+
+
+ + +

Removes a node specified by name. If the removed node is anAttrwith a default value it is immediately replaced.

+
+ + + +

The name of a node to remove.

+
+ +
+ + +

The node removed from the map ornullif no node with such a name exists.

+
+
+ + + +

NOT_FOUND_ERR: Raised if there is no node named name in this map.

+

NO_MODIFICATION_ALLOWED_ERR: Raised if this map is readonly.

+
+
+
+
+ + +

Returns theindexth item in the map. Ifindexis greater than or equal to the number of nodes in the map, this returnsnull.

+
+ + + +

Index into the map.

+
+ +
+ + +

The node at theindexth position in theNamedNodeMap, ornullif that is not a valid index.

+
+
+ +
+ + +

The number of nodes in the map. The range of valid child node indices is 0 tolength-1inclusive.

+
+
+
+ + +

TheCharacterDatainterface extends Node with a set of attributes and methods for accessing character data in the DOM. For clarity this set is defined here rather than on each object that uses these attributes and methods. No DOM objects correspond directly toCharacterData, thoughTextand others do inherit the interface from it. Alloffsets in this interface start from 0.

+
+ + +

The character data of the node that implements this interface. The DOM implementation may not put arbitrary limits on the amount of data that may be stored in aCharacterDatanode. However, implementation limits may mean that the entirety of a node's data may not fit into a singleDOMString. In such cases, the user may callsubstringDatato retrieve the data in appropriately sized pieces.

+
+ + + +

NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.

+
+
+
+ + + +

DOMSTRING_SIZE_ERR: Raised when it would return more characters than fit in aDOMStringvariable on the implementation platform.

+
+
+
+
+ + +

The number of characters that are available throughdataand thesubstringDatamethod below. This may have the value zero, i.e.,CharacterDatanodes may be empty.

+
+
+ + +

Extracts a range of data from the node.

+
+ + + +

Start offset of substring to extract.

+
+ + + +

The number of characters to extract.

+
+ +
+ + +

The specified substring. If the sum ofoffsetandcountexceeds thelength, then all characters to the end of the data are returned.

+
+
+ + + +

INDEX_SIZE_ERR: Raised if the specified offset is negative or greater than the number of characters indata, or if the specifiedcountis negative.

+

DOMSTRING_SIZE_ERR: Raised if the specified range of text does not fit into aDOMString.

+
+
+
+
+ + +

Append the string to the end of the character data of the node. Upon success,dataprovides access to the concatenation ofdataand theDOMStringspecified.

+
+ + + +

TheDOMStringto append.

+
+ +
+ + +

+ + + + + +

NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.

+
+ + +
+ + +

Insert a string at the specified character offset.

+
+ + + +

The character offset at which to insert.

+
+ + + +

TheDOMStringto insert.

+
+ +
+ + +

+ + + + + +

INDEX_SIZE_ERR: Raised if the specified offset is negative or greater than the number of characters indata.

+

NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.

+
+ + +
+ + +

Remove a range of characters from the node. Upon success,dataandlengthreflect the change.

+
+ + + +

The offset from which to remove characters.

+
+ + + +

The number of characters to delete. If the sum ofoffsetandcountexceedslengththen all characters fromoffsetto the end of the data are deleted.

+
+ +
+ + +

+ + + + + +

INDEX_SIZE_ERR: Raised if the specified offset is negative or greater than the number of characters indata, or if the specifiedcountis negative.

+

NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.

+
+ + +
+ + +

Replace the characters starting at the specified character offset with the specified string.

+
+ + + +

The offset from which to start replacing.

+
+ + + +

The number of characters to replace. If the sum ofoffsetandcountexceedslength, then all characters to the end of the data are replaced (i.e., the effect is the same as aremovemethod call with the same range, followed by anappendmethod invocation).

+
+ + + +

TheDOMStringwith which the range must be replaced.

+
+ +
+ + +

+ + + + + +

INDEX_SIZE_ERR: Raised if the specified offset is negative or greater than the number of characters indata, or if the specifiedcountis negative.

+

NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.

+
+ + +
+
+ + +

TheAttrinterface represents an attribute in anElementobject. Typically the allowable values for the attribute are defined in a document type definition.

+

+Attrobjects inherit theNodeinterface, but since they are not actually child nodes of the element they describe, the DOM does not consider them part of the document tree. Thus, theNodeattributesparentNode,previousSibling, andnextSiblinghave a null value forAttrobjects. The DOM takes the view that attributes are properties of elements rather than having a separate identity from the elements they are associated with; this should make it more efficient to implement such features as default attributes associated with all elements of a given type. Furthermore,Attrnodes may not be immediate children of aDocumentFragment. However, they can be associated withElementnodes contained within aDocumentFragment. In short, users and implementors of the DOM need to be aware thatAttrnodes have some things in common with other objects inheriting theNodeinterface, but they also are quite distinct.

+

The attribute's effective value is determined as follows: if this attribute has been explicitly assigned any value, that value is the attribute's effective value; otherwise, if there is a declaration for this attribute, and that declaration includes a default value, then that default value is the attribute's effective value; otherwise, the attribute does not exist on this element in the structure model until it has been explicitly added. Note that thenodeValueattribute on theAttrinstance can also be used to retrieve the string version of the attribute's value(s).

+

In XML, where the value of an attribute can contain entity references, the child nodes of theAttrnode provide a representation in which entity references are not expanded. These child nodes may be eitherTextorEntityReferencenodes. Because the attribute type may be unknown, there are no tokenized attribute values.

+
+ + +

Returns the name of this attribute.

+
+
+ + +

If this attribute was explicitly given a value in the original document, this istrue; otherwise, it isfalse. Note that the implementation is in charge of this attribute, not the user. If the user changes the value of the attribute (even if it ends up having the same value as the default value) then thespecifiedflag is automatically flipped totrue. To re-specify the attribute as the default value from the DTD, the user must delete the attribute. The implementation will then make a new attribute available withspecifiedset tofalseand the default value (if one exists).

+

In summary: + +

If the attribute has an assigned value in the document thenspecifiedistrue, and the value is the assigned value.

+ + +

If the attribute has no assigned value in the document and has a default value in the DTD, thenspecifiedisfalse, and the value is the default value in the DTD.

+
+ +

If the attribute has no assigned value in the document and has a value of #IMPLIED in the DTD, then the attribute does not appear in the structure model of the document.

+
+ +

+
+
+ + +

On retrieval, the value of the attribute is returned as a string. Character and general entity references are replaced with their values.

+

On setting, this creates aTextnode with the unparsed contents of the string.

+
+ + + +

NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.

+
+
+
+
+
+ + +

By far the vast majority of objects (apart from text) that authors encounter when traversing a document areElementnodes. Assume the following XML document:<elementExample id="demo"> <subelement1/> <subelement2><subsubelement/></subelement2> </elementExample> +

+

When represented using DOM, the top node is anElementnode for "elementExample", which contains two childElementnodes, one for "subelement1" and one for "subelement2". "subelement1" contains no child nodes.

+

Elements may have attributes associated with them; since theElementinterface inherits fromNode, the genericNodeinterface methodgetAttributesmay be used to retrieve the set of all attributes for an element. There are methods on theElementinterface to retrieve either anAttrobject by name or an attribute value by name. In XML, where an attribute value may contain entity references, anAttrobject should be retrieved to examine the possibly fairly complex sub-tree representing the attribute value. On the other hand, in HTML, where all attributes have simple string values, methods to directly access an attribute value can safely be used as a convenience.

+
+ + +

The name of the element. For example, in:<elementExample id="demo"> ... </elementExample> , +tagNamehas the value"elementExample". Note that this is case-preserving in XML, as are all of the operations of the DOM. The HTML DOM returns thetagNameof an HTML element in the canonical uppercase form, regardless of the case in the source HTML document.

+
+
+ + +

Retrieves an attribute value by name.

+
+ + + +

The name of the attribute to retrieve.

+
+ +
+ + +

TheAttrvalue as a string, or the empty string if that attribute does not have a specified or default value.

+
+
+ +
+ + +

Adds a new attribute. If an attribute with that name is already present in the element, its value is changed to be that of the value parameter. This value is a simple string, it is not parsed as it is being set. So any markup (such as syntax to be recognized as an entity reference) is treated as literal text, and needs to be appropriately escaped by the implementation when it is written out. In order to assign an attribute value that contains entity references, the user must create anAttrnode plus anyTextandEntityReferencenodes, build the appropriate subtree, and usesetAttributeNodeto assign it as the value of an attribute.

+
+ + + +

The name of the attribute to create or alter.

+
+ + + +

Value to set in string form.

+
+ +
+ + +

+ + + + + +

INVALID_CHARACTER_ERR: Raised if the specified name contains an invalid character.

+

NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.

+
+ + +
+ + +

Removes an attribute by name. If the removed attribute has a default value it is immediately replaced.

+
+ + + +

The name of the attribute to remove.

+
+ +
+ + +

+ + + + + +

NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.

+
+ + +
+ + +

Retrieves anAttrnode by name.

+
+ + + +

The name of the attribute to retrieve.

+
+ +
+ + +

TheAttrnode with the specified attribute name ornullif there is no such attribute.

+
+
+ +
+ + +

Adds a new attribute. If an attribute with that name is already present in the element, it is replaced by the new one.

+
+ + + +

TheAttrnode to add to the attribute list.

+
+ +
+ + +

If thenewAttrattribute replaces an existing attribute with the same name, the previously existingAttrnode is returned, otherwisenullis returned.

+
+
+ + + +

WRONG_DOCUMENT_ERR: Raised ifnewAttrwas created from a different document than the one that created the element.

+

NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.

+

INUSE_ATTRIBUTE_ERR: Raised ifnewAttris already an attribute of anotherElementobject. The DOM user must explicitly cloneAttrnodes to re-use them in other elements.

+
+
+
+
+ + +

Removes the specified attribute.

+
+ + + +

TheAttrnode to remove from the attribute list. If the removedAttrhas a default value it is immediately replaced.

+
+ +
+ + +

TheAttrnode that was removed.

+
+
+ + + +

NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.

+

NOT_FOUND_ERR: Raised ifoldAttris not an attribute of the element.

+
+
+
+
+ + +

Returns aNodeListof all descendant elements with a given tag name, in the order in which they would be encountered in a preorder traversal of theElementtree.

+
+ + + +

The name of the tag to match on. The special value "*" matches all tags.

+
+ +
+ + +

A list of matchingElementnodes.

+
+
+ +
+ + +

Puts allTextnodes in the full depth of the sub-tree underneath thisElementinto a "normal" form where only markup (e.g., tags, comments, processing instructions, CDATA sections, and entity references) separatesTextnodes, i.e., there are no adjacentTextnodes. This can be used to ensure that the DOM view of a document is the same as if it were saved and re-loaded, and is useful when operations (such as XPointer lookups) that depend on a particular document tree structure are to be used.

+
+ + + +

+ + + + + + + +

TheTextinterface represents the textual content (termedcharacterdatain XML) of anElementorAttr. If there is no markup inside an element's content, the text is contained in a single object implementing theTextinterface that is the only child of the element. If there is markup, it is parsed into a list of elements andTextnodes that form the list of children of the element.

+

When a document is first made available via the DOM, there is only oneTextnode for each block of text. Users may create adjacentTextnodes that represent the contents of a given element without any intervening markup, but should be aware that there is no way to represent the separations between these nodes in XML or HTML, so they will not (in general) persist between DOM editing sessions. Thenormalize()method onElementmerges any such adjacentTextobjects into a single node for each block of text; this is recommended before employing operations that depend on a particular document structure, such as navigation withXPointers. +

+
+ + +

Breaks thisTextnode into two Text nodes at the specified offset, keeping both in the tree as siblings. This node then only contains all the content up to theoffsetpoint. And a newTextnode, which is inserted as the next sibling of this node, contains all the content at and after theoffsetpoint.

+
+ + + +

The offset at which to split, starting from 0.

+
+ +
+ + +

The newTextnode.

+
+
+ + + +

INDEX_SIZE_ERR: Raised if the specified offset is negative or greater than the number of characters indata.

+

NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.

+
+
+
+
+
+ + +

This represents the content of a comment, i.e., all the characters between the starting '<!--' and ending '-->'. Note that this is the definition of a comment in XML, and, in practice, HTML, although some HTML tools may implement the full SGML comment structure.

+
+
+ + +

CDATA sections are used to escape blocks of text containing characters that would otherwise be regarded as markup. The only delimiter that is recognized in a CDATA section is the "]]>" string that ends the CDATA section. CDATA sections can not be nested. The primary purpose is for including material such as XML fragments, without needing to escape all the delimiters.

+

TheDOMStringattribute of theTextnode holds the text that is contained by the CDATA section. Note that thismaycontain characters that need to be escaped outside of CDATA sections and that, depending on the character encoding ("charset") chosen for serialization, it may be impossible to write out some characters as part of a CDATA section.

+

TheCDATASectioninterface inherits theCharacterDatainterface through theTextinterface. AdjacentCDATASectionsnodes are not merged by use of the Element.normalize() method.

+
+
+ + +

EachDocumenthas adoctypeattribute whose value is eithernullor aDocumentTypeobject. TheDocumentTypeinterface in the DOM Level 1 Core provides an interface to the list of entities that are defined for the document, and little else because the effect of namespaces and the various XML scheme efforts on DTD representation are not clearly understood as of this writing.

+

The DOM Level 1 doesn't support editingDocumentTypenodes.

+
+ + +

The name of DTD; i.e., the name immediately following theDOCTYPEkeyword.

+
+
+ + +

ANamedNodeMapcontaining the general entities, both external and internal, declared in the DTD. Duplicates are discarded. For example in:<!DOCTYPE ex SYSTEM "ex.dtd" [ <!ENTITY foo "foo"> <!ENTITY bar "bar"> <!ENTITY % baz "baz"> ]> <ex/>the interface provides access tofooandbarbut notbaz. Every node in this map also implements theEntityinterface.

+

The DOM Level 1 does not support editing entities, thereforeentitiescannot be altered in any way.

+
+
+ + +

ANamedNodeMapcontaining the notations declared in the DTD. Duplicates are discarded. Every node in this map also implements theNotationinterface.

+

The DOM Level 1 does not support editing notations, thereforenotationscannot be altered in any way.

+
+
+
+ + +

This interface represents a notation declared in the DTD. A notation either declares, by name, the format of an unparsed entity (see section 4.7 of the XML 1.0 specification), or is used for formal declaration of Processing Instruction targets (see section 2.6 of the XML 1.0 specification). ThenodeNameattribute inherited fromNodeis set to the declared name of the notation.

+

The DOM Level 1 does not support editingNotationnodes; they are therefore readonly.

+

ANotationnode does not have any parent.

+
+ + +

The public identifier of this notation. If the public identifier was not specified, this isnull.

+
+
+ + +

The system identifier of this notation. If the system identifier was not specified, this isnull.

+
+
+
+ + +

This interface represents an entity, either parsed or unparsed, in an XML document. Note that this models the entity itselfnotthe entity declaration.Entitydeclaration modeling has been left for a later Level of the DOM specification.

+

ThenodeNameattribute that is inherited fromNodecontains the name of the entity.

+

An XML processor may choose to completely expand entities before the structure model is passed to the DOM; in this case there will be noEntityReferencenodes in the document tree.

+

XML does not mandate that a non-validating XML processor read and process entity declarations made in the external subset or declared in external parameter entities. This means that parsed entities declared in the external subset need not be expanded by some classes of applications, and that the replacement value of the entity may not be available. When the replacement value is available, the correspondingEntitynode's child list represents the structure of that replacement text. Otherwise, the child list is empty.

+

The resolution of the children of theEntity(the replacement value) may be lazily evaluated; actions by the user (such as calling thechildNodesmethod on theEntityNode) are assumed to trigger the evaluation.

+

The DOM Level 1 does not support editingEntitynodes; if a user wants to make changes to the contents of anEntity, every relatedEntityReferencenode has to be replaced in the structure model by a clone of theEntity's contents, and then the desired changes must be made to each of those clones instead. All the descendants of anEntitynode are readonly.

+

AnEntitynode does not have any parent.

+
+ + +

The public identifier associated with the entity, if specified. If the public identifier was not specified, this isnull.

+
+
+ + +

The system identifier associated with the entity, if specified. If the system identifier was not specified, this isnull.

+
+
+ + +

For unparsed entities, the name of the notation for the entity. For parsed entities, this isnull.

+
+
+
+ + +

+EntityReferenceobjects may be inserted into the structure model when an entity reference is in the source document, or when the user wishes to insert an entity reference. Note that character references and references to predefined entities are considered to be expanded by the HTML or XML processor so that characters are represented by their Unicode equivalent rather than by an entity reference. Moreover, the XMLprocessor may completely expand references to entities while building the structure model, instead of providingEntityReferenceobjects. If it does provide such objects, then for a givenEntityReferencenode, it may be that there is noEntitynode representing the referenced entity; but if such anEntityexists, then the child list of theEntityReferencenode is the same as that of theEntitynode. As with theEntitynode, all descendants of theEntityReferenceare readonly.

+

The resolution of the children of theEntityReference(the replacement value of the referencedEntity) may be lazily evaluated; actions by the user (such as calling thechildNodesmethod on theEntityReferencenode) are assumed to trigger the evaluation.

+
+
+ + +

TheProcessingInstructioninterface represents a "processing instruction", used in XML as a way to keep processor-specific information in the text of the document.

+
+ + +

The target of this processing instruction. XML defines this as being the first token following the markup that begins the processing instruction.

+
+
+ + +

The content of this processing instruction. This is from the first non white space character after the target to the character immediately preceding the?>.

+
+ + + +

NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.

+
+
+
+
+
+ + +

AnHTMLCollectionis a list of nodes. An individual node may be accessed by either ordinal index or the node'snameoridattributes.Note:Collections in the HTML DOM are assumed to belivemeaning that they are automatically updated when the underlying document is changed.

+
+ + +

This attribute specifies the length orsizeof the list.

+
+
+ + +

This method retrieves a node specified by ordinal index. Nodes are numbered in tree order (depth-first traversal order).

+
+ + + +

The index of the node to be fetched. The index origin is 0.

+
+ +
+ + +

TheNodeat the corresponding position upon success. A value ofnullis returned if the index is out of range.

+
+
+ +
+ + +

This method retrieves aNodeusing a name. It first searches for aNodewith a matchingidattribute. If it doesn't find one, it then searches for aNodewith a matchingnameattribute, but only on those elements that are allowed a name attribute.

+
+ + + +

The name of theNodeto be fetched.

+
+ +
+ + +

TheNodewith anameoridattribute whose value corresponds to the specified string. Upon failure (e.g., no node with this name exists), returnsnull.

+
+
+ +
+
+ + +

AnHTMLDocumentis the root of the HTML hierarchy and holds the entire content. Beside providing access to the hierarchy, it also provides some convenience methods for accessing certain sets of information from the document.

+

The following properties have been deprecated in favor of the corresponding ones for the BODY element:

+ + +

alinkColor

+
+ +

background

+
+ +

bgColor

+
+ +

fgColor

+
+ +

linkColor

+
+ +

vlinkColor

+
+
+

+ + + +

The title of a document as specified by theTITLEelement in the head of the document.

+
+ + + +

Returns the URI of the page that linked to this page. The value is an empty string if the user navigated to the page directly (not through a link, but, for example, via a bookmark).

+
+
+ + +

The domain name of the server that served the document, or a null string if the server cannot be identified by a domain name.

+
+
+ + +

The complete URI of the document.

+
+
+ + +

The element that contains the content for the document. In documents withBODYcontents, returns theBODYelement, and in frameset documents, this returns the outermostFRAMESETelement.

+
+
+ + +

A collection of all theIMGelements in a document. The behavior is limited toIMGelements for backwards compatibility.

+
+
+ + +

A collection of all theOBJECTelements that include applets andAPPLET(deprecated) elements in a document.

+
+
+ + +

A collection of allAREAelements and anchor (A) elements in a document with a value for thehrefattribute.

+
+
+ + +

A collection of all the forms of a document.

+
+
+ + +

A collection of all the anchor (A) elements in a document with a value for thenameattribute.Note.For reasons of backwards compatibility, the returned set of anchors only contains those anchors created with thenameattribute, not those created with theidattribute.

+
+
+ + +

The cookies associated with this document. If there are none, the value is an empty string. Otherwise, the value is a string: a semicolon-delimited list of "name, value" pairs for all the cookies associated with the page. For example,name=value;expires=date.

+
+
+ + +

+Note.This method and the ones following allow a user to add to or replace the structure model of a document using strings of unparsed HTML. At the time of writing alternate methods for providing similar functionality for both HTML and XML documents were being considered. The following methods may be deprecated at some point in the future in favor of a more general-purpose mechanism.

+

Open a document stream for writing. If a document exists in the target, this method clears it.

+
+ + + +

+ + + + + + +

Closes a document stream opened byopen()and forces rendering.

+
+ + + +

+ + + + + + +

Write a string of text to a document stream opened byopen(). The text is parsed into the document's structure model.

+
+ + + +

The string to be parsed into some structure in the document structure model.

+
+ +
+ + +

+ + + + + + +

Write a string of text followed by a newline character to a document stream opened byopen(). The text is parsed into the document's structure model.

+
+ + + +

The string to be parsed into some structure in the document structure model.

+
+ +
+ + +

+ + + + + + +

Returns the Element whoseidis given by elementId. If no such element exists, returnsnull. Behavior is not defined if more than one element has thisid.

+
+ + + +

The uniqueidvalue for an element.

+
+ +
+ + +

The matching element.

+
+
+ +
+ + +

Returns the (possibly empty) collection of elements whosenamevalue is given byelementName.

+
+ + + +

Thenameattribute value for an element.

+
+ +
+ + +

The matching elements.

+
+
+ +
+
+ + +

All HTML element interfaces derive from this class. Elements that only expose the HTML core attributes are represented by the baseHTMLElementinterface. These elements are as follows:

+ + +

HEAD

+
+ +

special: SUB, SUP, SPAN, BDO

+
+ +

font: TT, I, B, U, S, STRIKE, BIG, SMALL

+
+ +

phrase: EM, STRONG, DFN, CODE, SAMP, KBD, VAR, CITE, ACRONYM, ABBR

+
+ +

list: DD, DT

+
+ +

NOFRAMES, NOSCRIPT

+
+ +

ADDRESS, CENTER

+
+
+

+Note.Thestyleattribute for this interface is reserved for future usage.

+
+ + +

The element's identifier. See theid attribute definitionin HTML 4.0.

+
+
+ + +

The element's advisory title. See thetitle attribute definitionin HTML 4.0.

+
+
+ + +

Language code defined in RFC 1766. See thelang attribute definitionin HTML 4.0.

+
+
+ + +

Specifies the base direction of directionally neutral text and the directionality of tables. See thedir attribute definitionin HTML 4.0.

+
+
+ + +

The class attribute of the element. This attribute has been renamed due to conflicts with the "class" keyword exposed by many languages. See theclass attribute definitionin HTML 4.0.

+
+
+
+ + +

Root of an HTML document. See theHTML element definitionin HTML 4.0.

+
+ + +

Version information about the document's DTD. See theversion attribute definitionin HTML 4.0. This attribute is deprecated in HTML 4.0.

+
+
+
+ + +

Document head information. See theHEAD element definitionin HTML 4.0.

+
+ + +

URI designating a metadata profile. See theprofile attribute definitionin HTML 4.0.

+
+
+
+ + +

TheLINKelement specifies a link to an external resource, and defines this document's relationship to that resource (or vice versa). See theLINK element definitionin HTML 4.0.

+
+ + +

Enables/disables the link. This is currently only used for style sheet links, and may be used to activate or deactivate style sheets.

+
+
+ + +

The character encoding of the resource being linked to. See thecharset attribute definitionin HTML 4.0.

+
+
+ + +

The URI of the linked resource. See thehref attribute definitionin HTML 4.0.

+
+
+ + +

Language code of the linked resource. See thehreflang attribute definitionin HTML 4.0.

+
+
+ + +

Designed for use with one or more target media. See themedia attribute definitionin HTML 4.0.

+
+
+ + +

Forward link type. See therel attribute definitionin HTML 4.0.

+
+
+ + +

Reverse link type. See therev attribute definitionin HTML 4.0.

+
+
+ + +

Frame to render the resource in. See thetarget attribute definitionin HTML 4.0.

+
+
+ + +

Advisory content type. See thetype attribute definitionin HTML 4.0.

+
+
+
+ + +

The document title. See theTITLE element definitionin HTML 4.0.

+
+ + +

The specified title as a string.

+
+
+
+ + +

This contains generic meta-information about the document. See theMETA element definitionin HTML 4.0.

+
+ + +

Associated information. See thecontent attribute definitionin HTML 4.0.

+
+
+ + +

HTTP response header name. See thehttp-equiv attribute definitionin HTML 4.0.

+
+
+ + +

Meta information name. See thename attribute definitionin HTML 4.0.

+
+
+ + +

Select form of content. See thescheme attribute definitionin HTML 4.0.

+
+
+
+ + +

Document base URI. See theBASE element definitionin HTML 4.0.

+
+ + +

The base URI See thehref attribute definitionin HTML 4.0.

+
+
+ + +

The default target frame. See thetarget attribute definitionin HTML 4.0.

+
+
+
+ + +

This element is used for single-line text input. See theISINDEX element definitionin HTML 4.0. This element is deprecated in HTML 4.0.

+
+ + +

Returns theFORMelement containing this control. Returns null if this control is not within the context of a form.

+
+
+ + +

The prompt message. See theprompt attribute definitionin HTML 4.0. This attribute is deprecated in HTML 4.0.

+
+
+
+ + +

Style information. A more detailed style sheet object model is planned to be defined in a separate document. See theSTYLE element definitionin HTML 4.0.

+
+ + +

Enables/disables the style sheet.

+
+
+ + +

Designed for use with one or more target media. See themedia attribute definitionin HTML 4.0.

+
+
+ + +

The style sheet language (Internet media type). See thetype attribute definitionin HTML 4.0.

+
+
+
+ + +

The HTML document body. This element is always present in the DOM API, even if the tags are not present in the source document. See theBODY element definitionin HTML 4.0.

+
+ + +

Color of active links (after mouse-button down, but before mouse-button up). See thealink attribute definitionin HTML 4.0. This attribute is deprecated in HTML 4.0.

+
+
+ + +

URI of the background texture tile image. See thebackground attribute definitionin HTML 4.0. This attribute is deprecated in HTML 4.0.

+
+
+ + +

Document background color. See thebgcolor attribute definitionin HTML 4.0. This attribute is deprecated in HTML 4.0.

+
+
+ + +

Color of links that are not active and unvisited. See thelink attribute definitionin HTML 4.0. This attribute is deprecated in HTML 4.0.

+
+
+ + +

Document text color. See thetext attribute definitionin HTML 4.0. This attribute is deprecated in HTML 4.0.

+
+
+ + +

Color of links that have been visited by the user. See thevlink attribute definitionin HTML 4.0. This attribute is deprecated in HTML 4.0.

+
+
+
+ + +

TheFORMelement encompasses behavior similar to a collection and an element. It provides direct access to the contained input elements as well as the attributes of the form element. See theFORM element definitionin HTML 4.0.

+
+ + +

Returns a collection of all control elements in the form.

+
+
+ + +

The number of form controls in the form.

+
+
+ + +

Names the form.

+
+
+ + +

List of character sets supported by the server. See theaccept-charset attribute definitionin HTML 4.0.

+
+
+ + +

Server-side form handler. See theaction attribute definitionin HTML 4.0.

+
+
+ + +

The content type of the submitted form, generally "application/x-www-form-urlencoded". See theenctype attribute definitionin HTML 4.0.

+
+
+ + +

HTTP method used to submit form. See themethod attribute definitionin HTML 4.0.

+
+
+ + +

Frame to render the resource in. See thetarget attribute definitionin HTML 4.0.

+
+
+ + +

Submits the form. It performs the same action as a submit button.

+
+ + + +

+ + + + + + +

Restores a form element's default values. It performs the same action as a reset button.

+
+ + + +

+ + + + + + + +

The select element allows the selection of an option. The contained options can be directly accessed through the select element as a collection. See theSELECT element definitionin HTML 4.0.

+
+ + +

The type of control created.

+
+
+ + +

The ordinal index of the selected option. The value -1 is returned if no element is selected. If multiple options are selected, the index of the first selected option is returned.

+
+
+ + +

The current form control value.

+
+
+ + +

The number of options in thisSELECT.

+
+
+ + +

Returns theFORMelement containing this control. Returns null if this control is not within the context of a form.

+
+
+ + +

The collection ofOPTIONelements contained by this element.

+
+
+ + +

The control is unavailable in this context. See thedisabled attribute definitionin HTML 4.0.

+
+
+ + +

If true, multipleOPTIONelements may be selected in thisSELECT. See themultiple attribute definitionin HTML 4.0.

+
+
+ + +

Form control or object name when submitted with a form. See thename attribute definitionin HTML 4.0.

+
+
+ + +

Number of visible rows. See thesize attribute definitionin HTML 4.0.

+
+
+ + +

Index that represents the element's position in the tabbing order. See thetabindex attribute definitionin HTML 4.0.

+
+
+ + +

Add a new element to the collection ofOPTIONelements for thisSELECT.

+
+ + + +

The element to add.

+
+ + + +

The element to insert before, or NULL for the head of the list.

+
+ +
+ + +

+ + + + + + +

Remove an element from the collection ofOPTIONelements for thisSELECT. Does nothing if no element has the given index.

+
+ + + +

The index of the item to remove.

+
+ +
+ + +

+ + + + + + +

Removes keyboard focus from this element.

+
+ + + +

+ + + + + + +

Gives keyboard focus to this element.

+
+ + + +

+ + + + + + + +

Group options together in logical subdivisions. See theOPTGROUP element definitionin HTML 4.0.

+
+ + +

The control is unavailable in this context. See thedisabled attribute definitionin HTML 4.0.

+
+
+ + +

Assigns a label to this option group. See thelabel attribute definitionin HTML 4.0.

+
+
+
+ + +

A selectable choice. See theOPTION element definitionin HTML 4.0.

+
+ + +

Returns theFORMelement containing this control. Returns null if this control is not within the context of a form.

+
+
+ + +

Stores the initial value of theselectedattribute.

+
+
+ + +

The text contained within the option element.

+
+
+ + +

The index of thisOPTIONin its parentSELECT.

+
+
+ + +

The control is unavailable in this context. See thedisabled attribute definitionin HTML 4.0.

+
+
+ + +

Option label for use in hierarchical menus. See thelabel attribute definitionin HTML 4.0.

+
+
+ + +

Means that this option is initially selected. See theselected attribute definitionin HTML 4.0.

+
+
+ + +

The current form control value. See thevalue attribute definitionin HTML 4.0.

+
+
+
+ + +

Form control.Note.Depending upon the environment the page is being viewed, the value property may be read-only for the file upload input type. For the "password" input type, the actual value returned may be masked to prevent unauthorized use. See theINPUT element definitionin HTML 4.0.

+
+ + +

Stores the initial control value (i.e., the initial value ofvalue).

+
+
+ + +

Whentypehas the value "Radio" or "Checkbox", stores the initial value of thecheckedattribute.

+
+
+ + +

Returns theFORMelement containing this control. Returns null if this control is not within the context of a form.

+
+
+ + +

A comma-separated list of content types that a server processing this form will handle correctly. See theaccept attribute definitionin HTML 4.0.

+
+
+ + +

A single character access key to give access to the form control. See theaccesskey attribute definitionin HTML 4.0.

+
+
+ + +

Aligns this object (vertically or horizontally) with respect to its surrounding text. See thealign attribute definitionin HTML 4.0. This attribute is deprecated in HTML 4.0.

+
+
+ + +

Alternate text for user agents not rendering the normal content of this element. See thealt attribute definitionin HTML 4.0.

+
+
+ + +

Describes whether a radio or check box is checked, whentypehas the value "Radio" or "Checkbox". The value is TRUE if explicitly set. Represents the current state of the checkbox or radio button. See thechecked attribute definitionin HTML 4.0.

+
+
+ + +

The control is unavailable in this context. See thedisabled attribute definitionin HTML 4.0.

+
+
+ + +

Maximum number of characters for text fields, whentypehas the value "Text" or "Password". See themaxlength attribute definitionin HTML 4.0.

+
+
+ + +

Form control or object name when submitted with a form. See thename attribute definitionin HTML 4.0.

+
+
+ + +

This control is read-only. Whentypehas the value "text" or "password" only. See thereadonly attribute definitionin HTML 4.0.

+
+
+ + +

Size information. The precise meaning is specific to each type of field. See thesize attribute definitionin HTML 4.0.

+
+
+ + +

When thetypeattribute has the value "Image", this attribute specifies the location of the image to be used to decorate the graphical submit button. See thesrc attribute definitionin HTML 4.0.

+
+
+ + +

Index that represents the element's position in the tabbing order. See thetabindex attribute definitionin HTML 4.0.

+
+
+ + +

The type of control created. See thetype attribute definitionin HTML 4.0.

+
+
+ + +

Use client-side image map. See theusemap attribute definitionin HTML 4.0.

+
+
+ + +

The current form control value. Used for radio buttons and check boxes. See thevalue attribute definitionin HTML 4.0.

+
+
+ + +

Removes keyboard focus from this element.

+
+ + + +

+ + + + + + +

Gives keyboard focus to this element.

+
+ + + +

+ + + + + + +

Select the contents of the text area. ForINPUTelements whosetypeattribute has one of the following values: "Text", "File", or "Password".

+
+ + + +

+ + + + + + +

Simulate a mouse-click. ForINPUTelements whosetypeattribute has one of the following values: "Button", "Checkbox", "Radio", "Reset", or "Submit".

+
+ + + +

+ + + + + + + +

Multi-line text field. See theTEXTAREA element definitionin HTML 4.0.

+
+ + +

Stores the initial control value (i.e., the initial value ofvalue).

+
+
+ + +

Returns theFORMelement containing this control. Returns null if this control is not within the context of a form.

+
+
+ + +

A single character access key to give access to the form control. See theaccesskey attribute definitionin HTML 4.0.

+
+
+ + +

Width of control (in characters). See thecols attribute definitionin HTML 4.0.

+
+
+ + +

The control is unavailable in this context. See thedisabled attribute definitionin HTML 4.0.

+
+
+ + +

Form control or object name when submitted with a form. See thename attribute definitionin HTML 4.0.

+
+
+ + +

This control is read-only. See thereadonly attribute definitionin HTML 4.0.

+
+
+ + +

Number of text rows. See therows attribute definitionin HTML 4.0.

+
+
+ + +

Index that represents the element's position in the tabbing order. See thetabindex attribute definitionin HTML 4.0.

+
+
+ + +

The type of this form control.

+
+
+ + +

The current textual content of the multi-line text field. If the entirety of the data can not fit into a single wstring, the implementation may truncate the data.

+
+
+ + +

Removes keyboard focus from this element.

+
+ + + +

+ + + + + + +

Gives keyboard focus to this element.

+
+ + + +

+ + + + + + +

Select the contents of theTEXTAREA.

+
+ + + +

+ + + + + + + +

Push button. See theBUTTON element definitionin HTML 4.0.

+
+ + +

Returns theFORMelement containing this control. Returns null if this control is not within the context of a form.

+
+
+ + +

A single character access key to give access to the form control. See theaccesskey attribute definitionin HTML 4.0.

+
+
+ + +

The control is unavailable in this context. See thedisabled attribute definitionin HTML 4.0.

+
+
+ + +

Form control or object name when submitted with a form. See thename attribute definitionin HTML 4.0.

+
+
+ + +

Index that represents the element's position in the tabbing order. See thetabindex attribute definitionin HTML 4.0.

+
+
+ + +

The type of button. See thetype attribute definitionin HTML 4.0.

+
+
+ + +

The current form control value. See thevalue attribute definitionin HTML 4.0.

+
+
+
+ + +

Form field label text. See theLABEL element definitionin HTML 4.0.

+
+ + +

Returns theFORMelement containing this control. Returns null if this control is not within the context of a form.

+
+
+ + +

A single character access key to give access to the form control. See theaccesskey attribute definitionin HTML 4.0.

+
+
+ + +

This attribute links this label with another form control byidattribute. See thefor attribute definitionin HTML 4.0.

+
+
+
+ + +

Organizes form controls into logical groups. See theFIELDSET element definitionin HTML 4.0.

+
+ + +

Returns theFORMelement containing this control. Returns null if this control is not within the context of a form.

+
+
+
+ + +

Provides a captionfor aFIELDSETgrouping. See theLEGEND element definitionin HTML 4.0.

+
+ + +

Returns theFORMelement containing this control. Returns null if this control is not within the context of a form.

+
+
+ + +

A single character access key to give access to the form control. See theaccesskey attribute definitionin HTML 4.0.

+
+
+ + +

Text alignment relative toFIELDSET. See thealign attribute definitionin HTML 4.0. This attribute is deprecated in HTML 4.0.

+
+
+
+ + +

Unordered list. See theUL element definitionin HTML 4.0.

+
+ + +

Reduce spacing between list items. See thecompact attribute definitionin HTML 4.0. This attribute is deprecated in HTML 4.0.

+
+
+ + +

Bullet style. See thetype attribute definitionin HTML 4.0. This attribute is deprecated in HTML 4.0.

+
+
+
+ + +

Ordered list. See theOL element definitionin HTML 4.0.

+
+ + +

Reduce spacing between list items. See thecompact attribute definitionin HTML 4.0. This attribute is deprecated in HTML 4.0.

+
+
+ + +

Starting sequence number. See thestart attribute definitionin HTML 4.0. This attribute is deprecated in HTML 4.0.

+
+
+ + +

Numbering style. See thetype attribute definitionin HTML 4.0. This attribute is deprecated in HTML 4.0.

+
+
+
+ + +

Definition list. See theDL element definitionin HTML 4.0.

+
+ + +

Reduce spacing between list items. See thecompact attribute definitionin HTML 4.0. This attribute is deprecated in HTML 4.0.

+
+
+
+ + +

Directory list. See theDIR element definitionin HTML 4.0. This element is deprecated in HTML 4.0.

+
+ + +

Reduce spacing between list items. See thecompact attribute definitionin HTML 4.0. This attribute is deprecated in HTML 4.0.

+
+
+
+ + +

Menu list. See theMENU element definitionin HTML 4.0. This element is deprecated in HTML 4.0.

+
+ + +

Reduce spacing between list items. See thecompact attribute definitionin HTML 4.0. This attribute is deprecated in HTML 4.0.

+
+
+
+ + +

List item. See theLI element definitionin HTML 4.0.

+
+ + +

List item bullet style. See thetype attribute definitionin HTML 4.0. This attribute is deprecated in HTML 4.0.

+
+
+ + +

Reset sequence number when used inOLSee thevalue attribute definitionin HTML 4.0. This attribute is deprecated in HTML 4.0.

+
+
+
+ + +

Generic block container. See theDIV element definitionin HTML 4.0.

+
+ + +

Horizontal text alignment. See thealign attribute definitionin HTML 4.0. This attribute is deprecated in HTML 4.0.

+
+
+
+ + +

Paragraphs. See theP element definitionin HTML 4.0.

+
+ + +

Horizontal text alignment. See thealign attribute definitionin HTML 4.0. This attribute is deprecated in HTML 4.0.

+
+
+
+ + +

For theH1toH6elements. See theH1 element definitionin HTML 4.0.

+
+ + +

Horizontal text alignment. See thealign attribute definitionin HTML 4.0. This attribute is deprecated in HTML 4.0.

+
+
+
+ + +

For theQandBLOCKQUOTEelements. See theQ element definitionin HTML 4.0.

+
+ + +

A URI designating a document that designates a source document or message. See thecite attribute definitionin HTML 4.0.

+
+
+
+ + +

Preformatted text. See thePRE element definitionin HTML 4.0.

+
+ + +

Fixed width for content. See thewidth attribute definitionin HTML 4.0. This attribute is deprecated in HTML 4.0.

+
+
+
+ + +

Force a line break. See theBR element definitionin HTML 4.0.

+
+ + +

Control flow of text around floats. See theclear attribute definitionin HTML 4.0. This attribute is deprecated in HTML 4.0.

+
+
+
+ + +

Base font. See theBASEFONT element definitionin HTML 4.0. This element is deprecated in HTML 4.0.

+
+ + +

Font color. See thecolor attribute definitionin HTML 4.0. This attribute is deprecated in HTML 4.0.

+
+
+ + +

Font face identifier. See theface attribute definitionin HTML 4.0. This attribute is deprecated in HTML 4.0.

+
+
+ + +

Font size. See thesize attribute definitionin HTML 4.0. This attribute is deprecated in HTML 4.0.

+
+
+
+ + +

Local change to font. See theFONT element definitionin HTML 4.0. This element is deprecated in HTML 4.0.

+
+ + +

Font color. See thecolor attribute definitionin HTML 4.0. This attribute is deprecated in HTML 4.0.

+
+
+ + +

Font face identifier. See theface attribute definitionin HTML 4.0. This attribute is deprecated in HTML 4.0.

+
+
+ + +

Font size. See thesize attribute definitionin HTML 4.0. This attribute is deprecated in HTML 4.0.

+
+
+
+ + +

Create a horizontal rule. See theHR element definitionin HTML 4.0.

+
+ + +

Align the rule on the page. See thealign attribute definitionin HTML 4.0. This attribute is deprecated in HTML 4.0.

+
+
+ + +

Indicates to the user agent that there should be no shading in the rendering of this element. See thenoshade attribute definitionin HTML 4.0. This attribute is deprecated in HTML 4.0.

+
+
+ + +

The height of the rule. See thesize attribute definitionin HTML 4.0. This attribute is deprecated in HTML 4.0.

+
+
+ + +

The width of the rule. See thewidth attribute definitionin HTML 4.0. This attribute is deprecated in HTML 4.0.

+
+
+
+ + +

Notice of modification to part of a document. See theINSandDELelement definitions in HTML 4.0.

+
+ + +

A URI designating a document that describes the reason for the change. See thecite attribute definitionin HTML 4.0.

+
+
+ + +

The date and time of the change. See thedatetime attribute definitionin HTML 4.0.

+
+
+
+ + +

The anchor element. See theA element definitionin HTML 4.0.

+
+ + +

A single character access key to give access to the form control. See theaccesskey attribute definitionin HTML 4.0.

+
+
+ + +

The character encoding of the linked resource. See thecharset attribute definitionin HTML 4.0.

+
+
+ + +

Comma-separated list of lengths, defining an active region geometry. See alsoshapefor the shape of the region. See thecoords attribute definitionin HTML 4.0.

+
+
+ + +

The URI of the linked resource. See thehref attribute definitionin HTML 4.0.

+
+
+ + +

Language code of the linked resource. See thehreflang attribute definitionin HTML 4.0.

+
+
+ + +

Anchor name. See thename attribute definitionin HTML 4.0.

+
+
+ + +

Forward link type. See therel attribute definitionin HTML 4.0.

+
+
+ + +

Reverse link type. See therev attribute definitionin HTML 4.0.

+
+
+ + +

The shape of the active area. The coordinates are given bycoords. See theshape attribute definitionin HTML 4.0.

+
+
+ + +

Index that represents the element's position in the tabbing order. See thetabindex attribute definitionin HTML 4.0.

+
+
+ + +

Frame to render the resource in. See thetarget attribute definitionin HTML 4.0.

+
+
+ + +

Advisory content type. See thetype attribute definitionin HTML 4.0.

+
+
+ + +

Removes keyboard focus from this element.

+
+ + + +

+ + + + + + +

Gives keyboard focus to this element.

+
+ + + +

+ + + + + + + +

Embedded image. See theIMG element definitionin HTML 4.0.

+
+ + +

URI designating the source of this image, for low-resolution output.

+
+
+ + +

The name of the element (for backwards compatibility).

+
+
+ + +

Aligns this object (vertically or horizontally) with respect to its surrounding text. See thealign attribute definitionin HTML 4.0. This attribute is deprecated in HTML 4.0.

+
+
+ + +

Alternate text for user agents not rendering the normal content of this element. See thealt attribute definitionin HTML 4.0.

+
+
+ + +

Width of border around image. See theborder attribute definitionin HTML 4.0. This attribute is deprecated in HTML 4.0.

+
+
+ + +

Override height. See theheight attribute definitionin HTML 4.0.

+
+
+ + +

Horizontal space to the left and right of this image. See thehspace attribute definitionin HTML 4.0. This attribute is deprecated in HTML 4.0.

+
+
+ + +

Use server-side image map. See theismap attribute definitionin HTML 4.0.

+
+
+ + +

URI designating a long description of this image or frame. See thelongdesc attribute definitionin HTML 4.0.

+
+
+ + +

URI designating the source of this image. See thesrc attribute definitionin HTML 4.0.

+
+
+ + +

Use client-side image map. See theusemap attribute definitionin HTML 4.0.

+
+
+ + +

Vertical space above and below this image. See thevspace attribute definitionin HTML 4.0. This attribute is deprecated in HTML 4.0.

+
+
+ + +

Override width. See thewidth attribute definitionin HTML 4.0.

+
+
+
+ + +

Generic embedded object.Note.In principle, all properties on the object element are read-write but in some environments some properties may be read-only once the underlying object is instantiated. See theOBJECT element definitionin HTML 4.0.

+
+ + +

Returns theFORMelement containing this control. Returns null if this control is not within the context of a form.

+
+
+ + +

Applet class file. See thecodeattribute for HTMLAppletElement.

+
+
+ + +

Aligns this object (vertically or horizontally) with respect to its surrounding text. See thealign attribute definitionin HTML 4.0. This attribute is deprecated in HTML 4.0.

+
+
+ + +

Space-separated list of archives. See thearchive attribute definitionin HTML 4.0.

+
+
+ + +

Width of border around the object. See theborder attribute definitionin HTML 4.0. This attribute is deprecated in HTML 4.0.

+
+
+ + +

Base URI forclassid,data, andarchiveattributes. See thecodebase attribute definitionin HTML 4.0.

+
+
+ + +

Content type for data downloaded viaclassidattribute. See thecodetype attribute definitionin HTML 4.0.

+
+
+ + +

A URI specifying the location of the object's data. See thedata attribute definitionin HTML 4.0.

+
+
+ + +

Declare (for future reference), but do not instantiate, this object. See thedeclare attribute definitionin HTML 4.0.

+
+
+ + +

Override height. See theheight attribute definitionin HTML 4.0.

+
+
+ + +

Horizontal space to the left and right of this image, applet, or object. See thehspace attribute definitionin HTML 4.0. This attribute is deprecated in HTML 4.0.

+
+
+ + +

Form control or object name when submitted with a form. See thename attribute definitionin HTML 4.0.

+
+
+ + +

Message to render while loading the object. See thestandby attribute definitionin HTML 4.0.

+
+
+ + +

Index that represents the element's position in the tabbing order. See thetabindex attribute definitionin HTML 4.0.

+
+
+ + +

Content type for data downloaded viadataattribute. See thetype attribute definitionin HTML 4.0.

+
+
+ + +

Use client-side image map. See theusemap attribute definitionin HTML 4.0.

+
+
+ + +

Vertical space above and below this image, applet, or object. See thevspace attribute definitionin HTML 4.0. This attribute is deprecated in HTML 4.0.

+
+
+ + +

Override width. See thewidth attribute definitionin HTML 4.0.

+
+
+
+ + +

Parameters fed to theOBJECTelement. See thePARAM element definitionin HTML 4.0.

+
+ + +

The name of a run-time parameter. See thename attribute definitionin HTML 4.0.

+
+
+ + +

Content type for thevalueattribute whenvaluetypehas the value "ref". See thetype attribute definitionin HTML 4.0.

+
+
+ + +

The value of a run-time parameter. See thevalue attribute definitionin HTML 4.0.

+
+
+ + +

Information about the meaning of thevalueattribute value. See thevaluetype attribute definitionin HTML 4.0.

+
+
+
+ + +

An embedded Java applet. See theAPPLET element definitionin HTML 4.0. This element is deprecated in HTML 4.0.

+
+ + +

Aligns this object (vertically or horizontally) with respect to its surrounding text. See thealign attribute definitionin HTML 4.0. This attribute is deprecated in HTML 4.0.

+
+
+ + +

Alternate text for user agents not rendering the normal content of this element. See thealt attribute definitionin HTML 4.0. This attribute is deprecated in HTML 4.0.

+
+
+ + +

Comma-separated archive list. See thearchive attribute definitionin HTML 4.0. This attribute is deprecated in HTML 4.0.

+
+
+ + +

Applet class file. See thecode attribute definitionin HTML 4.0. This attribute is deprecated in HTML 4.0.

+
+
+ + +

Optional base URI for applet. See thecodebase attribute definitionin HTML 4.0. This attribute is deprecated in HTML 4.0.

+
+
+ + +

Override height. See theheight attribute definitionin HTML 4.0. This attribute is deprecated in HTML 4.0.

+
+
+ + +

Horizontal space to the left and right of this image, applet, or object. See thehspace attribute definitionin HTML 4.0. This attribute is deprecated in HTML 4.0.

+
+
+ + +

The name of the applet. See thename attribute definitionin HTML 4.0. This attribute is deprecated in HTML 4.0.

+
+
+ + +

Serialized applet file. See theobject attribute definitionin HTML 4.0. This attribute is deprecated in HTML 4.0.

+
+
+ + +

Vertical space above and below this image, applet, or object. See thevspace attribute definitionin HTML 4.0. This attribute is deprecated in HTML 4.0.

+
+
+ + +

Override width. See thewidth attribute definitionin HTML 4.0. This attribute is deprecated in HTML 4.0.

+
+
+
+ + +

Client-side image map. See theMAP element definitionin HTML 4.0.

+
+ + +

The list of areas defined for the image map.

+
+
+ + +

Names the map (for use withusemap). See thename attribute definitionin HTML 4.0.

+
+
+
+ + +

Client-side image map area definition. See theAREA element definitionin HTML 4.0.

+
+ + +

A single character access key to give access to the form control. See theaccesskey attribute definitionin HTML 4.0.

+
+
+ + +

Alternate text for user agents not rendering the normal content of this element. See thealt attribute definitionin HTML 4.0.

+
+
+ + +

Comma-separated list of lengths, defining an active region geometry. See alsoshapefor the shape of the region. See thecoords attribute definitionin HTML 4.0.

+
+
+ + +

The URI of the linked resource. See thehref attribute definitionin HTML 4.0.

+
+
+ + +

Specifies that this area is inactive, i.e., has no associated action. See thenohref attribute definitionin HTML 4.0.

+
+
+ + +

The shape of the active area. The coordinates are given bycoords. See theshape attribute definitionin HTML 4.0.

+
+
+ + +

Index that represents the element's position in the tabbing order. See thetabindex attribute definitionin HTML 4.0.

+
+
+ + +

Frame to render the resource in. See thetarget attribute definitionin HTML 4.0.

+
+
+
+ + +

Script statements. See theSCRIPT element definitionin HTML 4.0.

+
+ + +

The script content of the element.

+
+
+ + +

+Reserved for future use. +

+
+
+ + +

+Reserved for future use. +

+
+
+ + +

The character encoding of the linked resource. See thecharset attribute definitionin HTML 4.0.

+
+
+ + +

Indicates that the user agent can defer processing of the script. See thedefer attribute definitionin HTML 4.0.

+
+
+ + +

URI designating an external script. See thesrc attribute definitionin HTML 4.0.

+
+
+ + +

The content type of the script language. See thetype attribute definitionin HTML 4.0.

+
+
+
+ + +

The create* and delete* methods on the table allow authors to construct and modify tables. HTML 4.0 specifies that only one of each of theCAPTION,THEAD, andTFOOTelements may exist in a table. Therefore, if one exists, and the createTHead() or createTFoot() method is called, the method returns the existing THead or TFoot element. See theTABLE element definitionin HTML 4.0.

+
+ + +

Returns the table'sCAPTION, or void if none exists.

+
+
+ + +

Returns the table'sTHEAD, ornullif none exists.

+
+
+ + +

Returns the table'sTFOOT, ornullif none exists.

+
+
+ + +

Returns a collection of all the rows in the table, including all inTHEAD,TFOOT, allTBODYelements.

+
+
+ + +

Returns a collection of the defined table bodies.

+
+
+ + +

Specifies the table's position with respect to the rest of the document. See thealign attribute definitionin HTML 4.0. This attribute is deprecated in HTML 4.0.

+
+
+ + +

Cell background color. See thebgcolor attribute definitionin HTML 4.0. This attribute is deprecated in HTML 4.0.

+
+
+ + +

The width of the border around the table. See theborder attribute definitionin HTML 4.0.

+
+
+ + +

Specifies the horizontal and vertical space between cell content and cell borders. See thecellpadding attribute definitionin HTML 4.0.

+
+
+ + +

Specifies the horizontal and vertical separation between cells. See thecellspacing attribute definitionin HTML 4.0.

+
+
+ + +

Specifies which external table borders to render. See theframe attribute definitionin HTML 4.0.

+
+
+ + +

Specifies which internal table borders to render. See therules attribute definitionin HTML 4.0.

+
+
+ + +

Supplementary description about the purpose or structure of a table. See thesummary attribute definitionin HTML 4.0.

+
+
+ + +

Specifies the desired table width. See thewidth attribute definitionin HTML 4.0.

+
+
+ + +

Create a table header row or return an existing one.

+
+ + + +

A new table header element (THEAD).

+
+
+ +
+ + +

Delete the header from the table, if one exists.

+
+ + + +

+ + + + + + +

Create a table footer row or return an existing one.

+
+ + + +

A footer element (TFOOT).

+
+
+ +
+ + +

Delete the footer from the table, if one exists.

+
+ + + +

+ + + + + + +

Create a new table caption object or return an existing one.

+
+ + + +

ACAPTIONelement.

+
+
+ +
+ + +

Delete the table caption, if one exists.

+
+ + + +

+ + + + + + +

Insert a new empty row in the table.Note.A table row cannot be empty according to HTML 4.0 Recommendation.

+
+ + + +

The row number where to insert a new row.

+
+ +
+ + +

The newly created row.

+
+
+ +
+ + +

Delete a table row.

+
+ + + +

The index of the row to be deleted.

+
+ +
+ + +

+ + + + + + + +

Table caption See theCAPTION element definitionin HTML 4.0.

+
+ + +

Caption alignment with respect to the table. See thealign attribute definitionin HTML 4.0. This attribute is deprecated in HTML 4.0.

+
+
+
+ + +

Regroups theCOLandCOLGROUPelements. See theCOL element definitionin HTML 4.0.

+
+ + +

Horizontal alignment of cell data in column. See thealign attribute definitionin HTML 4.0.

+
+
+ + +

Alignment character for cells in a column. See thechar attribute definitionin HTML 4.0.

+
+
+ + +

Offset of alignment character. See thecharoff attribute definitionin HTML 4.0.

+
+
+ + +

Indicates the number of columns in a group or affected by a grouping. See thespan attribute definitionin HTML 4.0.

+
+
+ + +

Vertical alignment of cell data in column. See thevalign attribute definitionin HTML 4.0.

+
+
+ + +

Default column width. See thewidth attribute definitionin HTML 4.0.

+
+
+
+ + +

TheTHEAD,TFOOT, andTBODYelements.

+
+ + +

Horizontal alignment of data in cells. See thealignattribute for HTMLTheadElement for details.

+
+
+ + +

Alignment character for cells in a column. See thechar attribute definitionin HTML 4.0.

+
+
+ + +

Offset of alignment character. See thecharoff attribute definitionin HTML 4.0.

+
+
+ + +

Vertical alignment of data in cells. See thevalignattribute for HTMLTheadElement for details.

+
+
+ + +

The collection of rows in this table section.

+
+
+ + +

Insert a row into this section.

+
+ + + +

The row number where to insert a new row.

+
+ +
+ + +

The newly created row.

+
+
+ +
+ + +

Delete a row from this section.

+
+ + + +

The index of the row to be deleted.

+
+ +
+ + +

+ + + + + + + +

A row in a table. See theTR element definitionin HTML 4.0.

+
+ + +

The index of this row, relative to the entire table.

+
+
+ + +

The index of this row, relative to the current section (THEAD,TFOOT, orTBODY).

+
+
+ + +

The collection of cells in this row.

+
+
+ + +

Horizontal alignment of data within cells of this row. See thealign attribute definitionin HTML 4.0.

+
+
+ + +

Background color for rows. See thebgcolor attribute definitionin HTML 4.0. This attribute is deprecated in HTML 4.0.

+
+
+ + +

Alignment character for cells in a column. See thechar attribute definitionin HTML 4.0.

+
+
+ + +

Offset of alignment character. See thecharoff attribute definitionin HTML 4.0.

+
+
+ + +

Vertical alignment of data within cells of this row. See thevalign attribute definitionin HTML 4.0.

+
+
+ + +

Insert an emptyTDcell into this row.

+
+ + + +

The place to insert the cell.

+
+ +
+ + +

The newly created cell.

+
+
+ +
+ + +

Delete a cell from the current row.

+
+ + + +

The index of the cell to delete.

+
+ +
+ + +

+ + + + + + + +

The object used to represent theTHandTDelements. See theTD element definitionin HTML 4.0.

+
+ + +

The index of this cell in the row.

+
+
+ + +

Abbreviation for header cells. See theabbr attribute definitionin HTML 4.0.

+
+
+ + +

Horizontal alignment of data in cell. See thealign attribute definitionin HTML 4.0.

+
+
+ + +

Names group of related headers. See theaxis attribute definitionin HTML 4.0.

+
+
+ + +

Cell background color. See thebgcolor attribute definitionin HTML 4.0. This attribute is deprecated in HTML 4.0.

+
+
+ + +

Alignment character for cells in a column. See thechar attribute definitionin HTML 4.0.

+
+
+ + +

Offset of alignment character. See thecharoff attribute definitionin HTML 4.0.

+
+
+ + +

Number of columns spanned by cell. See thecolspan attribute definitionin HTML 4.0.

+
+
+ + +

List ofidattribute values for header cells. See theheaders attribute definitionin HTML 4.0.

+
+
+ + +

Cell height. See theheight attribute definitionin HTML 4.0. This attribute is deprecated in HTML 4.0.

+
+
+ + +

Suppress word wrapping. See thenowrap attribute definitionin HTML 4.0. This attribute is deprecated in HTML 4.0.

+
+
+ + +

Number of rows spanned by cell. See therowspan attribute definitionin HTML 4.0.

+
+
+ + +

Scope covered by header cells. See thescope attribute definitionin HTML 4.0.

+
+
+ + +

Vertical alignment of data in cell. See thevalign attribute definitionin HTML 4.0.

+
+
+ + +

Cell width. See thewidth attribute definitionin HTML 4.0. This attribute is deprecated in HTML 4.0.

+
+
+
+ + +

Create a grid of frames. See theFRAMESET element definitionin HTML 4.0.

+
+ + +

The number of columns of frames in the frameset. See thecols attribute definitionin HTML 4.0.

+
+
+ + +

The number of rows of frames in the frameset. See therows attribute definitionin HTML 4.0.

+
+
+
+ + +

Create a frame. See theFRAME element definitionin HTML 4.0.

+
+ + +

Request frame borders. See theframeborder attribute definitionin HTML 4.0.

+
+
+ + +

URI designating a long description of this image or frame. See thelongdesc attribute definitionin HTML 4.0.

+
+
+ + +

Frame margin height, in pixels. See themarginheight attribute definitionin HTML 4.0.

+
+
+ + +

Frame margin width, in pixels. See themarginwidth attribute definitionin HTML 4.0.

+
+
+ + +

The frame name (object of thetargetattribute). See thename attribute definitionin HTML 4.0.

+
+
+ + +

When true, forbid user from resizing frame. See thenoresize attribute definitionin HTML 4.0.

+
+
+ + +

Specify whether or not the frame should have scrollbars. See thescrolling attribute definitionin HTML 4.0.

+
+
+ + +

A URI designating the initial frame contents. See thesrc attribute definitionin HTML 4.0.

+
+
+
+ + +

Inline subwindows. See theIFRAME element definitionin HTML 4.0.

+
+ + +

Aligns this object (vertically or horizontally) with respect to its surrounding text. See thealign attribute definitionin HTML 4.0. This attribute is deprecated in HTML 4.0.

+
+
+ + +

Request frame borders. See theframeborder attribute definitionin HTML 4.0.

+
+
+ + +

Frame height. See theheight attribute definitionin HTML 4.0.

+
+
+ + +

URI designating a long description of this image or frame. See thelongdesc attribute definitionin HTML 4.0.

+
+
+ + +

Frame margin height, in pixels. See themarginheight attribute definitionin HTML 4.0.

+
+
+ + +

Frame margin width, in pixels. See themarginwidth attribute definitionin HTML 4.0.

+
+
+ + +

The frame name (object of thetargetattribute). See thename attribute definitionin HTML 4.0.

+
+
+ + +

Specify whether or not the frame should have scrollbars. See thescrolling attribute definitionin HTML 4.0.

+
+
+ + +

A URI designating the initial frame contents. See thesrc attribute definitionin HTML 4.0.

+
+
+ + +

Frame width. See thewidth attribute definitionin HTML 4.0.

+
+
+
+
diff --git a/test/dom2-core-interface.xml b/test/dom2-core-interface.xml new file mode 100644 index 0000000..03d2e17 --- /dev/null +++ b/test/dom2-core-interface.xml @@ -0,0 +1,35 @@ + + + + +

DOM operations only raise exceptions in "exceptional" circumstances, i.e., when an operation is impossible to perform (either for logical reasons, because data is lost, or because the implementation has become unstable). In general, DOM methods return specific error values in ordinary processing situations, such as out-of-bound errors when usingNodeList.

Implementations should raise other exceptions under other circumstances. For example, implementations should raise an implementation-dependent exception if anullargument is passed.

Some languages and object systems do not support the concept of exceptions. For such systems, error conditions may be indicated using native error reporting mechanisms. For some bindings, for example, methods may return error codes similar to those listed in the corresponding method descriptions.

unsigned short
+

An integer indicating the type of error generated.

Other numeric codes are reserved for W3C for possible future use.

If index or size is negative, or greater than the allowed value

If the specified range of text does not fit into a DOMString

If any node is inserted somewhere it doesn't belong

If a node is used in a different document than the one that created it (that doesn't support it)

If an invalid or illegal character is specified, such as in a name. Seein the XML specification for the definition of a legal character, andfor the definition of a legal name character.

If data is specified for a node which does not support data

If an attempt is made to modify an object where modifications are not allowed

If an attempt is made to reference a node in a context where it does not exist

If the implementation does not support the requested type of object or operation.

If an attempt is made to add an attribute that is already in use elsewhere

If an attempt is made to use an object that is not, or is no longer, usable.

If an invalid or illegal string is specified.

If an attempt is made to modify the type of the underlying object.

If an attempt is made to create or change an object in a way which is incorrect with regard to namespaces.

If a parameter or an operation is not supported by the underlying object.

+

TheDOMImplementationinterface provides a number of methods for performing operations that are independent of any particular instance of the document object model.

Test if the DOM implementation implements a specific feature.

The name of the feature to test (case-insensitive). The values used by DOM features are defined throughout the DOM Level 2 specifications and listed in thesection. The name must be anXML name. To avoid possible conflicts, as a convention, names referring to features defined outside the DOM specification should be made unique by reversing the name of the Internet domain name of the person (or the organization that the person belongs to) who defines the feature, component by component, and using this as a prefix. For instance, the W3C SVG Working Group defines the feature "org.w3c.dom.svg".

This is the version number of the feature to test. In Level 2, the string can be either "2.0" or "1.0". If the version is not specified, supporting any version of the feature causes the method to returntrue.

trueif the feature is implemented in the specified version,falseotherwise.

Creates an emptyDocumentTypenode. Entity declarations and notations are not made available. Entity reference expansions and default attribute additions do not occur. It is expected that a future version of the DOM will provide a way for populating aDocumentType.

HTML-only DOM implementations do not need to implement this method.

Thequalified nameof the document type to be created.

The external subset public identifier.

The external subset system identifier.

A newDocumentTypenode withNode.ownerDocumentset tonull.

INVALID_CHARACTER_ERR: Raised if the specified qualified name contains an illegal character.

NAMESPACE_ERR: Raised if thequalifiedNameis malformed.

Creates an XMLDocumentobject of the specified type with its document element. HTML-only DOM implementations do not need to implement this method.

Thenamespace URIof the document element to create.

Thequalified nameof the document element to be created.

The type of document to be created ornull.

Whendoctypeis notnull, itsNode.ownerDocumentattribute is set to the document being created.

A newDocumentobject.

INVALID_CHARACTER_ERR: Raised if the specified qualified name contains an illegal character.

NAMESPACE_ERR: Raised if thequalifiedNameis malformed, if thequalifiedNamehas a prefix and thenamespaceURIisnull, or if thequalifiedNamehas a prefix that is "xml" and thenamespaceURIis different from "".

WRONG_DOCUMENT_ERR: Raised ifdoctypehas already been used with a different document or was created from a different implementation.

NOT_SUPPORTED_ERR: May be raised by DOM implementations which do not support the "XML" feature, if they choose not to support this method. Note: Other features introduced in the future, by the DOM WG or in extensions defined by other groups, may also demand support for this method; please consult the definition of the feature to see if it requires this method.

+

DocumentFragmentis a "lightweight" or "minimal"Documentobject. It is very common to want to be able to extract a portion of a document's tree or to create a new fragment of a document. Imagine implementing a user command like cut or rearranging a document by moving fragments around. It is desirable to have an object which can hold such fragments and it is quite natural to use a Node for this purpose. While it is true that aDocumentobject could fulfill this role, aDocumentobject can potentially be a heavyweight object, depending on the underlying implementation. What is really needed for this is a very lightweight object.DocumentFragmentis such an object.

Furthermore, various operations -- such as inserting nodes as children of anotherNode-- may takeDocumentFragmentobjects as arguments; this results in all the child nodes of theDocumentFragmentbeing moved to the child list of this node.

The children of aDocumentFragmentnode are zero or more nodes representing the tops of any sub-trees defining the structure of the document.DocumentFragmentnodes do not need to bewell-formed XML documents(although they do need to follow the rules imposed upon well-formed XML parsed entities, which can have multiple top nodes). For example, aDocumentFragmentmight have only one child and that child node could be aTextnode. Such a structure model represents neither an HTML document nor a well-formed XML document.

When aDocumentFragmentis inserted into aDocument(or indeed any otherNodethat may take children) the children of theDocumentFragmentand not theDocumentFragmentitself are inserted into theNode. This makes theDocumentFragmentvery useful when the user wishes to create nodes that aresiblings; theDocumentFragmentacts as the parent of these nodes so that the user can use the standard methods from theNodeinterface, such asinsertBeforeandappendChild.

+

TheDocumentinterface represents the entire HTML or XML document. Conceptually, it is therootof the document tree, and provides the primary access to the document's data.

Since elements, text nodes, comments, processing instructions, etc. cannot exist outside the context of aDocument, theDocumentinterface also contains the factory methods needed to create these objects. TheNodeobjects created have aownerDocumentattribute which associates them with theDocumentwithin whose context they were created.

The Document Type Declaration (seeDocumentType) associated with this document. For HTML documents as well as XML documents without a document type declaration this returnsnull. The DOM Level 2 does not support editing the Document Type Declaration.docTypecannot be altered in any way, including through the use of methods inherited from theNodeinterface, such asinsertNodeorremoveNode.

TheDOMImplementationobject that handles this document. A DOM application may use objects from multiple implementations.

This is aconvenienceattribute that allows direct access to the child node that is the root element of the document. For HTML documents, this is the element with the tagName "HTML".

Creates an element of the type specified. Note that the instance returned implements theElementinterface, so attributes can be specified directly on the returned object.

In addition, if there are known attributes with default values,Attrnodes representing them are automatically created and attached to the element.

To create an element with a qualified name and namespace URI, use thecreateElementNSmethod.

The name of the element type to instantiate. For XML, this is case-sensitive. For HTML, thetagNameparameter may be provided in any case, but it must be mapped to the canonical uppercase form by the DOM implementation.

A newElementobject with thenodeNameattribute set totagName, andlocalName,prefix, andnamespaceURIset tonull.

INVALID_CHARACTER_ERR: Raised if the specified name contains an illegal character.

Creates an emptyDocumentFragmentobject.

A newDocumentFragment.

Creates aTextnode given the specified string.

The data for the node.

The newTextobject.

Creates aCommentnode given the specified string.

The data for the node.

The newCommentobject.

Creates aCDATASectionnode whose value is the specified string.

The data for theCDATASectioncontents.

The newCDATASectionobject.

NOT_SUPPORTED_ERR: Raised if this document is an HTML document.

Creates aProcessingInstructionnode given the specified name and data strings.

The target part of the processing instruction.

The data for the node.

The newProcessingInstructionobject.

INVALID_CHARACTER_ERR: Raised if the specified target contains an illegal character.

NOT_SUPPORTED_ERR: Raised if this document is an HTML document.

Creates anAttrof the given name. Note that theAttrinstance can then be set on anElementusing thesetAttributeNodemethod.

To create an attribute with a qualified name and namespace URI, use thecreateAttributeNSmethod.

The name of the attribute.

A newAttrobject with thenodeNameattribute set toname, andlocalName,prefix, andnamespaceURIset tonull. The value of the attribute is the empty string.

INVALID_CHARACTER_ERR: Raised if the specified name contains an illegal character.

Creates anEntityReferenceobject. In addition, if the referenced entity is known, the child list of theEntityReferencenode is made the same as that of the correspondingEntitynode.

If any descendant of theEntitynode has an unboundnamespace prefix, the corresponding descendant of the createdEntityReferencenode is also unbound; (itsnamespaceURIisnull). The DOM Level 2 does not support any mechanism to resolve namespace prefixes.

The name of the entity to reference.

The newEntityReferenceobject.

INVALID_CHARACTER_ERR: Raised if the specified name contains an illegal character.

NOT_SUPPORTED_ERR: Raised if this document is an HTML document.

Returns aNodeListof all theElementswith a given tag name in the order in which they are encountered in a preorder traversal of theDocumenttree.

The name of the tag to match on. The special value "*" matches all tags.

A newNodeListobject containing all the matchedElements.

Imports a node from another document to this document. The returned node has no parent; (parentNodeisnull). The source node is not altered or removed from the original document; this method creates a new copy of the source node.

For all nodes, importing a node creates a node object owned by the importing document, with attribute values identical to the source node'snodeNameandnodeType, plus the attributes related to namespaces (prefix,localName, andnamespaceURI). As in thecloneNodeoperation on aNode, the source node is not altered.

Additional information is copied as appropriate to thenodeType, attempting to mirror the behavior expected if a fragment of XML or HTML source was copied from one document to another, recognizing that the two documents may have different DTDs in the XML case. The following list describes the specifics for each type of node.

TheownerElementattribute is set tonulland thespecifiedflag is set totrueon the generatedAttr. Thedescendantsof the sourceAttrare recursively imported and the resulting nodes reassembled to form the corresponding subtree.

Note that thedeepparameter has no effect onAttrnodes; they always carry their children with them when imported.

If thedeepoption was set totrue, thedescendantsof the source element are recursively imported and the resulting nodes reassembled to form the corresponding subtree. Otherwise, this simply generates an emptyDocumentFragment.

Documentnodes cannot be imported.

DocumentTypenodes cannot be imported.

Specifiedattribute nodes of the source element are imported, and the generatedAttrnodes are attached to the generatedElement. Default attributes arenotcopied, though if the document being imported into defines default attributes for this element name, those are assigned. If theimportNodedeepparameter was set totrue, thedescendantsof the source element are recursively imported and the resulting nodes reassembled to form the corresponding subtree.

Entitynodes can be imported, however in the current release of the DOM theDocumentTypeis readonly. Ability to add these imported nodes to aDocumentTypewill be considered for addition to a future release of the DOM.

On import, thepublicId,systemId, andnotationNameattributes are copied. If adeepimport is requested, thedescendantsof the the sourceEntityare recursively imported and the resulting nodes reassembled to form the corresponding subtree.

Only theEntityReferenceitself is copied, even if adeepimport is requested, since the source and destination documents might have defined the entity differently. If the document being imported into provides a definition for this entity name, its value is assigned.

Notationnodes can be imported, however in the current release of the DOM theDocumentTypeis readonly. Ability to add these imported nodes to aDocumentTypewill be considered for addition to a future release of the DOM.

On import, thepublicIdandsystemIdattributes are copied.

Note that thedeepparameter has no effect onNotationnodes since they never have any children.

The imported node copies itstargetanddatavalues from those of the source node.

These three types of nodes inheriting fromCharacterDatacopy theirdataandlengthattributes from those of the source node.

The node to import.

Iftrue, recursively import the subtree under the specified node; iffalse, import only the node itself, as explained above. This has no effect onAttr,EntityReference, andNotationnodes.

The imported node that belongs to thisDocument.

NOT_SUPPORTED_ERR: Raised if the type of node being imported is not supported.

Creates an element of the given qualified name and namespace URI. HTML-only DOM implementations do not need to implement this method.

Thenamespace URIof the element to create.

Thequalified nameof the element type to instantiate.

A newElementobject with the following attributes:

AttributeValue
Node.nodeNamequalifiedName
Node.namespaceURInamespaceURI
Node.prefixprefix, extracted fromqualifiedName, ornullif there is no prefix
Node.localNamelocal name, extracted fromqualifiedName
Element.tagNamequalifiedName

INVALID_CHARACTER_ERR: Raised if the specified qualified name contains an illegal character.

NAMESPACE_ERR: Raised if thequalifiedNameis malformed, if thequalifiedNamehas a prefix and thenamespaceURIisnull, or if thequalifiedNamehas a prefix that is "xml" and thenamespaceURIis different from "".

Creates an attribute of the given qualified name and namespace URI. HTML-only DOM implementations do not need to implement this method.

Thenamespace URIof the attribute to create.

Thequalified nameof the attribute to instantiate.

A newAttrobject with the following attributes:

AttributeValue
Node.nodeNamequalifiedName
Node.namespaceURInamespaceURI
Node.prefixprefix, extracted fromqualifiedName, ornullif there is no prefix
Node.localNamelocal name, extracted fromqualifiedName
Attr.namequalifiedName
Node.nodeValuethe empty string

INVALID_CHARACTER_ERR: Raised if the specified qualified name contains an illegal character.

NAMESPACE_ERR: Raised if thequalifiedNameis malformed, if thequalifiedNamehas a prefix and thenamespaceURIisnull, if thequalifiedNamehas a prefix that is "xml" and thenamespaceURIis different from "", or if thequalifiedNameis "xmlns" and thenamespaceURIis different from "".

Returns aNodeListof all theElementswith a givenlocal nameand namespace URI in the order in which they are encountered in a preorder traversal of theDocumenttree.

Thenamespace URIof the elements to match on. The special value "*" matches all namespaces.

Thelocal nameof the elements to match on. The special value "*" matches all local names.

A newNodeListobject containing all the matchedElements.

Returns theElementwhoseIDis given byelementId. If no such element exists, returnsnull. Behavior is not defined if more than one element has thisID.

The DOM implementation must have information that says which attributes are of type ID. Attributes with the name "ID" are not of type ID unless so defined. Implementations that do not know whether attributes are of type ID or not are expected to returnnull.

The uniqueidvalue for an element.

The matching element.

+

TheNodeinterface is the primary datatype for the entire Document Object Model. It represents a single node in the document tree. While all objects implementing theNodeinterface expose methods for dealing with children, not all objects implementing theNodeinterface may have children. For example,Textnodes may not have children, and adding children to such nodes results in aDOMExceptionbeing raised.

The attributesnodeName,nodeValueandattributesare included as a mechanism to get at node information without casting down to the specific derived interface. In cases where there is no obvious mapping of these attributes for a specificnodeType(e.g.,nodeValuefor anElementorattributesfor aComment), this returnsnull. Note that the specialized interfaces may contain additional and more convenient mechanisms to get and set the relevant information.

An integer indicating which type of node this is.

Numeric codes up to 200 are reserved to W3C for possible future use.

The node is anElement.

The node is anAttr.

The node is aTextnode.

The node is aCDATASection.

The node is anEntityReference.

The node is anEntity.

The node is aProcessingInstruction.

The node is aComment.

The node is aDocument.

The node is aDocumentType.

The node is aDocumentFragment.

The node is aNotation.

The values ofnodeName,nodeValue, andattributesvary according to the node type as follows:
InterfacenodeNamenodeValueattributes
Attrname of attributevalue of attributenull
CDATASection#cdata-sectioncontent of the CDATA Sectionnull
Comment#commentcontent of the commentnull
Document#documentnullnull
DocumentFragment#document-fragmentnullnull
DocumentTypedocument type namenullnull
Elementtag namenullNamedNodeMap
Entityentity namenullnull
EntityReferencename of entity referencednullnull
Notationnotation namenullnull
ProcessingInstructiontargetentire content excluding the targetnull
Text#textcontent of the text nodenull

The name of this node, depending on its type; see the table above.

The value of this node, depending on its type; see the table above. When it is defined to benull, setting it has no effect.

NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.

DOMSTRING_SIZE_ERR: Raised when it would return more characters than fit in aDOMStringvariable on the implementation platform.

A code representing the type of the underlying object, as defined above.

Theparentof this node. All nodes, exceptAttr,Document,DocumentFragment,Entity, andNotationmay have a parent. However, if a node has just been created and not yet added to the tree, or if it has been removed from the tree, this isnull.

ANodeListthat contains all children of this node. If there are no children, this is aNodeListcontaining no nodes.

The first child of this node. If there is no such node, this returnsnull.

The last child of this node. If there is no such node, this returnsnull.

The node immediately preceding this node. If there is no such node, this returnsnull.

The node immediately following this node. If there is no such node, this returnsnull.

ANamedNodeMapcontaining the attributes of this node (if it is anElement) ornullotherwise.

TheDocumentobject associated with this node. This is also theDocumentobject used to create new nodes. When this node is aDocumentor aDocumentTypewhich is not used with anyDocumentyet, this isnull.

Inserts the nodenewChildbefore the existing child noderefChild. IfrefChildisnull, insertnewChildat the end of the list of children.

IfnewChildis aDocumentFragmentobject, all of its children are inserted, in the same order, beforerefChild. If thenewChildis already in the tree, it is first removed.

The node to insert.

The reference node, i.e., the node before which the new node must be inserted.

The node being inserted.

HIERARCHY_REQUEST_ERR: Raised if this node is of a type that does not allow children of the type of thenewChildnode, or if the node to insert is one of this node'sancestors.

WRONG_DOCUMENT_ERR: Raised ifnewChildwas created from a different document than the one that created this node.

NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly or if the parent of the node being inserted is readonly.

NOT_FOUND_ERR: Raised ifrefChildis not a child of this node.

Replaces the child nodeoldChildwithnewChildin the list of children, and returns theoldChildnode.

IfnewChildis aDocumentFragmentobject,oldChildis replaced by all of theDocumentFragmentchildren, which are inserted in the same order. If thenewChildis already in the tree, it is first removed.

The new node to put in the child list.

The node being replaced in the list.

The node replaced.

HIERARCHY_REQUEST_ERR: Raised if this node is of a type that does not allow children of the type of thenewChildnode, or if the node to put in is one of this node'sancestors.

WRONG_DOCUMENT_ERR: Raised ifnewChildwas created from a different document than the one that created this node.

NO_MODIFICATION_ALLOWED_ERR: Raised if this node or the parent of the new node is readonly.

NOT_FOUND_ERR: Raised ifoldChildis not a child of this node.

Removes the child node indicated byoldChildfrom the list of children, and returns it.

The node being removed.

The node removed.

NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.

NOT_FOUND_ERR: Raised ifoldChildis not a child of this node.

Adds the nodenewChildto the end of the list of children of this node. If thenewChildis already in the tree, it is first removed.

The node to add.

If it is aDocumentFragmentobject, the entire contents of the document fragment are moved into the child list of this node

The node added.

HIERARCHY_REQUEST_ERR: Raised if this node is of a type that does not allow children of the type of thenewChildnode, or if the node to append is one of this node'sancestors.

WRONG_DOCUMENT_ERR: Raised ifnewChildwas created from a different document than the one that created this node.

NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.

Returns whether this node has any children.

trueif this node has any children,falseotherwise.

Returns a duplicate of this node, i.e., serves as a generic copy constructor for nodes. The duplicate node has no parent; (parentNodeisnull.).

Cloning anElementcopies all attributes and their values, including those generated by the XML processor to represent defaulted attributes, but this method does not copy any text it contains unless it is a deep clone, since the text is contained in a childTextnode. Cloning anAttributedirectly, as opposed to be cloned as part of anElementcloning operation, returns a specified attribute (specifiedistrue). Cloning any other type of node simply returns a copy of this node.

Note that cloning an immutable subtree results in a mutable copy, but the children of anEntityReferenceclone arereadonly. In addition, clones of unspecifiedAttrnodes are specified. And, cloningDocument,DocumentType,Entity, andNotationnodes is implementation dependent.

Iftrue, recursively clone the subtree under the specified node; iffalse, clone only the node itself (and its attributes, if it is anElement).

The duplicate node.

Puts allTextnodes in the full depth of the sub-tree underneath thisNode, including attribute nodes, into a "normal" form where only structure (e.g., elements, comments, processing instructions, CDATA sections, and entity references) separatesTextnodes, i.e., there are neither adjacentTextnodes nor emptyTextnodes. This can be used to ensure that the DOM view of a document is the same as if it were saved and re-loaded, and is useful when operations (such as XPointerlookups) that depend on a particular document tree structure are to be used.

In cases where the document containsCDATASections, the normalize operation alone may not be sufficient, since XPointers do not differentiate betweenTextnodes andCDATASectionnodes.

Tests whether the DOM implementation implements a specific feature and that feature is supported by this node.

The name of the feature to test. This is the same name which can be passed to the methodhasFeatureonDOMImplementation.

This is the version number of the feature to test. In Level 2, version 1, this is the string "2.0". If the version is not specified, supporting any version of the feature will cause the method to returntrue.

Returnstrueif the specified feature is supported on this node,falseotherwise.

Thenamespace URIof this node, ornullif it is unspecified.

This is not a computed value that is the result of a namespace lookup based on an examination of the namespace declarations in scope. It is merely the namespace URI given at creation time.

For nodes of any type other thanELEMENT_NODEandATTRIBUTE_NODEand nodes created with a DOM Level 1 method, such ascreateElementfrom theDocumentinterface, this is alwaysnull.

Per theNamespaces in XMLSpecificationan attribute does not inherit its namespace from the element it is attached to. If an attribute is not explicitly given a namespace, it simply has no namespace.

Thenamespace prefixof this node, ornullif it is unspecified.

Note that setting this attribute, when permitted, changes thenodeNameattribute, which holds thequalified name, as well as thetagNameandnameattributes of theElementandAttrinterfaces, when applicable.

Note also that changing the prefix of an attribute that is known to have a default value, does not make a new attribute with the default value and the original prefix appear, since thenamespaceURIandlocalNamedo not change.

For nodes of any type other thanELEMENT_NODEandATTRIBUTE_NODEand nodes created with a DOM Level 1 method, such ascreateElementfrom theDocumentinterface, this is alwaysnull.

INVALID_CHARACTER_ERR: Raised if the specified prefix contains an illegal character.

NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.

NAMESPACE_ERR: Raised if the specifiedprefixis malformed, if thenamespaceURIof this node isnull, if the specified prefix is "xml" and thenamespaceURIof this node is different from "", if this node is an attribute and the specified prefix is "xmlns" and thenamespaceURIof this node is different from "", or if this node is an attribute and thequalifiedNameof this node is "xmlns".

Returns the local part of thequalified nameof this node.

For nodes of any type other thanELEMENT_NODEandATTRIBUTE_NODEand nodes created with a DOM Level 1 method, such ascreateElementfrom theDocumentinterface, this is alwaysnull.

Returns whether this node (if it is an element) has any attributes.

trueif this node has any attributes,falseotherwise.

+

TheNodeListinterface provides the abstraction of an ordered collection of nodes, without defining or constraining how this collection is implemented.NodeListobjects in the DOM arelive.

The items in theNodeListare accessible via an integral index, starting from 0.

Returns theindexth item in the collection. Ifindexis greater than or equal to the number of nodes in the list, this returnsnull.

Index into the collection.

The node at theindexth position in theNodeList, ornullif that is not a valid index.

The number of nodes in the list. The range of valid child node indices is 0 tolength-1inclusive.

+

Objects implementing theNamedNodeMapinterface are used to represent collections of nodes that can be accessed by name. Note thatNamedNodeMapdoes not inherit fromNodeList;NamedNodeMapsare not maintained in any particular order. Objects contained in an object implementingNamedNodeMapmay also be accessed by an ordinal index, but this is simply to allow convenient enumeration of the contents of aNamedNodeMap, and does not imply that the DOM specifies an order to these Nodes.

NamedNodeMapobjects in the DOM arelive.

Retrieves a node specified by name.

ThenodeNameof a node to retrieve.

ANode(of any type) with the specifiednodeName, ornullif it does not identify any node in this map.

Adds a node using itsnodeNameattribute. If a node with that name is already present in this map, it is replaced by the new one.

As thenodeNameattribute is used to derive the name which the node must be stored under, multiple nodes of certain types (those that have a "special" string value) cannot be stored as the names would clash. This is seen as preferable to allowing nodes to be aliased.

A node to store in this map. The node will later be accessible using the value of itsnodeNameattribute.

If the newNodereplaces an existing node the replacedNodeis returned, otherwisenullis returned.

WRONG_DOCUMENT_ERR: Raised ifargwas created from a different document than the one that created this map.

NO_MODIFICATION_ALLOWED_ERR: Raised if this map is readonly.

INUSE_ATTRIBUTE_ERR: Raised ifargis anAttrthat is already an attribute of anotherElementobject. The DOM user must explicitly cloneAttrnodes to re-use them in other elements.

HIERARCHY_REQUEST_ERR: Raised if an attempt is made to add a node doesn't belong in this NamedNodeMap. Examples would include trying to insert something other than an Attr node into an Element's map of attributes, or a non-Entity node into the DocumentType's map of Entities

Removes a node specified by name. When this map contains the attributes attached to an element, if the removed attribute is known to have a default value, an attribute immediately appears containing the default value as well as the corresponding namespace URI, local name, and prefix when applicable.

ThenodeNameof the node to remove.

The node removed from this map if a node with such a name exists.

NOT_FOUND_ERR: Raised if there is no node namednamein this map.

NO_MODIFICATION_ALLOWED_ERR: Raised if this map is readonly.

Returns theindexth item in the map. Ifindexis greater than or equal to the number of nodes in this map, this returnsnull.

Index into this map.

The node at theindexth position in the map, ornullif that is not a valid index.

The number of nodes in this map. The range of valid child node indices is0tolength-1inclusive.

Retrieves a node specified by local name and namespace URI. HTML-only DOM implementations do not need to implement this method.

Thenamespace URIof the node to retrieve.

Thelocal nameof the node to retrieve.

ANode(of any type) with the specified local name and namespace URI, ornullif they do not identify any node in this map.

Adds a node using itsnamespaceURIandlocalName. If a node with that namespace URI and that local name is already present in this map, it is replaced by the new one.

HTML-only DOM implementations do not need to implement this method.

A node to store in this map. The node will later be accessible using the value of itsnamespaceURIandlocalNameattributes.

If the newNodereplaces an existing node the replacedNodeis returned, otherwisenullis returned.

WRONG_DOCUMENT_ERR: Raised ifargwas created from a different document than the one that created this map.

NO_MODIFICATION_ALLOWED_ERR: Raised if this map is readonly.

INUSE_ATTRIBUTE_ERR: Raised ifargis anAttrthat is already an attribute of anotherElementobject. The DOM user must explicitly cloneAttrnodes to re-use them in other elements.

HIERARCHY_REQUEST_ERR: Raised if an attempt is made to add a node doesn't belong in this NamedNodeMap. Examples would include trying to insert something other than an Attr node into an Element's map of attributes, or a non-Entity node into the DocumentType's map of Entities

Removes a node specified by local name and namespace URI. A removed attribute may be known to have a default value when this map contains the attributes attached to an element, as returned by the attributes attribute of theNodeinterface. If so, an attribute immediately appears containing the default value as well as the corresponding namespace URI, local name, and prefix when applicable.

HTML-only DOM implementations do not need to implement this method.

Thenamespace URIof the node to remove.

Thelocal nameof the node to remove.

The node removed from this map if a node with such a local name and namespace URI exists.

NOT_FOUND_ERR: Raised if there is no node with the specifiednamespaceURIandlocalNamein this map.

NO_MODIFICATION_ALLOWED_ERR: Raised if this map is readonly.

+

TheCharacterDatainterface extends Node with a set of attributes and methods for accessing character data in the DOM. For clarity this set is defined here rather than on each object that uses these attributes and methods. No DOM objects correspond directly toCharacterData, thoughTextand others do inherit the interface from it. Alloffsetsin this interface start from0.

As explained in theDOMStringinterface, text strings in the DOM are represented in UTF-16, i.e. as a sequence of 16-bit units. In the following, the term16-bit unitsis used whenever necessary to indicate that indexing on CharacterData is done in 16-bit units.

The character data of the node that implements this interface. The DOM implementation may not put arbitrary limits on the amount of data that may be stored in aCharacterDatanode. However, implementation limits may mean that the entirety of a node's data may not fit into a singleDOMString. In such cases, the user may callsubstringDatato retrieve the data in appropriately sized pieces.

NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.

DOMSTRING_SIZE_ERR: Raised when it would return more characters than fit in aDOMStringvariable on the implementation platform.

The number of16-bit unitsthat are available throughdataand thesubstringDatamethod below. This may have the value zero, i.e.,CharacterDatanodes may be empty.

Extracts a range of data from the node.

Start offset of substring to extract.

The number of 16-bit units to extract.

The specified substring. If the sum ofoffsetandcountexceeds thelength, then all 16-bit units to the end of the data are returned.

INDEX_SIZE_ERR: Raised if the specifiedoffsetis negative or greater than the number of 16-bit units indata, or if the specifiedcountis negative.

DOMSTRING_SIZE_ERR: Raised if the specified range of text does not fit into aDOMString.

Append the string to the end of the character data of the node. Upon success,dataprovides access to the concatenation ofdataand theDOMStringspecified.

TheDOMStringto append.

NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.

Insert a string at the specified16-bit unitoffset.

The character offset at which to insert.

TheDOMStringto insert.

INDEX_SIZE_ERR: Raised if the specifiedoffsetis negative or greater than the number of 16-bit units indata.

NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.

Remove a range of16-bit unitsfrom the node. Upon success,dataandlengthreflect the change.

The offset from which to start removing.

The number of 16-bit units to delete. If the sum ofoffsetandcountexceedslengththen all 16-bit units fromoffsetto the end of the data are deleted.

INDEX_SIZE_ERR: Raised if the specifiedoffsetis negative or greater than the number of 16-bit units indata, or if the specifiedcountis negative.

NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.

Replace the characters starting at the specified16-bit unitoffset with the specified string.

The offset from which to start replacing.

The number of 16-bit units to replace. If the sum ofoffsetandcountexceedslength, then all 16-bit units to the end of the data are replaced; (i.e., the effect is the same as aremovemethod call with the same range, followed by anappendmethod invocation).

TheDOMStringwith which the range must be replaced.

INDEX_SIZE_ERR: Raised if the specifiedoffsetis negative or greater than the number of 16-bit units indata, or if the specifiedcountis negative.

NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.

+

TheAttrinterface represents an attribute in anElementobject. Typically the allowable values for the attribute are defined in a document type definition.

Attrobjects inherit theNodeinterface, but since they are not actually child nodes of the element they describe, the DOM does not consider them part of the document tree. Thus, theNodeattributesparentNode,previousSibling, andnextSiblinghave anullvalue forAttrobjects. The DOM takes the view that attributes are properties of elements rather than having a separate identity from the elements they are associated with; this should make it more efficient to implement such features as default attributes associated with all elements of a given type. Furthermore,Attrnodes may not be immediate children of aDocumentFragment. However, they can be associated withElementnodes contained within aDocumentFragment. In short, users and implementors of the DOM need to be aware thatAttrnodes have some things in common with other objects inheriting theNodeinterface, but they also are quite distinct.

The attribute's effective value is determined as follows: if this attribute has been explicitly assigned any value, that value is the attribute's effective value; otherwise, if there is a declaration for this attribute, and that declaration includes a default value, then that default value is the attribute's effective value; otherwise, the attribute does not exist on this element in the structure model until it has been explicitly added. Note that thenodeValueattribute on theAttrinstance can also be used to retrieve the string version of the attribute's value(s).

In XML, where the value of an attribute can contain entity references, the child nodes of theAttrnode may be eitherTextorEntityReferencenodes (when these are in use; see the description ofEntityReferencefor discussion). Because the DOM Core is not aware of attribute types, it treats all attribute values as simple strings, even if the DTD or schema declares them as havingtokenizedtypes.

Returns the name of this attribute.

If this attribute was explicitly given a value in the original document, this istrue; otherwise, it isfalse. Note that the implementation is in charge of this attribute, not the user. If the user changes the value of the attribute (even if it ends up having the same value as the default value) then thespecifiedflag is automatically flipped totrue. To re-specify the attribute as the default value from the DTD, the user must delete the attribute. The implementation will then make a new attribute available withspecifiedset tofalseand the default value (if one exists).

In summary:

If the attribute has an assigned value in the document thenspecifiedistrue, and the value is the assigned value.

If the attribute has no assigned value in the document and has a default value in the DTD, thenspecifiedisfalse, and the value is the default value in the DTD.

If the attribute has no assigned value in the document and has a value of #IMPLIED in the DTD, then the attribute does not appear in the structure model of the document.

If theownerElementattribute isnull(i.e. because it was just created or was set tonullby the various removal and cloning operations)specifiedistrue.

On retrieval, the value of the attribute is returned as a string. Character and general entity references are replaced with their values. See also the methodgetAttributeon theElementinterface.

On setting, this creates aTextnode 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. See also the methodsetAttributeon theElementinterface.

NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.

TheElementnode this attribute is attached to ornullif this attribute is not in use.

+

TheElementinterface represents anelementin an HTML or XML document. Elements may have attributes associated with them; since theElementinterface inherits fromNode, the genericNodeinterface attributeattributesmay be used to retrieve the set of all attributes for an element. There are methods on theElementinterface to retrieve either anAttrobject by name or an attribute value by name. In XML, where an attribute value may contain entity references, anAttrobject should be retrieved to examine the possibly fairly complex sub-tree representing the attribute value. On the other hand, in HTML, where all attributes have simple string values, methods to directly access an attribute value can safely be used as aconvenience.

In DOM Level 2, the methodnormalizeis inherited from theNodeinterface where it was moved.

The name of the element. For example, in:<elementExample id="demo"> ... </elementExample> ,tagNamehas the value"elementExample". Note that this is case-preserving in XML, as are all of the operations of the DOM. The HTML DOM returns thetagNameof an HTML element in the canonical uppercase form, regardless of the case in the source HTML document.

Retrieves an attribute value by name.

The name of the attribute to retrieve.

TheAttrvalue as a string, or the empty string if that attribute does not have a specified or default value.

Adds a new attribute. If an attribute with that name is already present in the element, its value is changed to be that of the value parameter. This value is a simple string; it is not parsed as it is being set. So any markup (such as syntax to be recognized as an entity reference) is treated as literal text, and needs to be appropriately escaped by the implementation when it is written out. In order to assign an attribute value that contains entity references, the user must create anAttrnode plus anyTextandEntityReferencenodes, build the appropriate subtree, and usesetAttributeNodeto assign it as the value of an attribute.

To set an attribute with a qualified name and namespace URI, use thesetAttributeNSmethod.

The name of the attribute to create or alter.

Value to set in string form.

INVALID_CHARACTER_ERR: Raised if the specified name contains an illegal character.

NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.

Removes an attribute by name. If the removed attribute is known to have a default value, an attribute immediately appears containing the default value as well as the corresponding namespace URI, local name, and prefix when applicable.

To remove an attribute by local name and namespace URI, use theremoveAttributeNSmethod.

The name of the attribute to remove.

NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.

Retrieves an attribute node by name.

To retrieve an attribute node by qualified name and namespace URI, use thegetAttributeNodeNSmethod.

The name (nodeName) of the attribute to retrieve.

TheAttrnode with the specified name (nodeName) ornullif there is no such attribute.

Adds a new attribute node. If an attribute with that name (nodeName) is already present in the element, it is replaced by the new one.

To add a new attribute node with a qualified name and namespace URI, use thesetAttributeNodeNSmethod.

TheAttrnode to add to the attribute list.

If thenewAttrattribute replaces an existing attribute, the replacedAttrnode is returned, otherwisenullis returned.

WRONG_DOCUMENT_ERR: Raised ifnewAttrwas created from a different document than the one that created the element.

NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.

INUSE_ATTRIBUTE_ERR: Raised ifnewAttris already an attribute of anotherElementobject. The DOM user must explicitly cloneAttrnodes to re-use them in other elements.

Removes the specified attribute node. If the removedAttrhas a default value it is immediately replaced. The replacing attribute has the same namespace URI and local name, as well as the original prefix, when applicable.

TheAttrnode to remove from the attribute list.

TheAttrnode that was removed.

NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.

NOT_FOUND_ERR: Raised ifoldAttris not an attribute of the element.

Returns aNodeListof alldescendantElementswith a given tag name, in the order in which they are encountered in a preorder traversal of thisElementtree.

The name of the tag to match on. The special value "*" matches all tags.

A list of matchingElementnodes.

Retrieves an attribute value by local name and namespace URI. HTML-only DOM implementations do not need to implement this method.

Thenamespace URIof the attribute to retrieve.

Thelocal nameof the attribute to retrieve.

TheAttrvalue as a string, or the empty string if that attribute does not have a specified or default value.

Adds a new attribute. If an attribute with the same local name and namespace URI is already present on the element, its prefix is changed to be the prefix part of thequalifiedName, and its value is changed to be thevalueparameter. This value is a simple string; it is not parsed as it is being set. So any markup (such as syntax to be recognized as an entity reference) is treated as literal text, and needs to be appropriately escaped by the implementation when it is written out. In order to assign an attribute value that contains entity references, the user must create anAttrnode plus anyTextandEntityReferencenodes, build the appropriate subtree, and usesetAttributeNodeNSorsetAttributeNodeto assign it as the value of an attribute.

HTML-only DOM implementations do not need to implement this method.

Thenamespace URIof the attribute to create or alter.

Thequalified nameof the attribute to create or alter.

The value to set in string form.

INVALID_CHARACTER_ERR: Raised if the specified qualified name contains an illegal character.

NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.

NAMESPACE_ERR: Raised if thequalifiedNameis malformed, if thequalifiedNamehas a prefix and thenamespaceURIisnull, if thequalifiedNamehas a prefix that is "xml" and thenamespaceURIis different from "", or if thequalifiedNameis "xmlns" and thenamespaceURIis different from "".

Removes an attribute by local name and namespace URI. If the removed attribute has a default value it is immediately replaced. The replacing attribute has the same namespace URI and local name, as well as the original prefix.

HTML-only DOM implementations do not need to implement this method.

Thenamespace URIof the attribute to remove.

Thelocal nameof the attribute to remove.

NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.

Retrieves anAttrnode by local name and namespace URI. HTML-only DOM implementations do not need to implement this method.

Thenamespace URIof the attribute to retrieve.

Thelocal nameof the attribute to retrieve.

TheAttrnode with the specified attribute local name and namespace URI ornullif there is no such attribute.

Adds a new attribute. If an attribute with that local name and that namespace URI is already present in the element, it is replaced by the new one.

HTML-only DOM implementations do not need to implement this method.

TheAttrnode to add to the attribute list.

If thenewAttrattribute replaces an existing attribute with the samelocal nameandnamespace URI, the replacedAttrnode is returned, otherwisenullis returned.

WRONG_DOCUMENT_ERR: Raised ifnewAttrwas created from a different document than the one that created the element.

NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.

INUSE_ATTRIBUTE_ERR: Raised ifnewAttris already an attribute of anotherElementobject. The DOM user must explicitly cloneAttrnodes to re-use them in other elements.

Returns aNodeListof all thedescendantElementswith a given local name and namespace URI in the order in which they are encountered in a preorder traversal of thisElementtree.

HTML-only DOM implementations do not need to implement this method.

Thenamespace URIof the elements to match on. The special value "*" matches all namespaces.

Thelocal nameof the elements to match on. The special value "*" matches all local names.

A newNodeListobject containing all the matchedElements.

Returnstruewhen an attribute with a given name is specified on this element or has a default value,falseotherwise.

The name of the attribute to look for.

trueif an attribute with the given name is specified on this element or has a default value,falseotherwise.

Returnstruewhen an attribute with a given local name and namespace URI is specified on this element or has a default value,falseotherwise. HTML-only DOM implementations do not need to implement this method.

Thenamespace URIof the attribute to look for.

Thelocal nameof the attribute to look for.

trueif an attribute with the given local name and namespace URI is specified or has a default value on this element,falseotherwise.

+

TheTextinterface inherits fromCharacterDataand represents the textual content (termedin XML) of anElementorAttr. If there is no markup inside an element's content, the text is contained in a single object implementing theTextinterface that is the only child of the element. If there is markup, it is parsed into theinformation items(elements, comments, etc.) andTextnodes that form the list of children of the element.

When a document is first made available via the DOM, there is only oneTextnode for each block of text. Users may create adjacentTextnodes that represent the contents of a given element without any intervening markup, but should be aware that there is no way to represent the separations between these nodes in XML or HTML, so they will not (in general) persist between DOM editing sessions. Thenormalize()method onNodemerges any such adjacentTextobjects into a single node for each block of text.

Breaks this node into two nodes at the specifiedoffset, keeping both in the tree assiblings. After being split, this node will contain all the content up to theoffsetpoint. A new node of the same type, which contains all the content at and after theoffsetpoint, is returned. If the original node had a parent node, the new node is inserted as the nextsiblingof the original node. When theoffsetis equal to the length of this node, the new node has no data.

The16-bit unitoffset at which to split, starting from0.

The new node, of the same type as this node.

INDEX_SIZE_ERR: Raised if the specified offset is negative or greater than the number of 16-bit units indata.

NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.

+

This interface inherits fromCharacterDataand represents the content of a comment, i.e., all the characters between the starting '<!--' and ending '-->'. Note that this is the definition of a comment in XML, and, in practice, HTML, although some HTML tools may implement the full SGML comment structure.

+

CDATA sections are used to escape blocks of text containing characters that would otherwise be regarded as markup. The only delimiter that is recognized in a CDATA section is the "]]>" string that ends the CDATA section. CDATA sections cannot be nested. Their primary purpose is for including material such as XML fragments, without needing to escape all the delimiters.

TheDOMStringattribute of theTextnode holds the text that is contained by the CDATA section. Note that thismaycontain characters that need to be escaped outside of CDATA sections and that, depending on the character encoding ("charset") chosen for serialization, it may be impossible to write out some characters as part of a CDATA section.

TheCDATASectioninterface inherits from theCharacterDatainterface through theTextinterface. AdjacentCDATASectionnodes are not merged by use of thenormalizemethod of theNodeinterface.

Because no markup is recognized within aCDATASection, character numeric references cannot be used as an escape mechanism when serializing. Therefore, action needs to be taken when serializing aCDATASectionwith a character encoding where some of the contained characters cannot be represented. Failure to do so would not produce well-formed XML.

One potential solution in the serialization process is to end the CDATA section before the character, output the character using a character reference or entity reference, and open a new CDATA section for any further characters in the text node. Note, however, that some code conversion libraries at the time of writing do not return an error or exception when a character is missing from the encoding, making the task of ensuring that data is not corrupted on serialization more difficult.

+

EachDocumenthas adoctypeattribute whose value is eithernullor aDocumentTypeobject. TheDocumentTypeinterface in the DOM Core provides an interface to the list of entities that are defined for the document, and little else because the effect of namespaces and the various XML schema efforts on DTD representation are not clearly understood as of this writing.

The DOM Level 2 doesn't support editingDocumentTypenodes.

The name of DTD; i.e., the name immediately following theDOCTYPEkeyword.

ANamedNodeMapcontaining the general entities, both external and internal, declared in the DTD. Parameter entities are not contained. Duplicates are discarded. For example in:<!DOCTYPE ex SYSTEM "ex.dtd" [ <!ENTITY foo "foo"> <!ENTITY bar "bar"> <!ENTITY bar "bar2"> <!ENTITY % baz "baz"> ]> <ex/>the interface provides access tofooand the first declaration ofbarbut not the second declaration ofbarorbaz. Every node in this map also implements theEntityinterface.

The DOM Level 2 does not support editing entities, thereforeentitiescannot be altered in any way.

ANamedNodeMapcontaining the notations declared in the DTD. Duplicates are discarded. Every node in this map also implements theNotationinterface.

The DOM Level 2 does not support editing notations, thereforenotationscannot be altered in any way.

The public identifier of the external subset.

The system identifier of the external subset.

The internal subset as a string.

The actual content returned depends on how much information is available to the implementation. This may vary depending on various parameters, including the XML processor used to build the document.

+

This interface represents a notation declared in the DTD. A notation either declares, by name, the format of an unparsed entity (seeof the XML 1.0 specification), or is used for formal declaration of processing instruction targets (seeof the XML 1.0 specification). ThenodeNameattribute inherited fromNodeis set to the declared name of the notation.

The DOM Level 1 does not support editingNotationnodes; they are thereforereadonly.

ANotationnode does not have any parent.

The public identifier of this notation. If the public identifier was not specified, this isnull.

The system identifier of this notation. If the system identifier was not specified, this isnull.

+

This interface represents an entity, either parsed or unparsed, in an XML document. Note that this models the entity itselfnotthe entity declaration.Entitydeclaration modeling has been left for a later Level of the DOM specification.

ThenodeNameattribute that is inherited fromNodecontains the name of the entity.

An XML processor may choose to completely expand entities before the structure model is passed to the DOM; in this case there will be noEntityReferencenodes in the document tree.

XML does not mandate that a non-validating XML processor read and process entity declarations made in the external subset or declared in external parameter entities. This means that parsed entities declared in the external subset need not be expanded by some classes of applications, and that the replacement value of the entity may not be available. When the replacement value is available, the correspondingEntitynode's child list represents the structure of that replacement text. Otherwise, the child list is empty.

The DOM Level 2 does not support editingEntitynodes; if a user wants to make changes to the contents of anEntity, every relatedEntityReferencenode has to be replaced in the structure model by a clone of theEntity's contents, and then the desired changes must be made to each of those clones instead.Entitynodes and all theirdescendantsarereadonly.

AnEntitynode does not have any parent.

If the entity contains an unboundnamespace prefix, thenamespaceURIof the corresponding node in theEntitynode subtree isnull. The same is true forEntityReferencenodes that refer to this entity, when they are created using thecreateEntityReferencemethod of theDocumentinterface. The DOM Level 2 does not support any mechanism to resolve namespace prefixes.

The public identifier associated with the entity, if specified. If the public identifier was not specified, this isnull.

The system identifier associated with the entity, if specified. If the system identifier was not specified, this isnull.

For unparsed entities, the name of the notation for the entity. For parsed entities, this isnull.

+

EntityReferenceobjects may be inserted into the structure model when an entity reference is in the source document, or when the user wishes to insert an entity reference. Note that character references and references to predefined entities are considered to be expanded by the HTML or XML processor so that characters are represented by their Unicode equivalent rather than by an entity reference. Moreover, the XML processor may completely expand references to entities while building the structure model, instead of providingEntityReferenceobjects. If it does provide such objects, then for a givenEntityReferencenode, it may be that there is noEntitynode representing the referenced entity. If such anEntityexists, then the subtree of theEntityReferencenode is in general a copy of theEntitynode subtree. However, this may not be true when an entity contains an unboundnamespace prefix. In such a case, because the namespace prefix resolution depends on where the entity reference is, thedescendantsof theEntityReferencenode may be bound to differentnamespace URIs.

As forEntitynodes,EntityReferencenodes and all theirdescendantsarereadonly.

+

TheProcessingInstructioninterface represents a "processing instruction", used in XML as a way to keep processor-specific information in the text of the document.

The target of this processing instruction. XML defines this as being the firsttokenfollowing the markup that begins the processing instruction.

The content of this processing instruction. This is from the first non white space character after the target to the character immediately preceding the?>.

NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.

+

Extensions to a language's native String class or interface

Returns the UTF-16 offset that corresponds to a UTF-32 offset. Used for random access.

You can always round-trip from a UTF-32 offset to a UTF-16 offset and back. You can round-trip from a UTF-16 offset to a UTF-32 offset and back if and only if the offset16 is not in the middle of a surrogate pair. Unmatched surrogates count as a single UTF-16 value.

UTF-32 offset.

UTF-16 offset

ifoffset32is out of bounds.

Returns the UTF-32 offset corresponding to a UTF-16 offset. Used for random access. To find the UTF-32 length of a string, use:len32 = findOffset32(source, source.length());

If the UTF-16 offset is into the middle of a surrogate pair, then the UTF-32 offset of theendof the pair is returned; that is, the index of the char after the end of the pair. You can always round-trip from a UTF-32 offset to a UTF-16 offset and back. You can round-trip from a UTF-16 offset to a UTF-32 offset and back if and only if the offset16 is not in the middle of a surrogate pair. Unmatched surrogates count as a single UTF-16 value.

UTF-16 offset

UTF-32 offset

if offset16 is out of bounds.

+
diff --git a/test/dom3-core-interface.xml b/test/dom3-core-interface.xml new file mode 100644 index 0000000..a8373a0 --- /dev/null +++ b/test/dom3-core-interface.xml @@ -0,0 +1,45 @@ + + + + +

DOM operations only raise exceptions in "exceptional" circumstances, i.e., when an operation is impossible to perform (either for logical reasons, because data is lost, or because the implementation has become unstable). In general, DOM methods return specific error values in ordinary processing situations, such as out-of-bound errors when usingNodeList.

Implementations should raise other exceptions under other circumstances. For example, implementations should raise an implementation-dependent exception if anullargument is passed whennullwas not expected.

Some languages and object systems do not support the concept of exceptions. For such systems, error conditions may be indicated using native error reporting mechanisms. For some bindings, for example, methods may return error codes similar to those listed in the corresponding method descriptions.

unsigned short
+

An integer indicating the type of error generated.

Other numeric codes are reserved for W3C for possible future use.

If index or size is negative, or greater than the allowed value.

If the specified range of text does not fit into aDOMString.

If anyNodeis inserted somewhere it doesn't belong.

If aNodeis used in a different document than the one that created it (that doesn't support it).

If an invalid or illegal character is specified, such as in an XML name.

If data is specified for aNodewhich does not support data.

If an attempt is made to modify an object where modifications are not allowed.

If an attempt is made to reference aNodein a context where it does not exist.

If the implementation does not support the requested type of object or operation.

If an attempt is made to add an attribute that is already in use elsewhere.

If an attempt is made to use an object that is not, or is no longer, usable.

If an invalid or illegal string is specified.

If an attempt is made to modify the type of the underlying object.

If an attempt is made to create or change an object in a way which is incorrect with regard to namespaces.

If a parameter or an operation is not supported by the underlying object.

If a call to a method such asinsertBeforeorremoveChildwould make theNodeinvalid with respect to"partial validity", this exception would be raised and the operation would not be done. This code is used in. Refer to this specification for further information.

If the type of an object is incompatible with the expected type of the parameter associated to the object.

+

TheDOMStringListinterface provides the abstraction of an ordered collection ofDOMStringvalues, without defining or constraining how this collection is implemented. The items in theDOMStringListare accessible via an integral index, starting from 0.

Returns theindexth item in the collection. Ifindexis greater than or equal to the number ofDOMStrings in the list, this returnsnull.

Index into the collection.

TheDOMStringat theindexth position in theDOMStringList, ornullif that is not a valid index.

The number ofDOMStrings in the list. The range of valid child node indices is 0 tolength-1inclusive.

Test if a string is part of thisDOMStringList.

The string to look for.

trueif the string has been found,falseotherwise.

+

TheNameListinterface provides the abstraction of an ordered collection of parallel pairs of name and namespace values (which could be null values), without defining or constraining how this collection is implemented. The items in theNameListare accessible via an integral index, starting from 0.

Returns theindexth name item in the collection.

Index into the collection.

The name at theindexth position in theNameList, ornullif there is no name for the specified index or if the index is out of range.

Returns theindexth namespaceURI item in the collection.

Index into the collection.

The namespace URI at theindexth position in theNameList, ornullif there is no name for the specified index or if the index is out of range.

The number of pairs (name and namespaceURI) in the list. The range of valid child node indices is 0 tolength-1inclusive.

Test if a name is part of thisNameList.

The name to look for.

trueif the name has been found,falseotherwise.

Test if the pair namespaceURI/name is part of thisNameList.

The namespace URI to look for.

The name to look for.

trueif the pair namespaceURI/name has been found,falseotherwise.

+

TheDOMImplementationListinterface provides the abstraction of an ordered collection of DOM implementations, without defining or constraining how this collection is implemented. The items in theDOMImplementationListare accessible via an integral index, starting from 0.

Returns theindexth item in the collection. Ifindexis greater than or equal to the number ofDOMImplementations in the list, this returnsnull.

Index into the collection.

TheDOMImplementationat theindexth position in theDOMImplementationList, ornullif that is not a valid index.

The number ofDOMImplementations in the list. The range of valid child node indices is 0 tolength-1inclusive.

+

This interface permits a DOM implementer to supply one or more implementations, based upon requested features and versions, as specified in. Each implementedDOMImplementationSourceobject is listed in the binding-specific list of available sources so that itsDOMImplementationobjects are made available.

A method to request the first DOM implementation that supports the specified features.

A string that specifies which features and versions are required. This is a space separated list in which each feature is specified by its name optionally followed by a space and a version number.

This method returns the first item of the list returned bygetDOMImplementationList.

As an example, the string"XML 3.0 Traversal +Events 2.0"will request a DOM implementation that supports the module "XML" for its 3.0 version, a module that support of the "Traversal" module for any version, and the module "Events" for its 2.0 version. The module "Events" must be accessible using the methodNode.getFeature()andDOMImplementation.getFeature().

The first DOM implementation that support the desired features, ornullif this source has none.

A method to request a list of DOM implementations that support the specified features and versions, as specified in.

A string that specifies which features and versions are required. This is a space separated list in which each feature is specified by its name optionally followed by a space and a version number. This is something like: "XML 3.0 Traversal +Events 2.0"

A list of DOM implementations that support the desired features.

+

TheDOMImplementationinterface provides a number of methods for performing operations that are independent of any particular instance of the document object model.

Test if the DOM implementation implements a specific feature and version, as specified in.

The name of the feature to test.

This is the version number of the feature to test.

trueif the feature is implemented in the specified version,falseotherwise.

Creates an emptyDocumentTypenode. Entity declarations and notations are not made available. Entity reference expansions and default attribute additions do not occur..

Thequalified nameof the document type to be created.

The external subset public identifier.

The external subset system identifier.

A newDocumentTypenode withNode.ownerDocumentset tonull.

INVALID_CHARACTER_ERR: Raised if the specified qualified name is not an XML name according to.

NAMESPACE_ERR: Raised if thequalifiedNameis malformed.

NOT_SUPPORTED_ERR: May be raised if the implementation does not support the feature "XML" and the language exposed through the Document does not support XML Namespaces (such as).

Creates a DOM Document object of the specified type with its document element.

Note that based on theDocumentTypegiven to create the document, the implementation may instantiate specializedDocumentobjects that support additional features than the "Core", such as "HTML". On the other hand, setting theDocumentTypeafter the document was created makes this very unlikely to happen. Alternatively, specializedDocumentcreation methods, such ascreateHTMLDocument, can be used to obtain specific types ofDocumentobjects.

Thenamespace URIof the document element to create ornull.

Thequalified nameof the document element to be created ornull.

The type of document to be created ornull.

Whendoctypeis notnull, itsNode.ownerDocumentattribute is set to the document being created.

A newDocumentobject with its document element. If theNamespaceURI,qualifiedName, anddoctypearenull, the returnedDocumentis empty with no document element.

INVALID_CHARACTER_ERR: Raised if the specified qualified name is not an XML name according to.

NAMESPACE_ERR: Raised if thequalifiedNameis malformed, if thequalifiedNamehas a prefix and thenamespaceURIisnull, or if thequalifiedNameisnulland thenamespaceURIis different fromnull, or if thequalifiedNamehas a prefix that is "xml" and thenamespaceURIis different from "http://www.w3.org/XML/1998/namespace", or if the DOM implementation does not support the"XML"feature but a non-null namespace URI was provided, since namespaces were defined by XML.

WRONG_DOCUMENT_ERR: Raised ifdoctypehas already been used with a different document or was created from a different implementation.

NOT_SUPPORTED_ERR: May be raised if the implementation does not support the feature "XML" and the language exposed through the Document does not support XML Namespaces (such as).

This method returns a specialized object which implements the specialized APIs of the specified feature and version, as specified in. The specialized object may also be obtained by using binding-specific casting methods but is not necessarily expected to, as discussed in. This method also allow the implementation to provide specialized objects which do not support theDOMImplementationinterface.

The name of the feature requested. Note that any plus sign "+" prepended to the name of the feature will be ignored since it is not significant in the context of this method.

This is the version number of the feature to test.

Returns an object which implements the specialized APIs of the specified feature and version, if any, ornullif there is no object which implements interfaces associated with that feature. If theDOMObjectreturned by this method implements theDOMImplementationinterface, it must delegate to the primary coreDOMImplementationand not return results inconsistent with the primary coreDOMImplementationsuch ashasFeature,getFeature, etc.

+

DocumentFragmentis a "lightweight" or "minimal"Documentobject. It is very common to want to be able to extract a portion of a document's tree or to create a new fragment of a document. Imagine implementing a user command like cut or rearranging a document by moving fragments around. It is desirable to have an object which can hold such fragments and it is quite natural to use a Node for this purpose. While it is true that aDocumentobject could fulfill this role, aDocumentobject can potentially be a heavyweight object, depending on the underlying implementation. What is really needed for this is a very lightweight object.DocumentFragmentis such an object.

Furthermore, various operations -- such as inserting nodes as children of anotherNode-- may takeDocumentFragmentobjects as arguments; this results in all the child nodes of theDocumentFragmentbeing moved to the child list of this node.

The children of aDocumentFragmentnode are zero or more nodes representing the tops of any sub-trees defining the structure of the document.DocumentFragmentnodes do not need to bewell-formed XML documents(although they do need to follow the rules imposed upon well-formed XML parsed entities, which can have multiple top nodes). For example, aDocumentFragmentmight have only one child and that child node could be aTextnode. Such a structure model represents neither an HTML document nor a well-formed XML document.

When aDocumentFragmentis inserted into aDocument(or indeed any otherNodethat may take children) the children of theDocumentFragmentand not theDocumentFragmentitself are inserted into theNode. This makes theDocumentFragmentvery useful when the user wishes to create nodes that aresiblings; theDocumentFragmentacts as the parent of these nodes so that the user can use the standard methods from theNodeinterface, such asNode.insertBeforeandNode.appendChild.

+

TheDocumentinterface represents the entire HTML or XML document. Conceptually, it is therootof the document tree, and provides the primary access to the document's data.

Since elements, text nodes, comments, processing instructions, etc. cannot exist outside the context of aDocument, theDocumentinterface also contains the factory methods needed to create these objects. TheNodeobjects created have aownerDocumentattribute which associates them with theDocumentwithin whose context they were created.

The Document Type Declaration (seeDocumentType) associated with this document. For XML documents without a document type declaration this returnsnull. For HTML documents, aDocumentTypeobject may be returned, independently of the presence or absence of document type declaration in the HTML document.

This provides direct access to theDocumentTypenode, child node of thisDocument. This node can be set at document creation time and later changed through the use of child nodes manipulation methods, such asNode.insertBefore, orNode.replaceChild. Note, however, that while some implementations may instantiate different types ofDocumentobjects supporting additional features than the "Core", such as "HTML", based on theDocumentTypespecified at creation time, changing it afterwards is very unlikely to result in a change of the features supported.

TheDOMImplementationobject that handles this document. A DOM application may use objects from multiple implementations.

This is aconvenienceattribute that allows direct access to the child node that is thedocument elementof the document.

Creates an element of the type specified. Note that the instance returned implements theElementinterface, so attributes can be specified directly on the returned object.

In addition, if there are known attributes with default values,Attrnodes representing them are automatically created and attached to the element.

To create an element with aqualified nameandnamespace URI, use thecreateElementNSmethod.

The name of the element type to instantiate. For XML, this is case-sensitive, otherwise it depends on the case-sensitivity of the markup language in use. In that case, the name is mapped to the canonical form of that markup by the DOM implementation.

A newElementobject with thenodeNameattribute set totagName, andlocalName,prefix, andnamespaceURIset tonull.

INVALID_CHARACTER_ERR: Raised if the specified name is not an XML name according to the XML version in use specified in theDocument.xmlVersionattribute.

Creates an emptyDocumentFragmentobject.

A newDocumentFragment.

Creates aTextnode given the specified string.

The data for the node.

The newTextobject.

Creates aCommentnode given the specified string.

The data for the node.

The newCommentobject.

Creates aCDATASectionnode whose value is the specified string.

The data for theCDATASectioncontents.

The newCDATASectionobject.

NOT_SUPPORTED_ERR: Raised if this document is an HTML document.

Creates aProcessingInstructionnode given the specified name and data strings.

The target part of the processing instruction.

UnlikeDocument.createElementNSorDocument.createAttributeNS, no namespace well-formed checking is done on the target name. Applications should invokeDocument.normalizeDocument()with the parameter "namespaces" set totruein order to ensure that the target name is namespace well-formed.

The data for the node.

The newProcessingInstructionobject.

INVALID_CHARACTER_ERR: Raised if the specified target is not an XML name according to the XML version in use specified in theDocument.xmlVersionattribute.

NOT_SUPPORTED_ERR: Raised if this document is an HTML document.

Creates anAttrof the given name. Note that theAttrinstance can then be set on anElementusing thesetAttributeNodemethod.

To create an attribute with aqualified nameandnamespace URI, use thecreateAttributeNSmethod.

The name of the attribute.

A newAttrobject with thenodeNameattribute set toname, andlocalName,prefix, andnamespaceURIset tonull. The value of the attribute is the empty string.

INVALID_CHARACTER_ERR: Raised if the specified name is not an XML name according to the XML version in use specified in theDocument.xmlVersionattribute.

Creates anEntityReferenceobject. In addition, if the referenced entity is known, the child list of theEntityReferencenode is made the same as that of the correspondingEntitynode.

If any descendant of theEntitynode has an unboundnamespace prefix, the corresponding descendant of the createdEntityReferencenode is also unbound; (itsnamespaceURIisnull). The DOM Level 2 and 3 do not support any mechanism to resolve namespace prefixes in this case.

The name of the entity to reference.

UnlikeDocument.createElementNSorDocument.createAttributeNS, no namespace well-formed checking is done on the entity name. Applications should invokeDocument.normalizeDocument()with the parameter "namespaces" set totruein order to ensure that the entity name is namespace well-formed.

The newEntityReferenceobject.

INVALID_CHARACTER_ERR: Raised if the specified name is not an XML name according to the XML version in use specified in theDocument.xmlVersionattribute.

NOT_SUPPORTED_ERR: Raised if this document is an HTML document.

Returns aNodeListof all theElementsindocument orderwith a given tag name and are contained in the document.

The name of the tag to match on. The special value "*" matches all tags. For XML, thetagnameparameter is case-sensitive, otherwise it depends on the case-sensitivity of the markup language in use.

A newNodeListobject containing all the matchedElements.

Imports a node from another document to this document, without altering or removing the source node from the original document; this method creates a new copy of the source node. The returned node has no parent; (parentNodeisnull).

For all nodes, importing a node creates a node object owned by the importing document, with attribute values identical to the source node'snodeNameandnodeType, plus the attributes related to namespaces (prefix,localName, andnamespaceURI). As in thecloneNodeoperation, the source node is not altered. User data associated to the imported node is not carried over. However, if anyUserDataHandlershas been specified along with the associated data these handlers will be called with the appropriate parameters before this method returns.

Additional information is copied as appropriate to thenodeType, attempting to mirror the behavior expected if a fragment of XML or HTML source was copied from one document to another, recognizing that the two documents may have different DTDs in the XML case. The following list describes the specifics for each type of node.

TheownerElementattribute is set tonulland thespecifiedflag is set totrueon the generatedAttr. Thedescendantsof the sourceAttrare recursively imported and the resulting nodes reassembled to form the corresponding subtree.

Note that thedeepparameter has no effect onAttrnodes; they always carry their children with them when imported.

If thedeepoption was set totrue, thedescendantsof the sourceDocumentFragmentare recursively imported and the resulting nodes reassembled under the importedDocumentFragmentto form the corresponding subtree. Otherwise, this simply generates an emptyDocumentFragment.

Documentnodes cannot be imported.

DocumentTypenodes cannot be imported.

Specifiedattribute nodes of the source element are imported, and the generatedAttrnodes are attached to the generatedElement. Default attributes arenotcopied, though if the document being imported into defines default attributes for this element name, those are assigned. If theimportNodedeepparameter was set totrue, thedescendantsof the source element are recursively imported and the resulting nodes reassembled to form the corresponding subtree.

Entitynodes can be imported, however in the current release of the DOM theDocumentTypeis readonly. Ability to add these imported nodes to aDocumentTypewill be considered for addition to a future release of the DOM.

On import, thepublicId,systemId, andnotationNameattributes are copied. If adeepimport is requested, thedescendantsof the the sourceEntityare recursively imported and the resulting nodes reassembled to form the corresponding subtree.

Only theEntityReferenceitself is copied, even if adeepimport is requested, since the source and destination documents might have defined the entity differently. If the document being imported into provides a definition for this entity name, its value is assigned.

Notationnodes can be imported, however in the current release of the DOM theDocumentTypeis readonly. Ability to add these imported nodes to aDocumentTypewill be considered for addition to a future release of the DOM.

On import, thepublicIdandsystemIdattributes are copied.

Note that thedeepparameter has no effect on this type of nodes since they cannot have any children.

The imported node copies itstargetanddatavalues from those of the source node.

Note that thedeepparameter has no effect on this type of nodes since they cannot have any children.

These three types of nodes inheriting fromCharacterDatacopy theirdataandlengthattributes from those of the source node.

Note that thedeepparameter has no effect on these types of nodes since they cannot have any children.

The node to import.

Iftrue, recursively import the subtree under the specified node; iffalse, import only the node itself, as explained above. This has no effect on nodes that cannot have any children, and onAttr, andEntityReferencenodes.

The imported node that belongs to thisDocument.

NOT_SUPPORTED_ERR: Raised if the type of node being imported is not supported.

INVALID_CHARACTER_ERR: Raised if one of the imported names is not an XML name according to the XML version in use specified in theDocument.xmlVersionattribute. This may happen when importing an XML 1.1element into an XML 1.0 document, for instance.

Creates an element of the givenqualified nameandnamespace URI.

Per, applications must use the valuenullas the namespaceURI parameter for methods if they wish to have no namespace.

Thenamespace URIof the element to create.

Thequalified nameof the element type to instantiate.

A newElementobject with the following attributes:

AttributeValue
Node.nodeNamequalifiedName
Node.namespaceURInamespaceURI
Node.prefixprefix, extracted fromqualifiedName, ornullif there is no prefix
Node.localNamelocal name, extracted fromqualifiedName
Element.tagNamequalifiedName

INVALID_CHARACTER_ERR: Raised if the specifiedqualifiedNameis not an XML name according to the XML version in use specified in theDocument.xmlVersionattribute.

NAMESPACE_ERR: Raised if thequalifiedNameis a malformedqualified name, if thequalifiedNamehas a prefix and thenamespaceURIisnull, or if thequalifiedNamehas a prefix that is "xml" and thenamespaceURIis different from "http://www.w3.org/XML/1998/namespace", or if thequalifiedNameor its prefix is "xmlns" and thenamespaceURIis different from "http://www.w3.org/2000/xmlns/", or if thenamespaceURIis "http://www.w3.org/2000/xmlns/" and neither thequalifiedNamenor its prefix is "xmlns".

NOT_SUPPORTED_ERR: Always thrown if the current document does not support the"XML"feature, since namespaces were defined by XML.

Creates an attribute of the givenqualified nameandnamespace URI.

Per, applications must use the valuenullas thenamespaceURIparameter for methods if they wish to have no namespace.

Thenamespace URIof the attribute to create.

Thequalified nameof the attribute to instantiate.

A newAttrobject with the following attributes:

AttributeValue
Node.nodeNamequalifiedName
Node.namespaceURInamespaceURI
Node.prefixprefix, extracted fromqualifiedName, ornullif there is no prefix
Node.localNamelocal name, extracted fromqualifiedName
Attr.namequalifiedName
Node.nodeValuethe empty string

INVALID_CHARACTER_ERR: Raised if the specifiedqualifiedNameis not an XML name according to the XML version in use specified in theDocument.xmlVersionattribute.

NAMESPACE_ERR: Raised if thequalifiedNameis a malformedqualified name, if thequalifiedNamehas a prefix and thenamespaceURIisnull, if thequalifiedNamehas a prefix that is "xml" and thenamespaceURIis different from "http://www.w3.org/XML/1998/namespace", if thequalifiedNameor its prefix is "xmlns" and thenamespaceURIis different from "http://www.w3.org/2000/xmlns/", or if thenamespaceURIis "http://www.w3.org/2000/xmlns/" and neither thequalifiedNamenor its prefix is "xmlns".

NOT_SUPPORTED_ERR: Always thrown if the current document does not support the"XML"feature, since namespaces were defined by XML.

Returns aNodeListof all theElementswith a givenlocal nameandnamespace URIindocument order.

Thenamespace URIof the elements to match on. The special value"*"matches all namespaces.

Thelocal nameof the elements to match on. The special value "*" matches all local names.

A newNodeListobject containing all the matchedElements.

Returns theElementthat has an ID attribute with the given value. If no such element exists, this returnsnull. If more than one element has an ID attribute with that value, what is returned is undefined.

The DOM implementation is expected to use the attributeAttr.isIdto determine if an attribute is of type ID.

Attributes with the name "ID" or "id" are not of type ID unless so defined.

The uniqueidvalue for an element.

The matching element ornullif there is none.

An attribute specifying the encoding used for this document at the time of the parsing. This isnullwhen it is not known, such as when theDocumentwas created in memory.

An attribute specifying, as part of theXML declaration, the encoding of this document. This isnullwhen unspecified or when it is not known, such as when theDocumentwas created in memory.

An attribute specifying, as part of theXML declaration, whether this document is standalone. This isfalsewhen unspecified.

No verification is done on the value when setting this attribute. Applications should useDocument.normalizeDocument()with the "validate" parameter to verify if the value matches thevalidity constraint for standalone document declarationas defined in.

NOT_SUPPORTED_ERR: Raised if this document does not support the "XML" feature.

An attribute specifying, as part of theXML declaration, the version number of this document. If there is no declaration and if this document supports the "XML" feature, the value is"1.0". If this document does not support the "XML" feature, the value is alwaysnull. Changing this attribute will affect methods that check for invalid characters in XML names. Application should invokeDocument.normalizeDocument()in order to check for invalid characters in theNodes that are already part of thisDocument.

DOM applications may use theDOMImplementation.hasFeature(feature, version)method with parameter values "XMLVersion" and "1.0" (respectively) to determine if an implementation supports. DOM applications may use the same method with parameter values "XMLVersion" and "1.1" (respectively) to determine if an implementation supports. In both cases, in order to support XML, an implementation must also support the "XML" feature defined in this specification.Documentobjects supporting a version of the "XMLVersion" feature must not raise aNOT_SUPPORTED_ERRexception for the same version number when usingDocument.xmlVersion.

NOT_SUPPORTED_ERR: Raised if the version is set to a value that is not supported by thisDocumentor if this document does not support the "XML" feature.

An attribute specifying whether error checking is enforced or not. When set tofalse, the implementation is free to not test every possible error case normally defined on DOM operations, and not raise anyDOMExceptionon DOM operations or report errors while usingDocument.normalizeDocument(). In case of error, the behavior is undefined. This attribute istrueby default.

The location of the document ornullif undefined or if theDocumentwas created usingDOMImplementation.createDocument. No lexical checking is performed when setting this attribute; this could result in anullvalue returned when usingNode.baseURI.

Beware that when theDocumentsupports the feature "HTML", the href attribute of the HTML BASE element takes precedence over this attribute when computingNode.baseURI.

Attempts to adopt a node from another document to this document. If supported, it changes theownerDocumentof the source node, its children, as well as the attached attribute nodes if there are any. If the source node has a parent it is first removed from the child list of its parent. This effectively allows moving a subtree from one document to another (unlikeimportNode()which create a copy of the source node instead of moving it). When it fails, applications should useDocument.importNode()instead. Note that if the adopted node is already part of this document (i.e. the source and target document are the same), this method still has the effect of removing the source node from the child list of its parent, if any. The following list describes the specifics for each type of node.

TheownerElementattribute is set tonulland thespecifiedflag is set totrueon the adoptedAttr. The descendants of the sourceAttrare recursively adopted.

The descendants of the source node are recursively adopted.

Documentnodes cannot be adopted.

DocumentTypenodes cannot be adopted.

Specifiedattribute nodes of the source element are adopted. Default attributes are discarded, though if the document being adopted into defines default attributes for this element name, those are assigned. The descendants of the source element are recursively adopted.

Entitynodes cannot be adopted.

Only theEntityReferencenode itself is adopted, the descendants are discarded, since the source and destination documents might have defined the entity differently. If the document being imported into provides a definition for this entity name, its value is assigned.

Notationnodes cannot be adopted.

These nodes can all be adopted. No specifics.

Since it does not create new nodes unlike theDocument.importNode()method, this method does not raise anINVALID_CHARACTER_ERRexception, and applications should use theDocument.normalizeDocument()method to check if an imported name is not an XML name according to the XML version in use.

The node to move into this document.

The adopted node, ornullif this operation fails, such as when the source node comes from a different implementation.

NOT_SUPPORTED_ERR: Raised if the source node is of typeDOCUMENT,DOCUMENT_TYPE.

NO_MODIFICATION_ALLOWED_ERR: Raised when the source node is readonly.

The configuration used whenDocument.normalizeDocument()is invoked.

This method acts as if the document was going through a save and load cycle, putting the document in a "normal" form. As a consequence, this method updates the replacement tree ofEntityReferencenodes and normalizesTextnodes, as defined in the methodNode.normalize().

Otherwise, the actual result depends on the features being set on theDocument.domConfigobject and governing what operations actually take place. Noticeably this method could also make the documentnamespace well-formedaccording to the algorithm described in, check the character normalization, remove theCDATASectionnodes, etc. SeeDOMConfigurationfor details.

// Keep in the document the information defined // in the XML Information Set (Java example) DOMConfiguration docConfig = myDocument.getDomConfig(); docConfig.setParameter("infoset", Boolean.TRUE); myDocument.normalizeDocument();

Mutation events, when supported, are generated to reflect the changes occurring on the document.

If errors occur during the invocation of this method, such as an attempt to update aread-only nodeor aNode.nodeNamecontains an invalid character according to the XML version in use, errors or warnings (DOMError.SEVERITY_ERRORorDOMError.SEVERITY_WARNING) will be reported using theDOMErrorHandlerobject associated with the "error-handler" parameter. Note this method might also report fatal errors (DOMError.SEVERITY_FATAL_ERROR) if an implementation cannot recover from an error.

Rename an existing node of typeELEMENT_NODEorATTRIBUTE_NODE.

When possible this simply changes the name of the given node, otherwise this creates a new node with the specified name and replaces the existing node with the new node as described below.

If simply changing the name of the given node is not possible, the following operations are performed: a new node is created, any registered event listener is registered on the new node, any user data attached to the old node is removed from that node, the old node is removed from its parent if it has one, the children are moved to the new node, if the renamed node is anElementits attributes are moved to the new node, the new node is inserted at the position the old node used to have in its parent's child nodes list if it has one, the user data that was attached to the old node is attached to the new node.

When the node being renamed is anElementonly the specified attributes are moved, default attributes originated from the DTD are updated according to the new element name. In addition, the implementation may update default attributes from other schemas. Applications should useDocument.normalizeDocument()to guarantee these attributes are up-to-date.

When the node being renamed is anAttrthat is attached to anElement, the node is first removed from theElementattributes map. Then, once renamed, either by modifying the existing node or creating a new one as described above, it is put back.

In addition,

a user data eventNODE_RENAMEDis fired,

when the implementation supports the feature "MutationNameEvents", each mutation operation involved in this method fires the appropriate event, and in the end the event {http://www.w3.org/2001/xml-events,DOMElementNameChanged} or {http://www.w3.org/2001/xml-events,DOMAttributeNameChanged} is fired.

The node to rename.

The newnamespace URI.

The newqualified name.

The renamed node. This is either the specified node or the new node that was created to replace the specified node.

NOT_SUPPORTED_ERR: Raised when the type of the specified node is neitherELEMENT_NODEnorATTRIBUTE_NODE, or if the implementation does not support the renaming of thedocument element.

INVALID_CHARACTER_ERR: Raised if the new qualified name is not an XML name according to the XML version in use specified in theDocument.xmlVersionattribute.

WRONG_DOCUMENT_ERR: Raised when the specified node was created from a different document than this document.

NAMESPACE_ERR: Raised if thequalifiedNameis a malformedqualified name, if thequalifiedNamehas a prefix and thenamespaceURIisnull, or if thequalifiedNamehas a prefix that is "xml" and thenamespaceURIis different from "http://www.w3.org/XML/1998/namespace". Also raised, when the node being renamed is an attribute, if thequalifiedName, or its prefix, is "xmlns" and thenamespaceURIis different from "http://www.w3.org/2000/xmlns/".

+

TheNodeinterface is the primary datatype for the entire Document Object Model. It represents a single node in the document tree. While all objects implementing theNodeinterface expose methods for dealing with children, not all objects implementing theNodeinterface may have children. For example,Textnodes may not have children, and adding children to such nodes results in aDOMExceptionbeing raised.

The attributesnodeName,nodeValueandattributesare included as a mechanism to get at node information without casting down to the specific derived interface. In cases where there is no obvious mapping of these attributes for a specificnodeType(e.g.,nodeValuefor anElementorattributesfor aComment), this returnsnull. Note that the specialized interfaces may contain additional and more convenient mechanisms to get and set the relevant information.

An integer indicating which type of node this is.

Numeric codes up to 200 are reserved to W3C for possible future use.

The node is anElement.

The node is anAttr.

The node is aTextnode.

The node is aCDATASection.

The node is anEntityReference.

The node is anEntity.

The node is aProcessingInstruction.

The node is aComment.

The node is aDocument.

The node is aDocumentType.

The node is aDocumentFragment.

The node is aNotation.

The values ofnodeName,nodeValue, andattributesvary according to the node type as follows:
InterfacenodeNamenodeValueattributes
Attrsame asAttr.namesame asAttr.valuenull
CDATASection"#cdata-section"same asCharacterData.data, the content of the CDATA Sectionnull
Comment"#comment"same asCharacterData.data, the content of the commentnull
Document"#document"nullnull
DocumentFragment"#document-fragment"nullnull
DocumentTypesame asDocumentType.namenullnull
Elementsame asElement.tagNamenullNamedNodeMap
Entityentity namenullnull
EntityReferencename of entity referencednullnull
Notationnotation namenullnull
ProcessingInstructionsame asProcessingInstruction.targetsame asProcessingInstruction.datanull
Text"#text"same asCharacterData.data, the content of the text nodenull

The name of this node, depending on its type; see the table above.

The value of this node, depending on its type; see the table above. When it is defined to benull, setting it has no effect, including if the node isread-only.

NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly and if it is not defined to benull.

DOMSTRING_SIZE_ERR: Raised when it would return more characters than fit in aDOMStringvariable on the implementation platform.

A code representing the type of the underlying object, as defined above.

Theparentof this node. All nodes, exceptAttr,Document,DocumentFragment,Entity, andNotationmay have a parent. However, if a node has just been created and not yet added to the tree, or if it has been removed from the tree, this isnull.

ANodeListthat contains all children of this node. If there are no children, this is aNodeListcontaining no nodes.

The first child of this node. If there is no such node, this returnsnull.

The last child of this node. If there is no such node, this returnsnull.

The node immediately preceding this node. If there is no such node, this returnsnull.

The node immediately following this node. If there is no such node, this returnsnull.

ANamedNodeMapcontaining the attributes of this node (if it is anElement) ornullotherwise.

TheDocumentobject associated with this node. This is also theDocumentobject used to create new nodes. When this node is aDocumentor aDocumentTypewhich is not used with anyDocumentyet, this isnull.

Inserts the nodenewChildbefore the existing child noderefChild. IfrefChildisnull, insertnewChildat the end of the list of children.

IfnewChildis aDocumentFragmentobject, all of its children are inserted, in the same order, beforerefChild. If thenewChildis already in the tree, it is first removed.

Inserting a node before itself is implementation dependent.

The node to insert.

The reference node, i.e., the node before which the new node must be inserted.

The node being inserted.

HIERARCHY_REQUEST_ERR: Raised if this node is of a type that does not allow children of the type of thenewChildnode, or if the node to insert is one of this node'sancestorsor this node itself, or if this node is of typeDocumentand the DOM application attempts to insert a secondDocumentTypeorElementnode.

WRONG_DOCUMENT_ERR: Raised ifnewChildwas created from a different document than the one that created this node.

NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly or if the parent of the node being inserted is readonly.

NOT_FOUND_ERR: Raised ifrefChildis not a child of this node.

NOT_SUPPORTED_ERR: if this node is of typeDocument, this exception might be raised if the DOM implementation doesn't support the insertion of aDocumentTypeorElementnode.

Replaces the child nodeoldChildwithnewChildin the list of children, and returns theoldChildnode.

IfnewChildis aDocumentFragmentobject,oldChildis replaced by all of theDocumentFragmentchildren, which are inserted in the same order. If thenewChildis already in the tree, it is first removed.

Replacing a node with itself is implementation dependent.

The new node to put in the child list.

The node being replaced in the list.

The node replaced.

HIERARCHY_REQUEST_ERR: Raised if this node is of a type that does not allow children of the type of thenewChildnode, or if the node to put in is one of this node'sancestorsor this node itself, or if this node is of typeDocumentand the result of the replacement operation would add a secondDocumentTypeorElementon theDocumentnode.

WRONG_DOCUMENT_ERR: Raised ifnewChildwas created from a different document than the one that created this node.

NO_MODIFICATION_ALLOWED_ERR: Raised if this node or the parent of the new node is readonly.

NOT_FOUND_ERR: Raised ifoldChildis not a child of this node.

NOT_SUPPORTED_ERR: if this node is of typeDocument, this exception might be raised if the DOM implementation doesn't support the replacement of theDocumentTypechild orElementchild.

Removes the child node indicated byoldChildfrom the list of children, and returns it.

The node being removed.

The node removed.

NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.

NOT_FOUND_ERR: Raised ifoldChildis not a child of this node.

NOT_SUPPORTED_ERR: if this node is of typeDocument, this exception might be raised if the DOM implementation doesn't support the removal of theDocumentTypechild or theElementchild.

Adds the nodenewChildto the end of the list of children of this node. If thenewChildis already in the tree, it is first removed.

The node to add.

If it is aDocumentFragmentobject, the entire contents of the document fragment are moved into the child list of this node

The node added.

HIERARCHY_REQUEST_ERR: Raised if this node is of a type that does not allow children of the type of thenewChildnode, or if the node to append is one of this node'sancestorsor this node itself, or if this node is of typeDocumentand the DOM application attempts to append a secondDocumentTypeorElementnode.

WRONG_DOCUMENT_ERR: Raised ifnewChildwas created from a different document than the one that created this node.

NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly or if the previous parent of the node being inserted is readonly.

NOT_SUPPORTED_ERR: if thenewChildnode is a child of theDocumentnode, this exception might be raised if the DOM implementation doesn't support the removal of theDocumentTypechild orElementchild.

Returns whether this node has any children.

Returnstrueif this node has any children,falseotherwise.

Returns a duplicate of this node, i.e., serves as a generic copy constructor for nodes. The duplicate node has no parent (parentNodeisnull) and no user data. User data associated to the imported node is not carried over. However, if anyUserDataHandlershas been specified along with the associated data these handlers will be called with the appropriate parameters before this method returns.

Cloning anElementcopies all attributes and their values, including those generated by the XML processor to represent defaulted attributes, but this method does not copy any children it contains unless it is a deep clone. This includes text contained in an theElementsince the text is contained in a childTextnode. Cloning anAttrdirectly, as opposed to be cloned as part of anElementcloning operation, returns a specified attribute (specifiedistrue). Cloning anAttralways clones its children, since they represent its value, no matter whether this is a deep clone or not. Cloning anEntityReferenceautomatically constructs its subtree if a correspondingEntityis available, no matter whether this is a deep clone or not. Cloning any other type of node simply returns a copy of this node.

Note that cloning an immutable subtree results in a mutable copy, but the children of anEntityReferenceclone arereadonly. In addition, clones of unspecifiedAttrnodes are specified. And, cloningDocument,DocumentType,Entity, andNotationnodes is implementation dependent.

Iftrue, recursively clone the subtree under the specified node; iffalse, clone only the node itself (and its attributes, if it is anElement).

The duplicate node.

Puts allTextnodes in the full depth of the sub-tree underneath thisNode, including attribute nodes, into a "normal" form where only structure (e.g., elements, comments, processing instructions, CDATA sections, and entity references) separatesTextnodes, i.e., there are neither adjacentTextnodes nor emptyTextnodes. This can be used to ensure that the DOM view of a document is the same as if it were saved and re-loaded, and is useful when operations (such as XPointerlookups) that depend on a particular document tree structure are to be used. If the parameter "normalize-characters" of theDOMConfigurationobject attached to theNode.ownerDocumentistrue, this method will also fully normalize the characters of theTextnodes.

In cases where the document containsCDATASections, the normalize operation alone may not be sufficient, since XPointers do not differentiate betweenTextnodes andCDATASectionnodes.

Tests whether the DOM implementation implements a specific feature and that feature is supported by this node, as specified in.

The name of the feature to test.

This is the version number of the feature to test.

Returnstrueif the specified feature is supported on this node,falseotherwise.

Thenamespace URIof this node, ornullif it is unspecified (see).

This is not a computed value that is the result of a namespace lookup based on an examination of the namespace declarations in scope. It is merely the namespace URI given at creation time.

For nodes of any type other thanELEMENT_NODEandATTRIBUTE_NODEand nodes created with a DOM Level 1 method, such asDocument.createElement(), this is alwaysnull.

Per theNamespaces in XMLSpecificationan attribute does not inherit its namespace from the element it is attached to. If an attribute is not explicitly given a namespace, it simply has no namespace.

Thenamespace prefixof this node, ornullif it is unspecified. When it is defined to benull, setting it has no effect, including if the node isread-only.

Note that setting this attribute, when permitted, changes thenodeNameattribute, which holds thequalified name, as well as thetagNameandnameattributes of theElementandAttrinterfaces, when applicable.

Setting the prefix tonullmakes it unspecified, setting it to an empty string is implementation dependent.

Note also that changing the prefix of an attribute that is known to have a default value, does not make a new attribute with the default value and the original prefix appear, since thenamespaceURIandlocalNamedo not change.

For nodes of any type other thanELEMENT_NODEandATTRIBUTE_NODEand nodes created with a DOM Level 1 method, such ascreateElementfrom theDocumentinterface, this is alwaysnull.

INVALID_CHARACTER_ERR: Raised if the specified prefix contains an illegal character according to the XML version in use specified in theDocument.xmlVersionattribute.

NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.

NAMESPACE_ERR: Raised if the specifiedprefixis malformed per the Namespaces in XML specification, if thenamespaceURIof this node isnull, if the specified prefix is "xml" and thenamespaceURIof this node is different from "http://www.w3.org/XML/1998/namespace", if this node is an attribute and the specified prefix is "xmlns" and thenamespaceURIof this node is different from "http://www.w3.org/2000/xmlns/", or if this node is an attribute and thequalifiedNameof this node is "xmlns".

Returns the local part of thequalified nameof this node.

For nodes of any type other thanELEMENT_NODEandATTRIBUTE_NODEand nodes created with a DOM Level 1 method, such asDocument.createElement(), this is alwaysnull.

Returns whether this node (if it is an element) has any attributes.

Returnstrueif this node has any attributes,falseotherwise.

The absolute base URI of this node ornullif the implementation wasn't able to obtain an absolute URI. This value is computed as described in. However, when theDocumentsupports the feature "HTML", the base URI is computed using first the value of the href attribute of the HTML BASE element if any, and the value of thedocumentURIattribute from theDocumentinterface otherwise.

A bitmask indicating the relative document position of a node with respect to another node.

If the two nodes being compared are the same node, then no flags are set on the return.

Otherwise, the order of two nodes is determined by looking for common containers -- containers which contain both. A node directly contains any child nodes. A node also directly contains any other nodes attached to it such as attributes contained in an element or entities and notations contained in a document type. Nodes contained in contained nodes are also contained, but less-directly as the number of intervening containers increases.

If there is no common container node, then the order is based upon order between the root container of each node that is in no container. In this case, the result is disconnected and implementation-specific. This result is stable as long as these outer-most containing nodes remain in memory and are not inserted into some other containing node. This would be the case when the nodes belong to different documents or fragments, and cloning the document or inserting a fragment might change the order.

If one of the nodes being compared contains the other node, then the container precedes the contained node, and reversely the contained node follows the container. For example, when comparing an element against its own attribute or child, the element node precedes its attribute node and its child node, which both follow it.

If neither of the previous cases apply, then there exists a most-direct container common to both nodes being compared. In this case, the order is determined based upon the two determining nodes directly contained in this most-direct common container that either are or contain the corresponding nodes being compared.

If these two determining nodes are both child nodes, then the natural DOM order of these determining nodes within the containing node is returned as the order of the corresponding nodes. This would be the case, for example, when comparing two child elements of the same element.

If one of the two determining nodes is a child node and the other is not, then the corresponding node of the child node follows the corresponding node of the non-child node. This would be the case, for example, when comparing an attribute of an element with a child element of the same element.

If neither of the two determining node is a child node and one determining node has a greater value ofnodeTypethan the other, then the corresponding node precedes the other. This would be the case, for example, when comparing an entity of a document type against a notation of the same document type.

If neither of the two determining node is a child node andnodeTypeis the same for both determining nodes, then an implementation-dependent order between the determining nodes is returned. This order is stable as long as no nodes of the same nodeType are inserted into or removed from the direct container. This would be the case, for example, when comparing two attributes of the same element, and inserting or removing additional attributes might change the order between existing attributes.

The two nodes are disconnected. Order between disconnected nodes is always implementation-specific.

The second node precedes the reference node.

The node follows the reference node.

The node contains the reference node. A node which contains is always preceding, too.

The node is contained by the reference node. A node which is contained is always following, too.

The determination of preceding versus following is implementation-specific.

Compares the reference node, i.e. the node on which this method is being called, with a node, i.e. the one passed as a parameter, with regard to their position in the document and according to thedocument order.

The node to compare against the reference node.

Returns how the node is positioned relatively to the reference node.

NOT_SUPPORTED_ERR: when the compared nodes are from different DOM implementations that do not coordinate to return consistent implementation-specific results.

This attribute returns the text content of this node and its descendants. When it is defined to benull, setting it has no effect. On setting, any possible children this node may have are removed and, if it the new string is not empty ornull, replaced by a singleTextnode containing the string this attribute is set to.

On getting, no serialization is performed, the returned string does not contain any markup. No whitespace normalization is performed and the returned string does not contain the white spaces in element content (see the attributeText.isElementContentWhitespace). Similarly, on setting, no parsing is performed either, the input string is taken as pure textual content.

The string returned is made of the text content of this node depending on its type, as defined below:

Node typeContent
ELEMENT_NODE, ATTRIBUTE_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, DOCUMENT_FRAGMENT_NODEconcatenation of thetextContentattribute value of every child node, excluding COMMENT_NODE and PROCESSING_INSTRUCTION_NODE nodes. This is the empty string if the node has no children.
TEXT_NODE, CDATA_SECTION_NODE, COMMENT_NODE, PROCESSING_INSTRUCTION_NODEnodeValue
DOCUMENT_NODE, DOCUMENT_TYPE_NODE, NOTATION_NODEnull

NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.

DOMSTRING_SIZE_ERR: Raised when it would return more characters than fit in aDOMStringvariable on the implementation platform.

Returns whether this node is the same node as the given one.

This method provides a way to determine whether twoNodereferences returned by the implementation reference the same object. When twoNodereferences are references to the same object, even if through a proxy, the references may be used completely interchangeably, such that all attributes have the same values and calling the same DOM method on either reference always has exactly the same effect.

The node to test against.

Returnstrueif the nodes are the same,falseotherwise.

Look up the prefix associated to the given namespace URI, starting from this node. The default namespace declarations are ignored by this method.

Seefor details on the algorithm used by this method.

The namespace URI to look for.

Returns an associated namespace prefix if found ornullif none is found. If more than one prefix are associated to the namespace prefix, the returned namespace prefix is implementation dependent.

This method checks if the specifiednamespaceURIis the default namespace or not.

The namespace URI to look for.

Returnstrueif the specifiednamespaceURIis the default namespace,falseotherwise.

Look up the namespace URI associated to the given prefix, starting from this node.

Seefor details on the algorithm used by this method.

The prefix to look for. If this parameter isnull, the method will return the default namespace URI if any.

Returns the associated namespace URI ornullif none is found.

Tests whether two nodes are equal.

This method tests for equality of nodes, not sameness (i.e., whether the two nodes are references to the same object) which can be tested withNode.isSameNode(). All nodes that are the same will also be equal, though the reverse may not be true.

Two nodes are equal if and only if the following conditions are satisfied:

The two nodes are of the same type.

The following string attributes are equal:nodeName,localName,namespaceURI,prefix,nodeValue. This is: they are bothnull, or they have the same length and are character for character identical.

TheattributesNamedNodeMapsare equal. This is: they are bothnull, or they have the same length and for each node that exists in one map there is a node that exists in the other map and is equal, although not necessarily at the same index.

ThechildNodesNodeListsare equal. This is: they are bothnull, or they have the same length and contain equal nodes at the same index. Note that normalization can affect equality; to avoid this, nodes should be normalized before being compared.

For twoDocumentTypenodes to be equal, the following conditions must also be satisfied:

The following string attributes are equal:publicId,systemId,internalSubset.

TheentitiesNamedNodeMapsare equal.

ThenotationsNamedNodeMapsare equal.

On the other hand, the following do not affect equality: theownerDocument,baseURI, andparentNodeattributes, thespecifiedattribute forAttrnodes, theschemaTypeInfoattribute forAttrandElementnodes, theText.isElementContentWhitespaceattribute forTextnodes, as well as any user data or event listeners registered on the nodes.

As a general rule, anything not mentioned in the description above is not significant in consideration of equality checking. Note that future versions of this specification may take into account more attributes and implementations conform to this specification are expected to be updated accordingly.

The node to compare equality with.

Returnstrueif the nodes are equal,falseotherwise.

This method returns a specialized object which implements the specialized APIs of the specified feature and version, as specified in. The specialized object may also be obtained by using binding-specific casting methods but is not necessarily expected to, as discussed in. This method also allow the implementation to provide specialized objects which do not support theNodeinterface.

The name of the feature requested. Note that any plus sign "+" prepended to the name of the feature will be ignored since it is not significant in the context of this method.

This is the version number of the feature to test.

Returns an object which implements the specialized APIs of the specified feature and version, if any, ornullif there is no object which implements interfaces associated with that feature. If theDOMObjectreturned by this method implements theNodeinterface, it must delegate to the primary coreNodeand not return results inconsistent with the primary coreNodesuch as attributes, childNodes, etc.

Associate an object to a key on this node. The object can later be retrieved from this node by callinggetUserDatawith the same key.

The key to associate the object to.

The object to associate to the given key, ornullto remove any existing association to that key.

The handler to associate to that key, ornull.

Returns theDOMUserDatapreviously associated to the given key on this node, ornullif there was none.

Retrieves the object associated to a key on a this node. The object must first have been set to this node by callingsetUserDatawith the same key.

The key the object is associated to.

Returns theDOMUserDataassociated to the given key on this node, ornullif there was none.

+

TheNodeListinterface provides the abstraction of an ordered collection of nodes, without defining or constraining how this collection is implemented.NodeListobjects in the DOM arelive.

The items in theNodeListare accessible via an integral index, starting from 0.

Returns theindexth item in the collection. Ifindexis greater than or equal to the number of nodes in the list, this returnsnull.

Index into the collection.

The node at theindexth position in theNodeList, ornullif that is not a valid index.

The number of nodes in the list. The range of valid child node indices is 0 tolength-1inclusive.

+

Objects implementing theNamedNodeMapinterface are used to represent collections of nodes that can be accessed by name. Note thatNamedNodeMapdoes not inherit fromNodeList;NamedNodeMapsare not maintained in any particular order. Objects contained in an object implementingNamedNodeMapmay also be accessed by an ordinal index, but this is simply to allow convenient enumeration of the contents of aNamedNodeMap, and does not imply that the DOM specifies an order to these Nodes.

NamedNodeMapobjects in the DOM arelive.

Retrieves a node specified by name.

ThenodeNameof a node to retrieve.

ANode(of any type) with the specifiednodeName, ornullif it does not identify any node in this map.

Adds a node using itsnodeNameattribute. If a node with that name is already present in this map, it is replaced by the new one. Replacing a node by itself has no effect.

As thenodeNameattribute is used to derive the name which the node must be stored under, multiple nodes of certain types (those that have a "special" string value) cannot be stored as the names would clash. This is seen as preferable to allowing nodes to be aliased.

A node to store in this map. The node will later be accessible using the value of itsnodeNameattribute.

If the newNodereplaces an existing node the replacedNodeis returned, otherwisenullis returned.

WRONG_DOCUMENT_ERR: Raised ifargwas created from a different document than the one that created this map.

NO_MODIFICATION_ALLOWED_ERR: Raised if this map is readonly.

INUSE_ATTRIBUTE_ERR: Raised ifargis anAttrthat is already an attribute of anotherElementobject. The DOM user must explicitly cloneAttrnodes to re-use them in other elements.

HIERARCHY_REQUEST_ERR: Raised if an attempt is made to add a node doesn't belong in this NamedNodeMap. Examples would include trying to insert something other than an Attr node into an Element's map of attributes, or a non-Entity node into the DocumentType's map of Entities.

Removes a node specified by name. When this map contains the attributes attached to an element, if the removed attribute is known to have a default value, an attribute immediately appears containing the default value as well as the corresponding namespace URI, local name, and prefix when applicable.

ThenodeNameof the node to remove.

The node removed from this map if a node with such a name exists.

NOT_FOUND_ERR: Raised if there is no node namednamein this map.

NO_MODIFICATION_ALLOWED_ERR: Raised if this map is readonly.

Returns theindexth item in the map. Ifindexis greater than or equal to the number of nodes in this map, this returnsnull.

Index into this map.

The node at theindexth position in the map, ornullif that is not a valid index.

The number of nodes in this map. The range of valid child node indices is0tolength-1inclusive.

Retrieves a node specified by local name and namespace URI.

Per, applications must use the value null as the namespaceURI parameter for methods if they wish to have no namespace.

Thenamespace URIof the node to retrieve.

Thelocal nameof the node to retrieve.

ANode(of any type) with the specified local name and namespace URI, ornullif they do not identify any node in this map.

NOT_SUPPORTED_ERR: May be raised if the implementation does not support the feature "XML" and the language exposed through the Document does not support XML Namespaces (such as).

Adds a node using itsnamespaceURIandlocalName. If a node with that namespace URI and that local name is already present in this map, it is replaced by the new one. Replacing a node by itself has no effect.

Per, applications must use the value null as the namespaceURI parameter for methods if they wish to have no namespace.

A node to store in this map. The node will later be accessible using the value of itsnamespaceURIandlocalNameattributes.

If the newNodereplaces an existing node the replacedNodeis returned, otherwisenullis returned.

WRONG_DOCUMENT_ERR: Raised ifargwas created from a different document than the one that created this map.

NO_MODIFICATION_ALLOWED_ERR: Raised if this map is readonly.

INUSE_ATTRIBUTE_ERR: Raised ifargis anAttrthat is already an attribute of anotherElementobject. The DOM user must explicitly cloneAttrnodes to re-use them in other elements.

HIERARCHY_REQUEST_ERR: Raised if an attempt is made to add a node doesn't belong in this NamedNodeMap. Examples would include trying to insert something other than an Attr node into an Element's map of attributes, or a non-Entity node into the DocumentType's map of Entities.

NOT_SUPPORTED_ERR: May be raised if the implementation does not support the feature "XML" and the language exposed through the Document does not support XML Namespaces (such as).

Removes a node specified by local name and namespace URI. A removed attribute may be known to have a default value when this map contains the attributes attached to an element, as returned by the attributes attribute of theNodeinterface. If so, an attribute immediately appears containing the default value as well as the corresponding namespace URI, local name, and prefix when applicable.

Per, applications must use the value null as the namespaceURI parameter for methods if they wish to have no namespace.

Thenamespace URIof the node to remove.

Thelocal nameof the node to remove.

The node removed from this map if a node with such a local name and namespace URI exists.

NOT_FOUND_ERR: Raised if there is no node with the specifiednamespaceURIandlocalNamein this map.

NO_MODIFICATION_ALLOWED_ERR: Raised if this map is readonly.

NOT_SUPPORTED_ERR: May be raised if the implementation does not support the feature "XML" and the language exposed through the Document does not support XML Namespaces (such as).

+

TheCharacterDatainterface extends Node with a set of attributes and methods for accessing character data in the DOM. For clarity this set is defined here rather than on each object that uses these attributes and methods. No DOM objects correspond directly toCharacterData, thoughTextand others do inherit the interface from it. Alloffsetsin this interface start from0.

As explained in theDOMStringinterface, text strings in the DOM are represented in UTF-16, i.e. as a sequence of 16-bit units. In the following, the term16-bit unitsis used whenever necessary to indicate that indexing on CharacterData is done in 16-bit units.

The character data of the node that implements this interface. The DOM implementation may not put arbitrary limits on the amount of data that may be stored in aCharacterDatanode. However, implementation limits may mean that the entirety of a node's data may not fit into a singleDOMString. In such cases, the user may callsubstringDatato retrieve the data in appropriately sized pieces.

NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.

DOMSTRING_SIZE_ERR: Raised when it would return more characters than fit in aDOMStringvariable on the implementation platform.

The number of16-bit unitsthat are available throughdataand thesubstringDatamethod below. This may have the value zero, i.e.,CharacterDatanodes may be empty.

Extracts a range of data from the node.

Start offset of substring to extract.

The number of 16-bit units to extract.

The specified substring. If the sum ofoffsetandcountexceeds thelength, then all 16-bit units to the end of the data are returned.

INDEX_SIZE_ERR: Raised if the specifiedoffsetis negative or greater than the number of 16-bit units indata, or if the specifiedcountis negative.

DOMSTRING_SIZE_ERR: Raised if the specified range of text does not fit into aDOMString.

Append the string to the end of the character data of the node. Upon success,dataprovides access to the concatenation ofdataand theDOMStringspecified.

TheDOMStringto append.

NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.

Insert a string at the specified16-bit unitoffset.

The character offset at which to insert.

TheDOMStringto insert.

INDEX_SIZE_ERR: Raised if the specifiedoffsetis negative or greater than the number of 16-bit units indata.

NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.

Remove a range of16-bit unitsfrom the node. Upon success,dataandlengthreflect the change.

The offset from which to start removing.

The number of 16-bit units to delete. If the sum ofoffsetandcountexceedslengththen all 16-bit units fromoffsetto the end of the data are deleted.

INDEX_SIZE_ERR: Raised if the specifiedoffsetis negative or greater than the number of 16-bit units indata, or if the specifiedcountis negative.

NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.

Replace the characters starting at the specified16-bit unitoffset with the specified string.

The offset from which to start replacing.

The number of 16-bit units to replace. If the sum ofoffsetandcountexceedslength, then all 16-bit units to the end of the data are replaced; (i.e., the effect is the same as aremovemethod call with the same range, followed by anappendmethod invocation).

TheDOMStringwith which the range must be replaced.

INDEX_SIZE_ERR: Raised if the specifiedoffsetis negative or greater than the number of 16-bit units indata, or if the specifiedcountis negative.

NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.

+

TheAttrinterface represents an attribute in anElementobject. Typically the allowable values for the attribute are defined in a schema associated with the document.

Attrobjects inherit theNodeinterface, but since they are not actually child nodes of the element they describe, the DOM does not consider them part of the document tree. Thus, theNodeattributesparentNode,previousSibling, andnextSiblinghave anullvalue forAttrobjects. The DOM takes the view that attributes are properties of elements rather than having a separate identity from the elements they are associated with; this should make it more efficient to implement such features as default attributes associated with all elements of a given type. Furthermore,Attrnodes may not be immediate children of aDocumentFragment. However, they can be associated withElementnodes contained within aDocumentFragment. In short, users and implementors of the DOM need to be aware thatAttrnodes have some things in common with other objects inheriting theNodeinterface, but they also are quite distinct.

The attribute's effective value is determined as follows: if this attribute has been explicitly assigned any value, that value is the attribute's effective value; otherwise, if there is a declaration for this attribute, and that declaration includes a default value, then that default value is the attribute's effective value; otherwise, the attribute does not exist on this element in the structure model until it has been explicitly added. Note that theNode.nodeValueattribute on theAttrinstance can also be used to retrieve the string version of the attribute's value(s).

If the attribute was not explicitly given a value in the instance document but has a default value provided by the schema associated with the document, an attribute node will be created withspecifiedset tofalse. Removing attribute nodes for which a default value is defined in the schema generates a new attribute node with the default value andspecifiedset tofalse. If validation occurred while invokingDocument.normalizeDocument(), attribute nodes withspecifiedequals tofalseare recomputed according to the default attribute values provided by the schema. If no default value is associate with this attribute in the schema, the attribute node is discarded.

In XML, where the value of an attribute can contain entity references, the child nodes of theAttrnode may be eitherTextorEntityReferencenodes (when these are in use; see the description ofEntityReferencefor discussion).

The DOM Core represents all attribute values as simple strings, even if the DTD or schema associated with the document declares them of some specific type such astokenized.

The way attribute value normalization is performed by the DOM implementation depends on how much the implementation knows about the schema in use. Typically, thevalueandnodeValueattributes of anAttrnode initially returns the normalized value given by the parser. It is also the case afterDocument.normalizeDocument()is called (assuming the right options have been set). But this may not be the case after mutation, independently of whether the mutation is performed by setting the string value directly or by changing theAttrchild nodes. In particular, this is true whencharacter referencesare involved, given that they are not represented in the DOM and they impact attribute value normalization. On the other hand, if the implementation knows about the schema in use when the attribute value is changed, and it is of a different type than CDATA, it may normalize it again at that time. This is especially true of specialized DOM implementations, such as SVG DOM implementations, which store attribute values in an internal form different from a string.

The following table gives some examples of the relations between the attribute value in the original document (parsed attribute), the value as exposed in the DOM, and the serialization of the value:

ExamplesParsed attribute valueInitialAttr.valueSerialized attribute value
Character reference"x&#178;=5""x²=5""x&#178;=5"
Built-in character entity"y&lt;6""y<6""y&lt;6"
Literal newline between"x=5&#10;y=6""x=5 y=6""x=5&#10;y=6"
Normalized newline between"x=5 y=6""x=5 y=6""x=5 y=6"
Entityewith literal newline<!ENTITY e '...&#10;...'> [...]> "x=5&e;y=6"Dependent on Implementation and Load OptionsDependent on Implementation and Load/Save Options

Returns the name of this attribute. IfNode.localNameis different fromnull, this attribute is aqualified name.

Trueif this attribute was explicitly given a value in the instance document,falseotherwise. If the application changed the value of this attribute node (even if it ends up having the same value as the default value) then it is set totrue. The implementation may handle attributes with default values from other schemas similarly but applications should useDocument.normalizeDocument()to guarantee this information is up-to-date.

On retrieval, the value of the attribute is returned as a string. Character and general entity references are replaced with their values. See also the methodgetAttributeon theElementinterface.

On setting, this creates aTextnode 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. See also the methodElement.setAttribute().

Some specialized implementations, such as someimplementations, may do normalization automatically, even after mutation; in such case, the value on retrieval may differ from the value on setting.

NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.

TheElementnode this attribute is attached to ornullif this attribute is not in use.

The type information associated with this attribute. While the type information contained in this attribute is guarantee to be correct after loading the document or invokingDocument.normalizeDocument(),schemaTypeInfomay not be reliable if the node was moved.

Returns whether this attribute is known to be of type ID (i.e. to contain an identifier for its owner element) or not. When it is and its value is unique, theownerElementof this attribute can be retrieved using the methodDocument.getElementById. The implementation could use several ways to determine if an attribute node is known to contain an identifier:

If validation occurred using an XML Schemawhile loading the document or while invokingDocument.normalizeDocument(), the post-schema-validation infoset contributions (PSVI contributions) values are used to determine if this attribute is aschema-determined ID attributeusing theschema-determined IDdefinition in.

If validation occurred using a DTD while loading the document or while invokingDocument.normalizeDocument(), the infoset[type definition]value is used to determine if this attribute is aDTD-determined ID attributeusing theDTD-determined IDdefinition in.

from the use of the methodsElement.setIdAttribute(),Element.setIdAttributeNS(), orElement.setIdAttributeNode(), i.e. it is anuser-determined ID attribute;

XPointer framework (see section 3.2 in) consider the DOMuser-determined ID attributeas being part of the XPointerexternally-determined IDdefinition.

using mechanisms that are outside the scope of this specification, it is then anexternally-determined ID attribute. This includes using schema languages different from XML schema and DTD.

If validation occurred while invokingDocument.normalizeDocument(), alluser-determined ID attributesare reset and all attribute nodes ID information are then reevaluated in accordance to the schema used. As a consequence, if theAttr.schemaTypeInfoattribute contains an ID type,isIdwill always return true.

+

TheElementinterface represents anelementin an HTML or XML document. Elements may have attributes associated with them; since theElementinterface inherits fromNode, the genericNodeinterface attributeattributesmay be used to retrieve the set of all attributes for an element. There are methods on theElementinterface to retrieve either anAttrobject by name or an attribute value by name. In XML, where an attribute value may contain entity references, anAttrobject should be retrieved to examine the possibly fairly complex sub-tree representing the attribute value. On the other hand, in HTML, where all attributes have simple string values, methods to directly access an attribute value can safely be used as aconvenience.

In DOM Level 2, the methodnormalizeis inherited from theNodeinterface where it was moved.

The name of the element. IfNode.localNameis different fromnull, this attribute is aqualified name. For example, in:<elementExample id="demo"> ... </elementExample> ,tagNamehas the value"elementExample". Note that this is case-preserving in XML, as are all of the operations of the DOM. The HTML DOM returns thetagNameof an HTML element in the canonical uppercase form, regardless of the case in the source HTML document.

Retrieves an attribute value by name.

The name of the attribute to retrieve.

TheAttrvalue as a string, or the empty string if that attribute does not have a specified or default value.

Adds a new attribute. If an attribute with that name is already present in the element, its value is changed to be that of the value parameter. This value is a simple string; it is not parsed as it is being set. So any markup (such as syntax to be recognized as an entity reference) is treated as literal text, and needs to be appropriately escaped by the implementation when it is written out. In order to assign an attribute value that contains entity references, the user must create anAttrnode plus anyTextandEntityReferencenodes, build the appropriate subtree, and usesetAttributeNodeto assign it as the value of an attribute.

To set an attribute with a qualified name and namespace URI, use thesetAttributeNSmethod.

The name of the attribute to create or alter.

Value to set in string form.

INVALID_CHARACTER_ERR: Raised if the specified name is not an XML name according to the XML version in use specified in theDocument.xmlVersionattribute.

NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.

Removes an attribute by name. If a default value for the removed attribute is defined in the DTD, a new attribute immediately appears with the default value as well as the corresponding namespace URI, local name, and prefix when applicable. The implementation may handle default values from other schemas similarly but applications should useDocument.normalizeDocument()to guarantee this information is up-to-date.

If no attribute with this name is found, this method has no effect.

To remove an attribute by local name and namespace URI, use theremoveAttributeNSmethod.

The name of the attribute to remove.

NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.

Retrieves an attribute node by name.

To retrieve an attribute node by qualified name and namespace URI, use thegetAttributeNodeNSmethod.

The name (nodeName) of the attribute to retrieve.

TheAttrnode with the specified name (nodeName) ornullif there is no such attribute.

Adds a new attribute node. If an attribute with that name (nodeName) is already present in the element, it is replaced by the new one. Replacing an attribute node by itself has no effect.

To add a new attribute node with a qualified name and namespace URI, use thesetAttributeNodeNSmethod.

TheAttrnode to add to the attribute list.

If thenewAttrattribute replaces an existing attribute, the replacedAttrnode is returned, otherwisenullis returned.

WRONG_DOCUMENT_ERR: Raised ifnewAttrwas created from a different document than the one that created the element.

NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.

INUSE_ATTRIBUTE_ERR: Raised ifnewAttris already an attribute of anotherElementobject. The DOM user must explicitly cloneAttrnodes to re-use them in other elements.

Removes the specified attribute node. If a default value for the removedAttrnode is defined in the DTD, a new node immediately appears with the default value as well as the corresponding namespace URI, local name, and prefix when applicable. The implementation may handle default values from other schemas similarly but applications should useDocument.normalizeDocument()to guarantee this information is up-to-date.

TheAttrnode to remove from the attribute list.

TheAttrnode that was removed.

NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.

NOT_FOUND_ERR: Raised ifoldAttris not an attribute of the element.

Returns aNodeListof alldescendantElementswith a given tag name, indocument order.

The name of the tag to match on. The special value "*" matches all tags.

A list of matchingElementnodes.

Retrieves an attribute value by local name and namespace URI.

Per, applications must use the valuenullas thenamespaceURIparameter for methods if they wish to have no namespace.

Thenamespace URIof the attribute to retrieve.

Thelocal nameof the attribute to retrieve.

TheAttrvalue as a string, or the empty string if that attribute does not have a specified or default value.

NOT_SUPPORTED_ERR: May be raised if the implementation does not support the feature"XML"and the language exposed through the Document does not support XML Namespaces (such as).

Adds a new attribute. If an attribute with the same local name and namespace URI is already present on the element, its prefix is changed to be the prefix part of thequalifiedName, and its value is changed to be thevalueparameter. This value is a simple string; it is not parsed as it is being set. So any markup (such as syntax to be recognized as an entity reference) is treated as literal text, and needs to be appropriately escaped by the implementation when it is written out. In order to assign an attribute value that contains entity references, the user must create anAttrnode plus anyTextandEntityReferencenodes, build the appropriate subtree, and usesetAttributeNodeNSorsetAttributeNodeto assign it as the value of an attribute.

Per, applications must use the valuenullas thenamespaceURIparameter for methods if they wish to have no namespace.

Thenamespace URIof the attribute to create or alter.

Thequalified nameof the attribute to create or alter.

The value to set in string form.

INVALID_CHARACTER_ERR: Raised if the specified qualified name is not an XML name according to the XML version in use specified in theDocument.xmlVersionattribute.

NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.

NAMESPACE_ERR: Raised if thequalifiedNameis malformed per the Namespaces in XML specification, if thequalifiedNamehas a prefix and thenamespaceURIisnull, if thequalifiedNamehas a prefix that is "xml" and thenamespaceURIis different from "http://www.w3.org/XML/1998/namespace", if thequalifiedNameor its prefix is "xmlns" and thenamespaceURIis different from "http://www.w3.org/2000/xmlns/", or if thenamespaceURIis "http://www.w3.org/2000/xmlns/" and neither thequalifiedNamenor its prefix is "xmlns".

NOT_SUPPORTED_ERR: May be raised if the implementation does not support the feature"XML"and the language exposed through the Document does not support XML Namespaces (such as).

Removes an attribute by local name and namespace URI. If a default value for the removed attribute is defined in the DTD, a new attribute immediately appears with the default value as well as the corresponding namespace URI, local name, and prefix when applicable. The implementation may handle default values from other schemas similarly but applications should useDocument.normalizeDocument()to guarantee this information is up-to-date.

If no attribute with this local name and namespace URI is found, this method has no effect.

Per, applications must use the valuenullas thenamespaceURIparameter for methods if they wish to have no namespace.

Thenamespace URIof the attribute to remove.

Thelocal nameof the attribute to remove.

NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.

NOT_SUPPORTED_ERR: May be raised if the implementation does not support the feature"XML"and the language exposed through the Document does not support XML Namespaces (such as).

Retrieves anAttrnode by local name and namespace URI.

Per, applications must use the valuenullas thenamespaceURIparameter for methods if they wish to have no namespace.

Thenamespace URIof the attribute to retrieve.

Thelocal nameof the attribute to retrieve.

TheAttrnode with the specified attribute local name and namespace URI ornullif there is no such attribute.

NOT_SUPPORTED_ERR: May be raised if the implementation does not support the feature"XML"and the language exposed through the Document does not support XML Namespaces (such as).

Adds a new attribute. If an attribute with that local name and that namespace URI is already present in the element, it is replaced by the new one. Replacing an attribute node by itself has no effect.

Per, applications must use the valuenullas thenamespaceURIparameter for methods if they wish to have no namespace.

TheAttrnode to add to the attribute list.

If thenewAttrattribute replaces an existing attribute with the samelocal nameandnamespace URI, the replacedAttrnode is returned, otherwisenullis returned.

WRONG_DOCUMENT_ERR: Raised ifnewAttrwas created from a different document than the one that created the element.

NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.

INUSE_ATTRIBUTE_ERR: Raised ifnewAttris already an attribute of anotherElementobject. The DOM user must explicitly cloneAttrnodes to re-use them in other elements.

NOT_SUPPORTED_ERR: May be raised if the implementation does not support the feature"XML"and the language exposed through the Document does not support XML Namespaces (such as).

Returns aNodeListof all thedescendantElementswith a given local name and namespace URI indocument order.

Thenamespace URIof the elements to match on. The special value "*" matches all namespaces.

Thelocal nameof the elements to match on. The special value "*" matches all local names.

A newNodeListobject containing all the matchedElements.

NOT_SUPPORTED_ERR: May be raised if the implementation does not support the feature"XML"and the language exposed through the Document does not support XML Namespaces (such as).

Returnstruewhen an attribute with a given name is specified on this element or has a default value,falseotherwise.

The name of the attribute to look for.

trueif an attribute with the given name is specified on this element or has a default value,falseotherwise.

Returnstruewhen an attribute with a given local name and namespace URI is specified on this element or has a default value,falseotherwise.

Per, applications must use the valuenullas thenamespaceURIparameter for methods if they wish to have no namespace.

Thenamespace URIof the attribute to look for.

Thelocal nameof the attribute to look for.

trueif an attribute with the given local name and namespace URI is specified or has a default value on this element,falseotherwise.

NOT_SUPPORTED_ERR: May be raised if the implementation does not support the feature"XML"and the language exposed through the Document does not support XML Namespaces (such as).

The type information associated with this element.

If the parameterisIdistrue, this method declares the specified attribute to be auser-determined ID attribute. This affects the value ofAttr.isIdand the behavior ofDocument.getElementById, but does not change any schema that may be in use, in particular this does not affect theAttr.schemaTypeInfoof the specifiedAttrnode. Use the valuefalsefor the parameterisIdto undeclare an attribute for being auser-determined ID attribute.

To specify an attribute by local name and namespace URI, use thesetIdAttributeNSmethod.

The name of the attribute.

Whether the attribute is a of type ID.

NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.

NOT_FOUND_ERR: Raised if the specified node is not an attribute of this element.

If the parameterisIdistrue, this method declares the specified attribute to be auser-determined ID attribute. This affects the value ofAttr.isIdand the behavior ofDocument.getElementById, but does not change any schema that may be in use, in particular this does not affect theAttr.schemaTypeInfoof the specifiedAttrnode. Use the valuefalsefor the parameterisIdto undeclare an attribute for being auser-determined ID attribute.

Thenamespace URIof the attribute.

Thelocal nameof the attribute.

Whether the attribute is a of type ID.

NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.

NOT_FOUND_ERR: Raised if the specified node is not an attribute of this element.

If the parameterisIdistrue, this method declares the specified attribute to be auser-determined ID attribute. This affects the value ofAttr.isIdand the behavior ofDocument.getElementById, but does not change any schema that may be in use, in particular this does not affect theAttr.schemaTypeInfoof the specifiedAttrnode. Use the valuefalsefor the parameterisIdto undeclare an attribute for being auser-determined ID attribute.

The attribute node.

Whether the attribute is a of type ID.

NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.

NOT_FOUND_ERR: Raised if the specified node is not an attribute of this element.

+

TheTextinterface inherits fromCharacterDataand represents the textual content (termedcharacter datain XML) of anElementorAttr. If there is no markup inside an element's content, the text is contained in a single object implementing theTextinterface that is the only child of the element. If there is markup, it is parsed into theinformation items(elements, comments, etc.) andTextnodes that form the list of children of the element.

When a document is first made available via the DOM, there is only oneTextnode for each block of text. Users may create adjacentTextnodes that represent the contents of a given element without any intervening markup, but should be aware that there is no way to represent the separations between these nodes in XML or HTML, so they will not (in general) persist between DOM editing sessions. TheNode.normalize()method merges any such adjacentTextobjects into a single node for each block of text.

No lexical check is done on the content of aTextnode and, depending on its position in the document, some characters must be escaped during serialization using character references; e.g. the characters "<&" if the textual content is part of an element or of an attribute, the character sequence "]]>" when part of an element, the quotation mark character " or the apostrophe character ' when part of an attribute.

Breaks this node into two nodes at the specifiedoffset, keeping both in the tree assiblings. After being split, this node will contain all the content up to theoffsetpoint. A new node of the same type, which contains all the content at and after theoffsetpoint, is returned. If the original node had a parent node, the new node is inserted as the nextsiblingof the original node. When theoffsetis equal to the length of this node, the new node has no data.

The16-bit unitoffset at which to split, starting from0.

The new node, of the same type as this node.

INDEX_SIZE_ERR: Raised if the specified offset is negative or greater than the number of 16-bit units indata.

NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.

Returns whether this text node containselement content whitespace, often abusively called "ignorable whitespace". The text node is determined to contain whitespace in element content during the load of the document or if validation occurs while usingDocument.normalizeDocument().

Returns all text ofTextnodeslogically-adjacent text nodesto this node, concatenated in document order.

For instance, in the example belowwholeTexton theTextnode that contains "bar" returns "barfoo", while on theTextnode that contains "foo" it returns "barfoo".

Replaces the text of the current node and alllogically-adjacent text nodeswith the specified text. Alllogically-adjacent text nodesare removed including the current node unless it was the recipient of the replacement text.

This method returns the node which received the replacement text. The returned node is:

null, when the replacement text is the empty string;

the current node, except when the current node isread-only;

a newTextnode of the same type (TextorCDATASection) as the current node inserted at the location of the replacement.

For instance, in the above example callingreplaceWholeTexton theTextnode that contains "bar" with "yo" in argument results in the following:

Where the nodes to be removed are read-only descendants of anEntityReference, theEntityReferencemust be removed instead of the read-only nodes. If anyEntityReferenceto be removed has descendants that are notEntityReference,Text, orCDATASectionnodes, thereplaceWholeTextmethod must fail before performing any modification of the document, raising aDOMExceptionwith the codeNO_MODIFICATION_ALLOWED_ERR.

For instance, in the example below callingreplaceWholeTexton theTextnode that contains "bar" fails, because theEntityReferencenode "ent" contains anElementnode which cannot be removed.

The content of the replacingTextnode.

TheTextnode created with the specified content.

NO_MODIFICATION_ALLOWED_ERR: Raised if one of theTextnodes being replaced is readonly.

+

This interface inherits fromCharacterDataand represents the content of a comment, i.e., all the characters between the starting '<!--' and ending '-->'. Note that this is the definition of a comment in XML, and, in practice, HTML, although some HTML tools may implement the full SGML comment structure.

No lexical check is done on the content of a comment and it is therefore possible to have the character sequence"--"(double-hyphen) in the content, which is illegal in a comment per section 2.5 of. The presence of this character sequence must generate a fatal error during serialization.

+

TheTypeInfointerface represents a type referenced fromElementorAttrnodes, specified in theschemasassociated with the document. The type is a pair of anamespace URIand name properties, and depends on the document's schema.

If the document's schema is an XML DTD, the values are computed as follows:

If this type is referenced from anAttrnode,typeNamespaceis"http://www.w3.org/TR/REC-xml"andtypeNamerepresents the[attribute type]property in the. If there is no declaration for the attribute,typeNamespaceandtypeNamearenull.

If this type is referenced from anElementnode,typeNamespaceandtypeNamearenull.

If the document's schema is an XML Schema, the values are computed as follows using the post-schema-validation infoset contributions (also called PSVI contributions):

If the[validity]property exists AND is"invalid"or"notKnown": the {target namespace} and {name} properties of the declared type if available, otherwisenull.

At the time of writing, the XML Schema specification does not require exposing the declared type. Thus, DOM implementations might choose not to provide type information if validity is not valid.

If the[validity]property exists and is"valid":

If[member type definition]exists:

If {name} is not absent, then expose {name} and {target namespace} properties of the[member type definition]property;

Otherwise, expose the namespace and local name of the correspondinganonymous type name.

If the[type definition]property exists:

If {name} is not absent, then expose {name} and {target namespace} properties of the[type definition]property;

Otherwise, expose the namespace and local name of the correspondinganonymous type name.

If the[member type definition anonymous]exists:

If it is false, then expose[member type definition name]and[member type definition namespace]properties;

Otherwise, expose the namespace and local name of the correspondinganonymous type name.

If the[type definition anonymous]exists:

If it is false, then expose[type definition name]and[type definition namespace]properties;

Otherwise, expose the namespace and local name of the correspondinganonymous type name.

Other schema languages are outside the scope of the W3C and therefore should define how to represent their type systems usingTypeInfo.

The name of a type declared for the associated element or attribute, ornullif unknown.

The namespace of the type declared for the associated element or attribute ornullif the element does not have declaration or if no namespace information is available.

These are the available values for thederivationMethodparameter used by the methodTypeInfo.isDerivedFrom(). It is a set of possible types of derivation, and the values represent bit positions. If a bit in thederivationMethodparameter is set to1, the corresponding type of derivation will be taken into account when evaluating the derivation between the reference type definition and the other type definition. When using theisDerivedFrommethod, combining all of them in thederivationMethodparameter is equivalent to invoking the method for each of them separately and combining the results with the OR boolean function. This specification only defines the type of derivation for XML Schema.

In addition to the types of derivation listed below, please note that:

any type derives fromxsd:anyType.

any simple type derives fromxsd:anySimpleTypebyrestriction.

any complex type does not derive fromxsd:anySimpleTypebyrestriction.

If the document's schema is an XML Schema, this constant represents the derivation byrestrictionif complex types are involved, or arestrictionif simple types are involved.

The reference type definition is derived byrestrictionfrom the other type definition if the other type definition is the same as the reference type definition, or if the other type definition can be reached recursively following the {base type definition} property from the reference type definition, and all thederivation methodsinvolved arerestriction.

If the document's schema is an XML Schema, this constant represents the derivation byextension.

The reference type definition is derived byextensionfrom the other type definition if the other type definition can be reached recursively following the {base type definition} property from the reference type definition, and at least one of thederivation methodsinvolved is anextension.

If the document's schema is an XML Schema, this constant represents theunionif simple types are involved.

The reference type definition is derived byunionfrom the other type definition if there exists two type definitions T1 and T2 such as the reference type definition is derived from T1 byDERIVATION_RESTRICTIONorDERIVATION_EXTENSION, T2 is derived from the other type definition byDERIVATION_RESTRICTION, T1 has {variety}union, and one of the {member type definitions} is T2. Note that T1 could be the same as the reference type definition, and T2 could be the same as the other type definition.

If the document's schema is an XML Schema, this constant represents thelist.

The reference type definition is derived bylistfrom the other type definition if there exists two type definitions T1 and T2 such as the reference type definition is derived from T1 byDERIVATION_RESTRICTIONorDERIVATION_EXTENSION, T2 is derived from the other type definition byDERIVATION_RESTRICTION, T1 has {variety}list, and T2 is the {item type definition}. Note that T1 could be the same as the reference type definition, and T2 could be the same as the other type definition.

This method returns if there is a derivation between the reference type definition, i.e. theTypeInfoon which the method is being called, and the other type definition, i.e. the one passed as parameters.

the namespace of the other type definition.

the name of the other type definition.

the type of derivation and conditions applied between two types, as described in the list of constants provided in this interface.

If the document's schema is a DTD or no schema is associated with the document, this method will always returnfalse.

If the document's schema is an XML Schema, the method willtrueif the reference type definition is derived from the other type definition according to the derivation parameter. If the value of the parameter is0(no bit is set to1for thederivationMethodparameter), the method will returntrueif the other type definition can be reached by recursing any combination of {base type definition}, {item type definition}, or {member type definitions} from the reference type definition.

+

When associating an object to a key on a node usingNode.setUserData()the application can provide a handler that gets called when the node the object is associated to is being cloned, imported, or renamed. This can be used by the application to implement various behaviors regarding the data it associates to the DOM nodes. This interface defines that handler.

An integer indicating the type of operation being performed on a node.

The node is cloned, usingNode.cloneNode().

The node is imported, usingDocument.importNode().

The node is deleted.

This may not be supported or may not be reliable in certain environments, such as Java, where the implementation has no real control over when objects are actually deleted.

The node is renamed, usingDocument.renameNode().

The node is adopted, usingDocument.adoptNode().

This method is called whenever the node for which this handler is registered is imported or cloned.

DOM applications must not raise exceptions in aUserDataHandler. The effect of throwing exceptions from the handler is DOM implementation dependent.

Specifies the type of operation that is being performed on the node.

Specifies the key for which this handler is being called.

Specifies the data for which this handler is being called.

Specifies the node being cloned, adopted, imported, or renamed. This isnullwhen the node is being deleted.

Specifies the node newly created if any, ornull.

+

DOMErroris an interface that describes an error.

An integer indicating the severity of the error.

The severity of the error described by theDOMErroris warning. ASEVERITY_WARNINGwill not cause the processing to stop, unlessDOMErrorHandler.handleError()returnsfalse.

The severity of the error described by theDOMErroris error. ASEVERITY_ERRORmay not cause the processing to stop if the error can be recovered, unlessDOMErrorHandler.handleError()returnsfalse.

The severity of the error described by theDOMErroris fatal error. ASEVERITY_FATAL_ERRORwill cause the normal processing to stop. The return value ofDOMErrorHandler.handleError()is ignored unless the implementation chooses to continue, in which case the behavior becomes undefined.

The severity of the error, eitherSEVERITY_WARNING,SEVERITY_ERROR, orSEVERITY_FATAL_ERROR.

An implementation specific string describing the error that occurred.

ADOMStringindicating which related data is expected inrelatedData. Users should refer to the specification of the error in order to find itsDOMStringtype andrelatedDatadefinitions if any.

As an example,Document.normalizeDocument()does generate warnings when the "split-cdata-sections" parameter is in use. Therefore, the method generates aSEVERITY_WARNINGwithtype"cdata-sections-splitted"and the firstCDATASectionnode in document order resulting from the split is returned by therelatedDataattribute.

The related platform dependent exception if any.

The relatedDOMError.typedependent data if any.

The location of the error.

+

DOMErrorHandleris a callback interface that the DOM implementation can call when reporting errors that happens while processing XML data, or when doing some other processing (e.g. validating a document). ADOMErrorHandlerobject can be attached to aDocumentusing the "error-handler" on theDOMConfigurationinterface. If more than one error needs to be reported during an operation, the sequence and numbers of the errors passed to the error handler are implementation dependent.

The application that is using the DOM implementation is expected to implement this interface.

This method is called on the error handler when an error occurs.

If an exception is thrown from this method, it is considered to be equivalent of returningtrue.

The error object that describes the error. This object may be reused by the DOM implementation across multiple calls to thehandleErrormethod.

If thehandleErrormethod returnsfalse, the DOM implementation should stop the current processing when possible. If the method returnstrue, the processing may continue depending onDOMError.severity.

+

DOMLocatoris an interface that describes a location (e.g. where an error occurred).

The line number this locator is pointing to, or-1if there is no column number available.

The column number this locator is pointing to, or-1if there is no column number available.

The byte offset into the input source this locator is pointing to or-1if there is no byte offset available.

The UTF-16, as defined inand Amendment 1 of, offset into the input source this locator is pointing to or-1if there is no UTF-16 offset available.

The node this locator is pointing to, ornullif no node is available.

The URI this locator is pointing to, ornullif no URI is available.

+

TheDOMConfigurationinterface represents the configuration of a document and maintains a table of recognized parameters. Using the configuration, it is possible to changeDocument.normalizeDocument()behavior, such as replacing theCDATASectionnodes withTextnodes or specifying the type of theschemathat must be used when the validation of theDocumentis requested.DOMConfigurationobjects are also used inin theDOMParserandDOMSerializerinterfaces.

The parameter names used by theDOMConfigurationobject are defined throughout the DOM Level 3 specifications. Names are case-insensitive. To avoid possible conflicts, as a convention, names referring to parameters defined outside the DOM specification should be made unique. Because parameters are exposed as properties in the, names are recommended to follow the section5.16 Identifiersofwith the addition of the character '-' (HYPHEN-MINUS) but it is not enforced by the DOM implementation. DOM Level 3 Core Implementations are required to recognize all parameters defined in this specification. Some parameter values may also be required to be supported by the implementation. Refer to the definition of the parameter to know if a value must be supported or not.

Parameters are similar to features and properties used in SAX2.

The following list of parameters defined in the DOM:

[optional]

Canonicalize the document according to the rules specified in, such as removing theDocumentTypenode (if any) from the tree, or removing superfluous namespace declarations from each element. Note that this is limited to what can be represented in the DOM; in particular, there is no way to specify the order of the attributes in the DOM. In addition,

Setting this parameter totruewill also set the state of the parameters listed below. Later changes to the state of one of those parameters will revert "canonical-form" back tofalse.

Parameters set tofalse: "entities", "normalize-characters", "cdata-sections".

Parameters set totrue: "namespaces", "namespace-declarations", "well-formed", "element-content-whitespace".

Other parameters are not changed unless explicitly specified in the description of the parameters.

[required] (default)

Do not canonicalize the document.

[required] (default)

KeepCDATASectionnodes in the document.

[required]

TransformCDATASectionnodes in the document intoTextnodes. The newTextnode is then combined with any adjacentTextnode.

[optional]

Check if the characters in the document arefully normalized, as defined in appendix B of. When a sequence of characters is encountered that fails normalization checking, an error with theDOMError.typeequals to "check-character-normalization-failure" is issued.

[required] (default)

Do not check if characters are normalized.

[required] (default)

KeepCommentnodes in the document.

[required]

DiscardCommentnodes in the document.

[optional]

Expose schema normalized values in the tree, such asXML Schema normalized valuesin the case of XML Schema. Since this parameter requires to haveschemainformation, the "validate" parameter will also be set totrue. Having this parameter activated when "validate" isfalsehas no effect and no schema-normalization will happen.

Since the document contains the result of the XML 1.0 processing, this parameter does not apply to attribute value normalization as defined in section 3.3.3 ofand is only meant forschemalanguages other than Document Type Definition (DTD).

[required] (default)

Do not perform schema normalization on the tree.

[required] (default)

Keep all whitespaces in the document.

[optional]

Discard allTextnodes that contain whitespaces in element content, as described in[element content whitespace]. The implementation is expected to use the attributeText.isElementContentWhitespaceto determine if aTextnode should be discarded or not.

[required] (default)

KeepEntityReferencenodes in the document.

[required]

Remove allEntityReferencenodes from the document, putting the entity expansions directly in their place.Textnodes are normalized, as defined inNode.normalize. Onlyunexpanded entity referencesare kept in the document.

This parameter does not affectEntitynodes.

[required]

Contains aDOMErrorHandlerobject. If an error is encountered in the document, the implementation will call back theDOMErrorHandlerregistered using this parameter. The implementation may provide a defaultDOMErrorHandlerobject.

When called,DOMError.relatedDatawill contain the closest node to where the error occurred. If the implementation is unable to determine the node where the error occurs,DOMError.relatedDatawill contain theDocumentnode. Mutations to the document from within an error handler will result in implementation dependent behavior.

[required]

Keep in the document the information defined in the XML Information Set.

This forces the following parameters tofalse: "validate-if-schema", "entities", "datatype-normalization", "cdata-sections".

This forces the following parameters totrue: "namespace-declarations", "well-formed", "element-content-whitespace", "comments", "namespaces".

Other parameters are not changed unless explicitly specified in the description of the parameters.

Note that querying this parameter withgetParameterreturnstrueonly if the individual parameters specified above are appropriately set.

Settinginfosettofalsehas no effect.

[required] (default)

Perform the namespace processing as defined in.

[optional]

Do not perform the namespace processing.

This parameter has no effect if the parameter "namespaces" is set tofalse.

[required] (default)

Include namespace declaration attributes, specified or defaulted from theschema, in the document. See also the sections "Declaring Namespaces" inand.

[required]

Discard all namespace declaration attributes. The namespace prefixes (Node.prefix) are retained even if this parameter is set tofalse.

[optional]

Fully normalizedthe characters in the document as defined in appendix B of.

[required] (default)

Do not perform character normalization.

[optional]

Represent aDOMStringobject containing a list of URIs, separated by whitespaces (characters matching thenonterminal production Sdefined in section 2.3), that represents theschemasagainst which validation should occur, i.e. the current schema. The types of schemas referenced in this list must match the type specified withschema-type, otherwise the behavior of an implementation is undefined.

The schemas specified using this property take precedence to the schema information specified in the document itself. For namespace aware schema, if a schema specified using this property and a schema specified in the document instance (i.e. using theschemaLocationattribute) in a schema document (i.e. using schemaimportmechanisms) share the sametargetNamespace, the schema specified by the user using this property will be used. If two schemas specified using this property share the sametargetNamespaceor have no namespace, the behavior is implementation dependent.

If no location has been provided, this parameter isnull.

The"schema-location"parameter is ignored unless the "schema-type" parameter value is set. It is strongly recommended thatDocument.documentURIwill be set so that an implementation can successfully resolve any external entities referenced.

[optional]

Represent aDOMStringobject containing an absolute URI and representing the type of theschemalanguage used to validate a document against. Note that no lexical checking is done on the absolute URI.

If this parameter is not set, a default value may be provided by the implementation, based on the schema languages supported and on the schema language used at load time. If no value is provided, this parameter isnull.

For XML Schema, applications must use the value"http://www.w3.org/2001/XMLSchema". For XML DTD, applications must use the value"http://www.w3.org/TR/REC-xml". Other schema languages are outside the scope of the W3C and therefore should recommend an absolute URI in order to use this method.

[required] (default)

Split CDATA sections containing the CDATA section termination marker ']]>'. When a CDATA section is split a warning is issued with aDOMError.typeequals to"cdata-sections-splitted"andDOMError.relatedDataequals to the firstCDATASectionnode in document order resulting from the split.

[required]

Signal an error if aCDATASectioncontains an unrepresentable character.

[optional]

Require the validation against aschema(i.e. XML schema, DTD, any other type or representation of schema) of the document as it is being normalized as defined by. If validation errors are found, or no schema was found, the error handler is notified. Schema-normalized values will not be exposed according to the schema in used unless the parameter "datatype-normalization" istrue.

This parameter will reevaluate:

Attribute nodes withAttr.specifiedequals tofalse, as specified in the description of theAttrinterface;

The value of the attributeText.isElementContentWhitespacefor allTextnodes;

The value of the attributeAttr.isIdfor allAttrnodes;

The attributesElement.schemaTypeInfoandAttr.schemaTypeInfo.

"validate-if-schema" and "validate" are mutually exclusive, setting one of them totruewill set the other one tofalse. Applications should also consider setting the parameter "well-formed" totrue, which is the default for that option, when validating the document.

[required] (default)

Do not accomplish schema processing, including the internal subset processing. Default attribute values information are kept. Note that validation might still happen if "validate-if-schema" istrue.

[optional]

Enable validation only if a declaration for the document element can be found in aschema(independently of where it is found, i.e. XML schema, DTD, or any other type or representation of schema). If validation is enabled, this parameter has the same behavior as the parameter "validate" set totrue.

"validate-if-schema" and "validate" are mutually exclusive, setting one of them totruewill set the other one tofalse.

[required] (default)

No schema processing should be performed if the document has a schema, including internal subset processing. Default attribute values information are kept. Note that validation must still happen if "validate" istrue.

[required] (default)

Check if all nodes are XMLwell formedaccording to the XML version in use inDocument.xmlVersion:

check if the attributeNode.nodeNamecontains invalid characters according to its node type and generate aDOMErrorof type"wf-invalid-character-in-node-name", with aDOMError.SEVERITY_ERRORseverity, if necessary;

check if the text content insideAttr,Element,Comment,Text,CDATASectionnodes for invalid characters and generate aDOMErrorof type"wf-invalid-character", with aDOMError.SEVERITY_ERRORseverity, if necessary;

check if the data insideProcessingInstructionnodes for invalid characters and generate aDOMErrorof type"wf-invalid-character", with aDOMError.SEVERITY_ERRORseverity, if necessary;

[optional]

Do not check for XML well-formedness.

The resolution of the system identifiers associated with entities is done usingDocument.documentURI. However, when the feature "LS" defined inis supported by the DOM implementation, the parameter "resource-resolver" can also be used onDOMConfigurationobjects attached toDocumentnodes. If this parameter is set,Document.normalizeDocument()will invoke the resource resolver instead of usingDocument.documentURI.

Set the value of a parameter.

The name of the parameter to set.

The new value ornullif the user wishes to unset the parameter. While the type of the value parameter is defined asDOMUserData, the object type must match the type defined by the definition of the parameter. For example, if the parameter is"error-handler", the value must be of typeDOMErrorHandler.

NOT_FOUND_ERR: Raised when the parameter name is not recognized.

NOT_SUPPORTED_ERR: Raised when the parameter name is recognized but the requested value cannot be set.

TYPE_MISMATCH_ERR: Raised if the value type for this parameter name is incompatible with the expected value type.

Return the value of a parameter if known.

The name of the parameter.

The current object associated with the specified parameter ornullif no object has been associated or if the parameter is not supported.

NOT_FOUND_ERR: Raised when the parameter name is not recognized.

Check if setting a parameter to a specific value is supported.

The name of the parameter to check.

An object. ifnull, the returned value istrue.

trueif the parameter could be successfully set to the specified value, orfalseif the parameter is not recognized or the requested value is not supported. This does not change the current value of the parameter itself.

The list of the parameters supported by thisDOMConfigurationobject and for which at least one value can be set by the application. Note that this list can also contain parameter names defined outside this specification.

+

CDATA sections are used to escape blocks of text containing characters that would otherwise be regarded as markup. The only delimiter that is recognized in a CDATA section is the "]]>" string that ends the CDATA section. CDATA sections cannot be nested. Their primary purpose is for including material such as XML fragments, without needing to escape all the delimiters.

TheCharacterData.dataattribute holds the text that is contained by the CDATA section. Note that thismaycontain characters that need to be escaped outside of CDATA sections and that, depending on the character encoding ("charset") chosen for serialization, it may be impossible to write out some characters as part of a CDATA section.

TheCDATASectioninterface inherits from theCharacterDatainterface through theTextinterface. AdjacentCDATASectionnodes are not merged by use of thenormalizemethod of theNodeinterface.

No lexical check is done on the content of a CDATA section and it is therefore possible to have the character sequence"]]>"in the content, which is illegal in a CDATA section per section 2.7 of. The presence of this character sequence must generate a fatal error during serialization or the cdata section must be splitted before the serialization (see also the parameter"split-cdata-sections"in theDOMConfigurationinterface).

Because no markup is recognized within aCDATASection, character numeric references cannot be used as an escape mechanism when serializing. Therefore, action needs to be taken when serializing aCDATASectionwith a character encoding where some of the contained characters cannot be represented. Failure to do so would not produce well-formed XML.

One potential solution in the serialization process is to end the CDATA section before the character, output the character using a character reference or entity reference, and open a new CDATA section for any further characters in the text node. Note, however, that some code conversion libraries at the time of writing do not return an error or exception when a character is missing from the encoding, making the task of ensuring that data is not corrupted on serialization more difficult.

+

EachDocumenthas adoctypeattribute whose value is eithernullor aDocumentTypeobject. TheDocumentTypeinterface in the DOM Core provides an interface to the list of entities that are defined for the document, and little else because the effect of namespaces and the various XML schema efforts on DTD representation are not clearly understood as of this writing.

DOM Level 3 doesn't support editingDocumentTypenodes.DocumentTypenodes areread-only.

The name of DTD; i.e., the name immediately following theDOCTYPEkeyword.

ANamedNodeMapcontaining the general entities, both external and internal, declared in the DTD. Parameter entities are not contained. Duplicates are discarded. For example in:<!DOCTYPE ex SYSTEM "ex.dtd" [ <!ENTITY foo "foo"> <!ENTITY bar "bar"> <!ENTITY bar "bar2"> <!ENTITY % baz "baz"> ]> <ex/>the interface provides access tofooand the first declaration ofbarbut not the second declaration ofbarorbaz. Every node in this map also implements theEntityinterface.

The DOM Level 2 does not support editing entities, thereforeentitiescannot be altered in any way.

ANamedNodeMapcontaining the notations declared in the DTD. Duplicates are discarded. Every node in this map also implements theNotationinterface.

The DOM Level 2 does not support editing notations, thereforenotationscannot be altered in any way.

The public identifier of the external subset.

The system identifier of the external subset. This may be an absolute URI or not.

The internal subset as a string, ornullif there is none. This is does not contain the delimiting square brackets.

The actual content returned depends on how much information is available to the implementation. This may vary depending on various parameters, including the XML processor used to build the document.

+

This interface represents a notation declared in the DTD. A notation either declares, by name, the format of an unparsed entity (seesection 4.7of the XML 1.0 specification), or is used for formal declaration of processing instruction targets (seesection 2.6of the XML 1.0 specification). ThenodeNameattribute inherited fromNodeis set to the declared name of the notation.

The DOM Core does not support editingNotationnodes; they are thereforereadonly.

ANotationnode does not have any parent.

The public identifier of this notation. If the public identifier was not specified, this isnull.

The system identifier of this notation. If the system identifier was not specified, this isnull. This may be an absolute URI or not.

+

This interface represents a known entity, either parsed or unparsed, in an XML document. Note that this models the entity itselfnotthe entity declaration.

ThenodeNameattribute that is inherited fromNodecontains the name of the entity.

An XML processor may choose to completely expand entities before the structure model is passed to the DOM; in this case there will be noEntityReferencenodes in the document tree.

XML does not mandate that a non-validating XML processor read and process entity declarations made in the external subset or declared in parameter entities. This means that parsed entities declared in the external subset need not be expanded by some classes of applications, and that the replacement text of the entity may not be available. When thereplacement textis available, the correspondingEntitynode's child list represents the structure of that replacement value. Otherwise, the child list is empty.

DOM Level 3 does not support editingEntitynodes; if a user wants to make changes to the contents of anEntity, every relatedEntityReferencenode has to be replaced in the structure model by a clone of theEntity's contents, and then the desired changes must be made to each of those clones instead.Entitynodes and all theirdescendantsarereadonly.

AnEntitynode does not have any parent.

If the entity contains an unboundnamespace prefix, thenamespaceURIof the corresponding node in theEntitynode subtree isnull. The same is true forEntityReferencenodes that refer to this entity, when they are created using thecreateEntityReferencemethod of theDocumentinterface.

The public identifier associated with the entity if specified, andnullotherwise.

The system identifier associated with the entity if specified, andnullotherwise. This may be an absolute URI or not.

For unparsed entities, the name of the notation for the entity. For parsed entities, this isnull.

An attribute specifying the encoding used for this entity at the time of parsing, when it is an external parsed entity. This isnullif it an entity from the internal subset or if it is not known.

An attribute specifying, as part of the text declaration, the encoding of this entity, when it is an external parsed entity. This isnullotherwise.

An attribute specifying, as part of the text declaration, the version number of this entity, when it is an external parsed entity. This isnullotherwise.

+

EntityReferencenodes may be used to represent an entity reference in the tree. Note that character references and references to predefined entities are considered to be expanded by the HTML or XML processor so that characters are represented by their Unicode equivalent rather than by an entity reference. Moreover, the XML processor may completely expand references to entities while building theDocument, instead of providingEntityReferencenodes. If it does provide such nodes, then for anEntityReferencenode that represents a reference to a known entity anEntityexists, and the subtree of theEntityReferencenode is a copy of theEntitynode subtree. However, the latter may not be true when an entity contains an unboundnamespace prefix. In such a case, because the namespace prefix resolution depends on where the entity reference is, thedescendantsof theEntityReferencenode may be bound to differentnamespace URIs. When anEntityReferencenode represents a reference to an unknown entity, the node has no children and its replacement value, when used byAttr.valuefor example, is empty.

As forEntitynodes,EntityReferencenodes and all theirdescendantsarereadonly.

EntityReferencenodes may cause element content and attribute value normalization problems when, such as in XML 1.0 and XML Schema, the normalization is performed after entity reference are expanded.

+

TheProcessingInstructioninterface represents a "processing instruction", used in XML as a way to keep processor-specific information in the text of the document.

No lexical check is done on the content of a processing instruction and it is therefore possible to have the character sequence"?>"in the content, which is illegal a processing instruction per section 2.6 of. The presence of this character sequence must generate a fatal error during serialization.

The target of this processing instruction. XML defines this as being the firsttokenfollowing the markup that begins the processing instruction.

The content of this processing instruction. This is from the first non white space character after the target to the character immediately preceding the?>.

NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.

+

Extensions to a language's native String class or interface

Returns the UTF-16 offset that corresponds to a UTF-32 offset. Used for random access.

You can always round-trip from a UTF-32 offset to a UTF-16 offset and back. You can round-trip from a UTF-16 offset to a UTF-32 offset and back if and only if the offset16 is not in the middle of a surrogate pair. Unmatched surrogates count as a single UTF-16 value.

UTF-32 offset.

UTF-16 offset

ifoffset32is out of bounds.

Returns the UTF-32 offset corresponding to a UTF-16 offset. Used for random access. To find the UTF-32 length of a string, use:len32 = findOffset32(source, source.length());

If the UTF-16 offset is into the middle of a surrogate pair, then the UTF-32 offset of theendof the pair is returned; that is, the index of the char after the end of the pair. You can always round-trip from a UTF-32 offset to a UTF-16 offset and back. You can round-trip from a UTF-16 offset to a UTF-32 offset and back if and only if the offset16 is not in the middle of a surrogate pair. Unmatched surrogates count as a single UTF-16 value.

UTF-16 offset

UTF-32 offset

if offset16 is out of bounds.

+
diff --git a/test/leak-test.sh b/test/leak-test.sh new file mode 100755 index 0000000..4a6ea13 --- /dev/null +++ b/test/leak-test.sh @@ -0,0 +1,45 @@ +#!/bin/bash +# +# This is a simple script used to test libdom memory leakage. +# Usage: +# You should firstly run "run-test.sh", which will genrate a test output directory. In that +# directory, there are C source files and corresponding executables. +# Go to the test output directory. For example , for core, level 1, it is output/level1/core +# And run this script as ../../../leak-test.sh "log-file" +# +# This file is part of libdom test suite. +# Licensed under the MIT License, +# http://www.opensource.org/licenses/mit-license.php +# Copyright 2009 Bo Yang + +log=$1; +totla=0; +leak=0; +ok=0; +while read f; do + #Test defnitely lost + echo -n "$f: " >&3; + echo -n "$f: "; + dl=$(valgrind "$f" 2>&1 | grep "definitely lost" | sed -e 's/definitely lost//g' -e 's/bytes in//g' -e 's/blocks.//g' -e 's/^.*://g' -e 's/ //g' -e 's/,//g'); + pl=$(valgrind "$f" 2>&1 | grep "possibly lost" | sed -e 's/possibly lost//g' -e 's/bytes in//g' -e 's/blocks.//g' -e 's/^.*://g' -e 's/ //g' -e 's/,//g'); + + total=$((total+1)); + if [ "$dl" -eq "00" -a "$pl" -eq "00" ]; then + echo "ok..." >&3; + echo "ok..."; + ok=$((ok+1)); + else + echo "leaked!" >&3; + echo "leaked!"; + leak=$((leak+1)); + fi + +done 3>"$log" < <(find ./ -perm -o=x -type f -print); + +echo "Total: $total" >>"$log"; +echo "Leak: $leak" >>"$log"; +echo "Ok: $ok" >>"$log"; + +echo "Total: $total"; +echo "Leak: $leak"; +echo "Ok: $ok"; diff --git a/test/lib/comparators.c b/test/lib/comparators.c deleted file mode 100644 index c07236d..0000000 --- a/test/lib/comparators.c +++ /dev/null @@ -1,5 +0,0 @@ -#include "comparators.h" - -int int_comparator(const int* a, const int* b) { - return (*a) - (*b); -} diff --git a/test/lib/comparators.h b/test/lib/comparators.h deleted file mode 100644 index 4cdeb97..0000000 --- a/test/lib/comparators.h +++ /dev/null @@ -1,18 +0,0 @@ -/* - * This file is part of libdom test suite. - * Licensed under the MIT License, - * http://www.opensource.org/licenses/mit-license.php - * Copyright 2007 James Shaw - */ - -#ifndef comparators_h_ -#define comparators_h_ - -/** - * A function pointer type for a comparator. - */ -typedef int (*comparator)(const void* a, const void* b); - -int int_comparator(const int* a, const int* b); - -#endif diff --git a/test/lib/exceptions.h b/test/lib/exceptions.h deleted file mode 100644 index 8b98d5b..0000000 --- a/test/lib/exceptions.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * This file is part of libdom test suite. - * Licensed under the MIT License, - * http://www.opensource.org/licenses/mit-license.php - * Copyright 2007 James Shaw - */ - -#ifndef exceptions_h_ -#define exceptions_h_ - -#include - -#include - -/* Adapted from http://www.math.princeton.edu/~asnowden/c-except.html - Usage: - TRY - THROW(DOM_NOT_FOUND_ERR); - THROW_IF_ERR(dom_document_get_doctype(...)); - CATCH(ex) - printf("exception: %d\n", ex); - ENDTRY -*/ -#define TRY __exvalue=setjmp(__exbuf); \ - if (__exvalue==0) { -#define CATCH(x) } else { \ - int x = __exvalue; -#define ENDTRY } -#define THROW(x) longjmp(__exbuf, x) - -#define THROW_IF_ERR(x) \ - do { \ - int err = x; \ - if (err != DOM_NO_ERR) \ - THROW(err); \ - } while (0) - -jmp_buf __exbuf; -int __exvalue; - -#endif - diff --git a/test/lib/list.c b/test/lib/list.c deleted file mode 100644 index e72b50c..0000000 --- a/test/lib/list.c +++ /dev/null @@ -1,154 +0,0 @@ -/* - * This file is part of libdom test suite. - * Licensed under the MIT License, - * http://www.opensource.org/licenses/mit-license.php - * Copyright 2007 James Shaw - */ - - -#include -#include -#include - -#include "comparators.h" -#include "list.h" -#include "testassert.h" - -/** - * Private helper function. - * Create a new list_elt and initialise it. - */ -struct list_elt* list_new_elt(void* data); - -struct list_elt* list_new_elt(void* data) { - struct list_elt* elt = malloc(sizeof(struct list_elt)); - assert(elt != NULL); - elt->data = data; - elt->next = NULL; - return elt; -} - -struct list* list_new(void) -{ - struct list* list = malloc(sizeof(struct list)); - assert(list != NULL); - list->size = 0; - list->head = NULL; - list->tail = NULL; - return list; -} - -void list_destroy(struct list* list) -{ - struct list_elt* elt = list->head; - while (elt != NULL) { - struct list_elt* nextElt = elt->next; - free(elt); - elt = nextElt; - } - free(list); -} - -void list_add(struct list* list, void* data) -{ - struct list_elt* elt = list_new_elt(data); - struct list_elt* tail = list->tail; - - /* if tail was set, make its 'next' ptr point to elt */ - if (tail != NULL) { - tail->next = elt; - } - - /* make elt the new tail */ - list->tail = elt; - - if (list->head == NULL) { - list->head = elt; - } - - /* inc the size of the list */ - list->size++; -} - -bool list_remove(struct list* list, void* data) -{ - struct list_elt* prevElt = NULL; - struct list_elt* elt = list->head; - - bool found = false; - - while (elt != NULL) { - struct list_elt* nextElt = elt->next; - - /* if data is identical, fix up pointers, and free the element */ - if (data == elt->data) { - if (prevElt == NULL) { - list->head = nextElt; - } else { - prevElt->next = nextElt; - } - free(elt); - list->size--; - found = true; - break; - } - - prevElt = elt; - elt = nextElt; - } - - return found; -} - -struct list* list_clone(struct list* list) -{ - struct list* newList = list_new(); - struct list_elt* elt = list->head; - - while (elt != NULL) { - list_add(newList, elt->data); - elt = elt->next; - } - - return newList; -} - -bool list_contains(struct list* list, void* data, comparator comparator) -{ - struct list_elt* elt = list->head; - while (elt != NULL) { - if (comparator(elt->data, data) == 0) { - return true; - } - elt = elt->next; - } - return false; -} - -bool list_contains_all(struct list* superList, struct list* subList, - comparator comparator) -{ - struct list_elt* subElt = subList->head; - struct list* superListClone = list_clone(superList); - - bool found = true; - - while (subElt != NULL) { - struct list_elt* superElt = superListClone->head; - - found = false; - while (superElt != NULL && found == false) { - if (comparator(subElt->data, superElt->data) == 0) { - found = true; - list_remove(superListClone, superElt->data); - } - superElt = superElt->next; - } - - subElt = subElt->next; - } - free(superListClone); - - return found; -} - diff --git a/test/lib/list.h b/test/lib/list.h deleted file mode 100644 index 7c27796..0000000 --- a/test/lib/list.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * This file is part of libdom test suite. - * Licensed under the MIT License, - * http://www.opensource.org/licenses/mit-license.php - * Copyright 2007 James Shaw - */ - -#ifndef list_h_ -#define list_h_ - -#include - -#include "comparators.h" - -struct list_elt { - void* data; - struct list_elt* next; -}; - -struct list { - unsigned int size; - struct list_elt* head; - struct list_elt* tail; -}; - -struct list* list_new(void); -void list_destroy(struct list* list); - -/** - * Add data to the tail of the list. - */ -void list_add(struct list* list, void* data); - -/** - * Remove element containing data from list. - * The list element is freed, but the caller must free the data itself - * if necessary. - * - * Returns true if data was found in the list. - */ -bool list_remove(struct list* list, void* data); - -struct list* list_clone(struct list* list); - -/** - * Tests if data is equal to any element in the list. - */ -bool list_contains(struct list* list, void* data, - comparator comparator); - -/** - * Tests if superlist contains all elements in sublist. Order is not important. - */ -bool list_contains_all(struct list* superList, struct list* subList, - comparator comparator); - -#endif diff --git a/test/lib/testassert.c b/test/lib/testassert.c deleted file mode 100644 index 191a94b..0000000 --- a/test/lib/testassert.c +++ /dev/null @@ -1,64 +0,0 @@ -/* - * This file is part of libdom test suite. - * Licensed under the MIT License, - * http://www.opensource.org/licenses/mit-license.php - * Copyright 2007 John-Mark Bell - * Copyright 2007 James Shaw - */ - -#include -#include - -#include - -#include "testassert.h" -#include "comparators.h" -#include "utils.h" - -void __assert2(const char *expr, const char *function, - const char *file, int line) -{ - UNUSED(function); - UNUSED(file); - - printf("FAIL - %s at line %d\n", expr, line); - - exit(EXIT_FAILURE); -} - -void assert_equals_collection(struct list* expected, struct list* actual, - comparator comparator) -{ - assert(expected != NULL); - assert(actual != NULL); - assert_equals(&(expected->size), &(actual->size), (int (*)(const void* a, const void* b)) int_comparator); - list_contains_all(actual, expected, comparator); -} - -void assert_equals(void* expected, void* actual, comparator comparator) -{ - assert(comparator(expected, actual) == 0); -} - -void assert_same(void* expected, void* actual, comparator comparator) -{ - if (!(expected == actual)) { - assert_equals(expected, actual, comparator); - } -} -void assert_uri_equals(char* scheme, char* path, char* host, char* file, - char* name, char* query, char* fragment, bool isAbsolute, - char* actual) -{ - UNUSED(scheme); - UNUSED(path); - UNUSED(host); - UNUSED(file); - UNUSED(name); - UNUSED(query); - UNUSED(fragment); - UNUSED(isAbsolute); - UNUSED(actual); - /* TODO: implement me. Look at netsurf/url.c */ -} - diff --git a/test/lib/testassert.h b/test/lib/testassert.h deleted file mode 100644 index 85472ce..0000000 --- a/test/lib/testassert.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * This file is part of libdom test suite. - * Licensed under the MIT License, - * http://www.opensource.org/licenses/mit-license.php - * Copyright 2007 John-Mark Bell - */ - -#ifndef testassert_h_ -#define testassert_h_ - -#include "comparators.h" -#include "list.h" - -/* Redefine assert, so we can simply use the standard assert mechanism - * within testcases and exit with the right output for the testrunner - * to do the right thing. */ -void __assert2(const char *expr, const char *function, - const char *file, int line); - -#define assert(expr) \ - ((void) ((expr) || (__assert2 (#expr, __func__, __FILE__, __LINE__), 0))) - -void assert_equals_collection(struct list* expected, struct list* actual, - comparator comparator); - -void assert_equals(void* expected, void* actual, comparator comparator); - -void assert_same(void* expected, void* actual, comparator comparator); - -void assert_uri_equals(char* scheme, char* path, char* host, char* file, - char* name, char* query, char* fragment, bool isAbsolute, - char* actual); - -#endif diff --git a/test/lib/testobject.c b/test/lib/testobject.c deleted file mode 100644 index 4c27e0b..0000000 --- a/test/lib/testobject.c +++ /dev/null @@ -1,233 +0,0 @@ -/* - * This file is part of libdom test suite. - * Licensed under the MIT License, - * http://www.opensource.org/licenses/mit-license.php - * Copyright 2007 John-Mark Bell - */ - -#include -#include -#include -#include - -#include - -#include "bindings/hubbub/parser.h" - -#include "bindings/xml/xmlbinding.h" -#include "bindings/xml/xmlparser.h" - -#include "testassert.h" -#include "testobject.h" -#include "utils.h" - -static bool parser_initialised; - -struct TestObject { - enum { OBJECT_XML, OBJECT_HTML } type; - union { - dom_xml_parser *xml; - dom_hubbub_parser *html; - } parser; - struct dom_document *doc; -}; - -static void test_object_cleanup(void); - -TestObject *test_object_create(int argc, char **argv, - const char *uri, bool will_be_modified) -{ - char fnbuf[1024]; -#define CHUNK_SIZE 4096 - uint8_t buf[CHUNK_SIZE]; - FILE *fp; - char *dot; - size_t len; - TestObject *ret; - - UNUSED(will_be_modified); - - if (argc != 2) { - printf("Usage: %s \n", argv[0]); - exit(EXIT_FAILURE); - } - - if (parser_initialised == false) { - assert(dom_initialise(myrealloc, NULL) == DOM_NO_ERR); - - assert(dom_xml_binding_initialise(myrealloc, NULL) == - DOM_XML_OK); - -// assert(dom_hubbub_binding_initialise(myrealloc, NULL) == -// DOM_HUBBUB_OK); - - atexit(test_object_cleanup); - - parser_initialised = true; - } - - snprintf(fnbuf, sizeof fnbuf, "%s/%s", argv[1], uri); - - ret = malloc(sizeof(TestObject)); - if (ret == NULL) - return NULL; - - /* Detect the parser type (this is mildly hacky) */ - dot = strrchr(uri, '.'); - len = strlen(uri); - - if (dot == NULL) { - printf("No file extension, assuming XML\n"); - - ret->type = OBJECT_XML; - } else if (len - ((dot + 1) - uri) == 3) { - if (tolower(dot[1]) == 'x' && tolower(dot[2]) == 'm' - && tolower(dot[3]) == 'l') { - ret->type = OBJECT_XML; - } else if (tolower(dot[1]) == 'h' && tolower(dot[2]) == 't' && - tolower(dot[3]) == 'm') { - ret->type = OBJECT_HTML; - } - } else if (len - ((dot + 1) - uri) == 4) { - if (tolower(dot[1]) == 'h' && tolower(dot[2]) == 't' && - tolower(dot[3]) == 'm' && - tolower(dot[4]) == 'l') { - ret->type = OBJECT_HTML; - } - } else { - /* Assume XML */ - ret->type = OBJECT_XML; - } - - switch (ret->type) { - case OBJECT_XML: - ret->parser.xml = dom_xml_parser_create(NULL, "UTF-8", - myrealloc, NULL, mymsg, NULL); - if (ret->parser.xml == NULL) { - free(ret); - return NULL; - } - break; - case OBJECT_HTML: - { - char abuf[1024]; - snprintf(abuf, sizeof abuf, "%s/Aliases", argv[1]); - - ret->parser.html = dom_hubbub_parser_create(abuf, - NULL, true, myrealloc, NULL, mymsg, NULL); - if (ret->parser.html == NULL) { - free(ret); - return NULL; - } - break; - } - } - - fp = fopen(fnbuf, "r"); - if (fp == NULL) { - switch (ret->type) { - case OBJECT_XML: - dom_xml_parser_destroy(ret->parser.xml); - break; - case OBJECT_HTML: - dom_hubbub_parser_destroy(ret->parser.html); - break; - } - free(ret); - return NULL; - } - - fseek(fp, 0, SEEK_END); - len = ftell(fp); - fseek(fp, 0, SEEK_SET); - - while (len > CHUNK_SIZE) { - fread(buf, 1, CHUNK_SIZE, fp); - - switch (ret->type) { - case OBJECT_XML: - assert(dom_xml_parser_parse_chunk(ret->parser.xml, - buf, CHUNK_SIZE) == DOM_XML_OK); - break; - case OBJECT_HTML: - assert(dom_hubbub_parser_parse_chunk(ret->parser.html, - buf, CHUNK_SIZE) == DOM_HUBBUB_OK); - break; - } - - len -= CHUNK_SIZE; - } - - if (len > 0) { - fread(buf, 1, len, fp); - - switch (ret->type) { - case OBJECT_XML: - assert(dom_xml_parser_parse_chunk(ret->parser.xml, - buf, len) == DOM_XML_OK); - break; - case OBJECT_HTML: - assert(dom_hubbub_parser_parse_chunk(ret->parser.html, - buf, len) == DOM_HUBBUB_OK); - break; - } - - len = 0; - } - - switch (ret->type) { - case OBJECT_XML: - assert(dom_xml_parser_completed(ret->parser.xml) == DOM_XML_OK); - break; - case OBJECT_HTML: - assert(dom_hubbub_parser_completed(ret->parser.html) == - DOM_HUBBUB_OK); - break; - } - - fclose(fp); - - switch (ret->type) { - case OBJECT_XML: - ret->doc = dom_xml_parser_get_document(ret->parser.xml); - break; - case OBJECT_HTML: - ret->doc = dom_hubbub_parser_get_document(ret->parser.html); - break; - } - - switch (ret->type) { - case OBJECT_XML: - dom_xml_parser_destroy(ret->parser.xml); - ret->parser.xml = NULL; - break; - case OBJECT_HTML: - dom_hubbub_parser_destroy(ret->parser.html); - ret->parser.html = NULL; - break; - } - - return ret; - -#undef CHUNK_SIZE -} - -struct dom_document *test_object_get_doc(TestObject *obj) -{ - return obj->doc; -} - -const char *test_object_get_mimetype(TestObject *obj) -{ - return (obj->type == OBJECT_XML ? "text/xml" : "text/html"); -} - -void test_object_cleanup(void) -{ - if (parser_initialised) { -// dom_hubbub_binding_finalise(); - dom_xml_binding_finalise(); - dom_finalise(); - } -} - diff --git a/test/lib/testobject.h b/test/lib/testobject.h deleted file mode 100644 index c72b39f..0000000 --- a/test/lib/testobject.h +++ /dev/null @@ -1,22 +0,0 @@ -/* - * This file is part of libdom test suite. - * Licensed under the MIT License, - * http://www.opensource.org/licenses/mit-license.php - * Copyright 2007 John-Mark Bell - */ - -#ifndef testobject_h_ -#define testobject_h_ - -#include - -struct TestObject; -typedef struct TestObject TestObject; - -TestObject *test_object_create(int argc, char **argv, - const char *uri, bool will_be_modified); -struct dom_document *test_object_get_doc(TestObject *obj); -const char *test_object_get_mimetype(TestObject *obj); - -#endif - diff --git a/test/lib/utils.c b/test/lib/utils.c deleted file mode 100644 index 739933f..0000000 --- a/test/lib/utils.c +++ /dev/null @@ -1,34 +0,0 @@ -/* - * This file is part of libdom test suite. - * Licensed under the MIT License, - * http://www.opensource.org/licenses/mit-license.php - * Copyright 2007 John-Mark Bell - */ - -#include -#include -#include - -#include "utils.h" - -void *myrealloc(void *ptr, size_t len, void *pw) -{ - UNUSED(pw); - - return realloc(ptr, len); -} - -void mymsg(uint32_t severity, void *ctx, const char *msg, ...) -{ - va_list l; - - UNUSED(ctx); - - va_start(l, msg); - - fprintf(stderr, "%d: ", severity); - vfprintf(stderr, msg, l); - fprintf(stderr, "\n"); -} - - diff --git a/test/lib/utils.h b/test/lib/utils.h deleted file mode 100644 index b57db36..0000000 --- a/test/lib/utils.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * This file is part of libdom test suite. - * Licensed under the MIT License, - * http://www.opensource.org/licenses/mit-license.php - * Copyright 2007 John-Mark Bell - */ - -#ifndef utils_h_ -#define utils_h_ - -#include -#include - -#ifndef max -#define max(a,b) ((a)>(b)?(a):(b)) -#endif - -#ifndef min -#define min(a,b) ((a)<(b)?(a):(b)) -#endif - -#ifndef SLEN -/* Calculate length of a string constant */ -#define SLEN(s) (sizeof((s)) - 1) /* -1 for '\0' */ -#endif - -#ifndef UNUSED -#define UNUSED(x) ((x) = (x)) -#endif - -void *myrealloc(void *ptr, size_t len, void *pw); -void mymsg(uint32_t severity, void *ctx, const char *msg, ...); - -#endif - diff --git a/test/run-single-test.sh b/test/run-single-test.sh new file mode 100755 index 0000000..5118dcc --- /dev/null +++ b/test/run-single-test.sh @@ -0,0 +1,144 @@ +#!/bin/bash +# +# This is a simple script to convert the a XML testcae to C source file, compile it, run it, and report the result. +# Usage: +# This script is designed to run under the libdom/test directory. +# +# domts="testcases" dtd="dom1-interfaces.xml" level="level1" ./run-single-test.sh +# +# The above command will convert the XML testcase in directory testcases/tests/level/core and +# use dom1-interfaces.xml to convert it. +# This script will generate a output/ directory in libdom/test, and in that directory, there is a same structure +# as in DOMTS XML testcases files. +# +# This file is part of libdom test suite. +# Licensed under the MIT License, +# http://www.opensource.org/licenses/mit-license.php +# Copyright 2009 Bo Yang + +level=${level:-"level1"}; +module=${module:-"core"}; +domts=${domts:?"The \$domts must be assigned some value"}; +output=${output:-"output"}; +dtd=${dtd:?"The DTD file must be given"}; + +testdir="$domts"/tests/"$level"/"$module" +log="$output"/"$level"/"$module"/test.log; + +src="testutils/comparators.c testutils/domtsasserts.c testutils/foreach.c testutils/list.c testutils/load.c testutils/utils.c testutils/domtscondition.c" +domdir="../build-Linux-Linux-debug-lib-static" +ldflags="-L$domdir -ldom -L/usr/local/lib -lwapcaplet -L/usr/lib -lxml2 -lhubbub -lparserutils" +#ldflags="-L/usr/lib -lm -lz -L$domdir -ldom -L/usr/local/lib -lwapcaplet -lxml2 -lhubbub -lparserutils" +cflags="-Itestutils/ -I../bindings/xml -I../include -I../bindings/hubbub -I/usr/local/include" + +total=0; +fail=0; +pass=0; +conversion=0; +compile=0; +run=0; +nsupport=0; + +# Create the directories if necessary +if [ ! -e "$ouput" ]; then + mkdir -p "$output"; +fi +if [ ! -e "$level" ]; then + mkdir -p "$output"/"$level"; +fi +if [ ! -e "$module" ]; then + mkdir -p "$output"/"$level"/"$module"; +fi + +# Prepare the test files +if [ -e "files" ]; then + rm -fr files; +fi +cp -fr "$testdir/files" ./; + +while read test; do + total=$(($total+1)); + + file=`basename "$test"`; + name=${file%%.xml}; + + cfile="$output"/"$level"/"$module"/"$name".c; + ofile="$output"/"$level"/"$module"/"$name"; + tfile="$testdir"/"$file"; + + echo -n "$file:"; + + # Generate the test C program + out=`perl transform.pl "$dtd" "$tfile" 2>&1 >"${cfile}.unindent"`; + if [ "$?" != "0" ]; then + fail=$((fail+1)); + conversion=$((conversion+1)); + echo "$tfile Conversion Error:" >& 3; + echo "Please make sure you have XML::XPath perl module installed!" >& 3; + echo "$out" >&3; + echo -e "----------------------------------------\n\n" >& 3; + echo "failed!"; + rm -fr "${cfile}.unindent"; + continue; + fi + out=`indent "${cfile}.unindent" -o "$cfile" 2>&1`; + if [ "$?" != "0" ]; then + rm -fr "${cfile}.unindent"; + fail=$((fail+1)); + conversion=$((conversion+1)); + echo "$tfile Conversion Error:" >& 3; + echo "$out" >& 3; + echo -e "----------------------------------------\n\n" >& 3; + echo "failed!"; + continue; + fi + rm -fr "${cfile}.unindent"; + + # Compile it now + out=` ( gcc -g $cflags $src $cfile $ldflags -o "$ofile" ) 2>&1`; + if [ "$?" != "0" ]; then + fail=$((fail+1)); + compile=$((compile+1)); + echo "$tfile Compile Error:" >& 3; + echo "$out" >& 3; + echo -e "----------------------------------------\n\n" >& 3; + echo "failed!"; + continue; + fi + + # Run the test and test the result + cd files; + out=$(../$ofile 2>&1); + ret="$?"; + if [ "$ret" != "0" ]; then + cd ..; + fail=$((fail+1)); + if [ "$ret" == "9" ]; then + nsupport=$((nsupport+1)) + echo "$tfile Not Support:" >& 3; + echo "$out" >& 3; + echo -e "----------------------------------------\n\n" >& 3; + echo "not supported!"; + else + run=$((run+1)); + echo "$tfile Run Error:" >& 3; + echo "$out" >& 3; + echo -e "----------------------------------------\n\n" >& 3; + echo "failed!"; + fi + continue; + fi + cd ..; + + pass=$((pass+1)); + echo "passed."; + +done 3>&1 < <(echo $1); + +echo "Total: $total"; +echo "Passed: $pass"; +echo "Failed: $fail"; +echo "Conversion Error: $conversion"; +echo "Compile Error: $compile"; +echo "Run Error: $run"; +echo "Not Support: $nsupport"; diff --git a/test/run-test.sh b/test/run-test.sh new file mode 100755 index 0000000..c856ace --- /dev/null +++ b/test/run-test.sh @@ -0,0 +1,146 @@ +#!/bin/bash +# +# This is a simple script to convert the XML testcaes to C source file, compile it, run it, and report the result. +# Usage: +# This script is designed to run under the libdom/test directory. +# +# domts="testcases" dtd="dom1-interfaces.xml" level="level1" ./run-test.sh +# +# The above command will convert the XML testcase in directory testcases/tests/level/core and +# use dom1-interfaces.xml to convert it. +# This script will generate a output/ directory in libdom/test, and in that directory, there is a same structure +# as in DOMTS XML testcases files. +# +# This file is part of libdom test suite. +# Licensed under the MIT License, +# http://www.opensource.org/licenses/mit-license.php +# Copyright 2009 Bo Yang + +level=${level:-"level1"}; +module=${module:-"core"}; +domts=${domts:?"The \$domts must be assigned some value"}; +output=${output:-"output"}; +dtd=${dtd:?"The DTD file must be given"}; + +testdir="$domts"/tests/"$level"/"$module" +log="$output"/"$level"/"$module"/test.log; + +src="testutils/comparators.c testutils/domtsasserts.c testutils/foreach.c testutils/list.c testutils/load.c testutils/utils.c testutils/domtscondition.c" +domdir="../build-Linux-Linux-debug-lib-static" +ldflags="-L$domdir -ldom -L/usr/local/lib -lwapcaplet -L/usr/lib -lxml2 -lhubbub -lparserutils" +#ldflags="-L/usr/lib -lm -lz -L$domdir -ldom -L/usr/local/lib -lwapcaplet -lxml2 -lhubbub -lparserutils" +cflags="-Itestutils/ -I../bindings/xml -I../include -I../bindings/hubbub -I/usr/local/include" + +total=0; +fail=0; +pass=0; +conversion=0; +compile=0; +run=0; +nsupport=0; + +# Create the directories if necessary +if [ ! -e "$ouput" ]; then + mkdir -p "$output"; +fi +if [ ! -e "$level" ]; then + mkdir -p "$output"/"$level"; +fi +if [ ! -e "$module" ]; then + mkdir -p "$output"/"$level"/"$module"; +fi + +# Prepare the test files +if [ -e "files" ]; then + rm -fr files; +fi +cp -fr "$testdir/files" ./; + +while read test; do + total=$(($total+1)); + + file=`basename "$test"`; + name=${file%%.xml}; + + cfile="$output"/"$level"/"$module"/"$name".c; + ofile="$output"/"$level"/"$module"/"$name"; + tfile="$testdir"/"$file"; + + echo -n "$file:"; + + # Generate the test C program + out=`perl transform.pl "$dtd" "$tfile" 2>&1 >"${cfile}.unindent"`; + if [ "$?" != "0" ]; then + fail=$((fail+1)); + conversion=$((conversion+1)); + echo "$tfile Conversion Error:" >& 3; + echo "Please make sure you have XML::XPath perl module installed!" >& 3; + echo "$out" >&3; + echo -e "----------------------------------------\n\n" >& 3; + echo "failed!"; + rm -fr "${cfile}.unindent"; + continue; + fi + out=`indent "${cfile}.unindent" -o "$cfile" 2>&1`; + if [ "$?" != "0" ]; then + rm -fr "${cfile}.unindent"; + fail=$((fail+1)); + conversion=$((conversion+1)); + echo "$tfile Conversion Error:" >& 3; + echo "$out" >& 3; + echo -e "----------------------------------------\n\n" >& 3; + echo "failed!"; + continue; + fi + rm -fr "${cfile}.unindent"; + + # Compile it now + out=` ( gcc -g $cflags $src $cfile $ldflags -o "$ofile" ) 2>&1`; + if [ "$?" != "0" ]; then + fail=$((fail+1)); + compile=$((compile+1)); + echo "$tfile Compile Error:" >& 3; + echo "$out" >& 3; + echo -e "----------------------------------------\n\n" >& 3; + echo "failed!"; + continue; + fi + + # Run the test and test the result + cd files; + out=$(../$ofile 2>&1); + ret="$?"; + if [ "$ret" != "0" ]; then + cd ..; + fail=$((fail+1)); + if [ "$ret" == "9" ]; then + nsupport=$((nsupport+1)) + echo "$tfile Not Support:" >& 3; + echo "$out" >& 3; + echo -e "----------------------------------------\n\n" >& 3; + echo "not supported!"; + else + run=$((run+1)); + echo "$tfile Run Error:" >& 3; + echo "$out" >& 3; + echo -e "----------------------------------------\n\n" >& 3; + echo "failed!"; + fi + continue; + fi + cd ..; + + pass=$((pass+1)); + echo "passed."; + +done 3>"$log" < <(perl -ne 'if ($_ =~ /href=\"(.*\.xml)\"/) { print "$1\n"; }' -- "$testdir"/alltests.xml); + +echo "Total: $total" | tee >>"$log"; +echo "Passed: $pass" | tee >>"$log"; +echo "Failed: $fail" | tee >>"$log"; +echo "Conversion Error: $conversion" | tee >>"$log"; +echo "Compile Error: $compile" | tee >>"$log"; +echo "Run Error: $run" | tee >>"$log"; +echo "Not Support: $nsupport" | tee >>"$log"; + +cat "$log"; diff --git a/test/test-list.c b/test/test-list.c deleted file mode 100644 index 7871286..0000000 --- a/test/test-list.c +++ /dev/null @@ -1,56 +0,0 @@ -#include -#include -#include - -#include "testutils.h" - -void test_add_remove(void); -void test_contains_all_true(void); - -void test_add_remove(void) -{ - struct list* list = list_new(); - - char s[] = "hello"; - - /* add element */ - list_add(list, s); - assert(strcmp(list->head->data, "hello") == 0); - assert(list->size == 1); - - /* remove element */ - bool found = list_remove(list, s); - assert(found == true); - assert(list->size == 0); - assert(list->head == NULL); - - list_destroy(list); -} - -void test_contains_all_true(void) -{ - struct list* superList = list_new(); - struct list* subList = list_new(); - - list_add(superList, (void*) "hello"); - list_add(superList, (void*) "world"); - - list_add(subList, (void*) "hello"); - - bool b = list_contains_all(superList, subList, (comparator) strcmp); - assert(b == true); - assert(superList->size == 2); - assert(superList->head->next->next == NULL); - - list_destroy(superList); - list_destroy(subList); -} - -int main(void) -{ - test_add_remove(); - test_contains_all_true(); - //test_different_size_lists(); - - printf("PASS\n"); -} diff --git a/test/testutils.h b/test/testutils.h deleted file mode 100644 index 9fa8241..0000000 --- a/test/testutils.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef dom_test_testutils_h_ -#define dom_test_testutils_h_ - -#include "lib/exceptions.h" -#include "lib/list.h" -#include "lib/testassert.h" -#include "lib/testobject.h" -#include "lib/utils.h" - -#endif - diff --git a/test/testutils/comparators.c b/test/testutils/comparators.c new file mode 100644 index 0000000..20630c6 --- /dev/null +++ b/test/testutils/comparators.c @@ -0,0 +1,80 @@ +/* + * This file is part of libdom test suite. + * Licensed under the MIT License, + * http://www.opensource.org/licenses/mit-license.php + * Copyright 2009 Bo Yang + */ + +#include "comparators.h" +#include "domts.h" + +#include + +#include + +/* Compare to integer, return zero if equal */ +int int_comparator(const void* a, const void* b) { + return *((const int *)a) - *((const int *)b); +} + +/* Compare two string. The first one is a char * and the second + * one is a dom_string, return zero if equal */ +int str_cmp(const void *a, const void *b) +{ + const char *excepted = (const char *) a; + dom_string *actual = (dom_string *) b; + dom_string *exp; + dom_exception err; + bool ret; + + err = dom_string_create(myrealloc, NULL, excepted, strlen(excepted), + &exp); + if (err != DOM_NO_ERR) + return false; + + ret = dom_string_cmp(exp, actual) == 0; + + dom_string_unref(exp); + + if (ret == true) + return 0; + else + return 1; +} + +/* Similar with str_cmp but the first param is a dom_string the second + * param is a char * */ +int str_cmp_r(const void *a, const void *b) +{ + return str_cmp(b, a); +} + +/* Similar with str_cmp but ignore the case of letters */ +int str_icmp(const void *a, const void *b) +{ + const char *excepted = (const char *) a; + dom_string *actual = (dom_string *) b; + dom_string *exp; + dom_exception err; + bool ret; + + err = dom_string_create(myrealloc, NULL, excepted, strlen(excepted), + &exp); + if (err != DOM_NO_ERR) + return false; + + ret = dom_string_icmp(exp, actual) == 0; + + dom_string_unref(exp); + + if (ret == true) + return 0; + else + return 1; +} + +/* Similar with str_icmp, but the param order are reverse */ +int str_icmp_r(const void *a, const void *b) +{ + return str_icmp(b, a); +} diff --git a/test/testutils/comparators.h b/test/testutils/comparators.h new file mode 100644 index 0000000..cad79e1 --- /dev/null +++ b/test/testutils/comparators.h @@ -0,0 +1,23 @@ +/* + * This file is part of libdom test suite. + * Licensed under the MIT License, + * http://www.opensource.org/licenses/mit-license.php + * Copyright 2007 James Shaw + * Copyright 2009 Bo Yang + */ + +#ifndef comparators_h_ +#define comparators_h_ + +/** + * A function pointer type for a comparator. + */ +typedef int (*comparator)(const void* a, const void* b); + +int int_comparator(const void* a, const void* b); + +int str_icmp(const void *a, const void *b); +int str_icmp_r(const void *a, const void *b); +int str_cmp(const void *a, const void *b); +int str_cmp_r(const void *a, const void *b); +#endif diff --git a/test/testutils/domts.h b/test/testutils/domts.h new file mode 100644 index 0000000..14f4e9e --- /dev/null +++ b/test/testutils/domts.h @@ -0,0 +1,25 @@ +/* + * This file is part of libdom test suite. + * Licensed under the MIT License, + * http://www.opensource.org/licenses/mit-license.php + * Copyright 2009 Bo Yang + */ + +#ifndef domts_h_ +#define domts_h_ + +#include +#include +#include +#include +#include +#include + +struct lwc_context_s; + +extern struct lwc_context_s *ctx; + +dom_document *load_xml(char *file, bool willBeModified); +dom_document *load_html(char *file, bool willBeModified); + +#endif diff --git a/test/testutils/domtsasserts.c b/test/testutils/domtsasserts.c new file mode 100644 index 0000000..affa881 --- /dev/null +++ b/test/testutils/domtsasserts.c @@ -0,0 +1,253 @@ +/* + * This file is part of libdom test suite. + * Licensed under the MIT License, + * http://www.opensource.org/licenses/mit-license.php + * Copyright 2009 Bo Yang + */ + +#include +#include +#include +#include + +#include + +#include "domts.h" + +extern dom_implementation *doc_impl; + +void __assert2(const char *expr, const char *function, + const char *file, int line) +{ + UNUSED(function); + UNUSED(file); + + printf("FAIL - %s at line %d\n", expr, line); + + exit(EXIT_FAILURE); +} + +/** + * Following are the test conditions which defined in the DOMTS, please refer + * the DOM Test Suite for details + */ + +bool is_true(bool arg) +{ + return arg == true; +} + +bool is_null(void *arg) +{ + return arg == NULL; +} + +bool is_same(void *excepted, void *actual) +{ + return excepted == actual; +} + +bool is_same_int(int excepted, int actual) +{ + return excepted == actual; +} + +bool is_same_unsigned_long(unsigned long excepted, unsigned long actual) +{ + return excepted == actual; +} + +bool is_equals_int(int excepted, int actual, bool dummy) +{ + UNUSED(dummy); + + return excepted == actual; +} + +bool is_equals_unsigned_long(unsigned long excepted, unsigned long actual, bool dummy) +{ + UNUSED(dummy); + + return excepted == actual; +} + +/** + * Test whether two string are equal + * + * \param excepted The excepted string + * \param actual The actual string + * \param ignoreCase Whether to ignore letter case + */ +bool is_equals_string(const char *excepted, dom_string *actual, + bool ignoreCase) +{ + dom_string *exp; + dom_exception err; + bool ret; + + err = dom_string_create(myrealloc, NULL, excepted, strlen(excepted), + &exp); + if (err != DOM_NO_ERR) + return false; + + if (ignoreCase == true) + ret = dom_string_icmp(exp, actual) == 0; + else + ret = dom_string_cmp(exp, actual) == 0; + + dom_string_unref(exp); + return ret; +} + +/* Compare whether two dom_string are equal */ +bool is_equals_domstring(dom_string *excepted, dom_string *actual, + bool ignoreCase) +{ + if (ignoreCase == true) + return dom_string_icmp(excepted, actual) == 0; + else + return dom_string_cmp(excepted, actual) == 0; +} + +/* The param actual should always contain dom_sting and expectd should + * contain char * */ +bool is_equals_list(list *expected, list *actual, bool ignoreCase) +{ + assert((expected->type && 0xff00) == (actual->type && 0xff00)); + + comparator cmp = NULL; + comparator rcmp = NULL; + + if (expected->type == INT) + cmp = int_comparator; + if (expected->type == STRING) { + if (actual->type == DOM_STRING) { + cmp = ignoreCase? str_icmp : str_cmp; + rcmp = ignoreCase? str_icmp_r : str_cmp_r; + } + } + if (expected->type == DOM_STRING) { + if (actual->type == STRING) { + cmp = ignoreCase? str_icmp_r : str_cmp_r; + rcmp = ignoreCase? str_icmp : str_cmp; + } + } + + assert(cmp != NULL); + + bool ret = list_contains_all(expected, actual, cmp); + if (ret) + return list_contains_all(actual, expected, rcmp); +} + + + +bool is_instanceof(const char *type, dom_node *node) +{ + assert("There is no instanceOf in the test-suite" == NULL); + + return false; +} + + +bool is_size_domnamednodemap(int size, dom_namednodemap *map) +{ + unsigned long len; + dom_exception err; + + err = dom_namednodemap_get_length(map, &len); + if (err != DOM_NO_ERR) { + assert("Exception occured" == NULL); + return false; + } + + return size == len; +} + +bool is_size_domnodelist(int size, dom_nodelist *list) +{ + unsigned long len; + dom_exception err; + + err = dom_nodelist_get_length(list, &len); + if (err != DOM_NO_ERR) { + assert("Exception occured" == NULL); + return false; + } + + return size == len; +} + +bool is_size_list(int size, list *list) +{ + return size == list->size; +} + + +bool is_uri_equals(char *scheme, char *path, char *host, + char *file, char *query, char *fragment, + bool isAbsolute, dom_string *actual) +{ + UNUSED(scheme); + UNUSED(path); + UNUSED(host); + UNUSED(file); + UNUSED(query); + UNUSED(fragment); + UNUSED(isAbsolute); + UNUSED(actual); + + return false; +} + + +bool is_contenttype(const char *type) +{ + /* Now, we use the libxml2 parser for DOM parsing, so the content type + * is always "text/xml" */ + if (strcmp(type, "text/xml") == 0) + return true; + else + return false; +} + +bool has_feature(char *feature, char *version) +{ + dom_exception err; + bool ret; + dom_string *df, *dv; + + err = dom_string_create(myrealloc, NULL, feature, + feature == NULL ? 0 : strlen(feature), &df); + if (err != DOM_NO_ERR) + return false; + + err = dom_string_create(myrealloc, NULL, version, + version == NULL ? 0 : strlen(version), &dv); + if (err != DOM_NO_ERR) { + dom_string_unref(df); + return false; + } + + err = dom_implementation_has_feature(doc_impl, df, dv, &ret); + /* Here, when we come with exception, we should return false, + * TODO: this need to be improved, but I can't figure out how */ + if (err != DOM_NO_ERR) { + dom_string_unref(df); + dom_string_unref(dv); + return false; + } + + dom_string_unref(df); + dom_string_unref(dv); + return ret; +} + +bool implementation_attribute(char *name, bool value) +{ + /* We didnot support DOMConfigure for implementation now */ + UNUSED(name); + UNUSED(value); + + return true; +} diff --git a/test/testutils/domtsasserts.h b/test/testutils/domtsasserts.h new file mode 100644 index 0000000..ee0fb72 --- /dev/null +++ b/test/testutils/domtsasserts.h @@ -0,0 +1,61 @@ +/* + * This file is part of libdom test suite. + * Licensed under the MIT License, + * http://www.opensource.org/licenses/mit-license.php + * Copyright 2009 Bo Yang + */ + +#ifndef domtsasserts_h_ +#define domtsasserts_h_ + +#include + +#include + +#include "list.h" + + +/* Redefine assert, so we can simply use the standard assert mechanism + * within testcases and exit with the right output for the testrunner + * to do the right thing. */ +void __assert2(const char *expr, const char *function, + const char *file, int line); + +#define assert(expr) \ + ((void) ((expr) || (__assert2 (#expr, __func__, __FILE__, __LINE__), 0))) + +bool is_true(bool arg); + +bool is_null(void *arg); + +bool is_same(void *excepted, void *actual); +bool is_same_int(int excepted, int actual); +bool is_same_unsigned_long(unsigned long excepted, unsigned long actual); + +bool is_equals_int(int excepted, int actual, bool dummy); +bool is_equals_unsigned_long(unsigned long excepted, unsigned long actual, bool dummy); +bool is_equals_string(const char *excepted, dom_string *actual, + bool ignoreCase); +bool is_equals_domstring(dom_string *excepted, dom_string *actual, bool ignoreCase); + +/* We may use two different string types in libDOM, but the expected string type is + always "char *" */ +bool is_equals_list(list *expected, list *actual, bool ignoreCase); + +bool is_instanceof(const char *type, dom_node *node); + +bool is_size_domnamednodemap(int size, dom_namednodemap *map); +bool is_size_domnodelist(int size, dom_nodelist *list); +bool is_size_list(int size, list *list); + +bool is_uri_equals(char *scheme, char *path, char *host, + char *file, char *query, char *fragment, + bool isAbsolute, dom_string *actual); + +bool is_contenttype(const char *type); + +bool has_feature(char *feature, char *version); + +bool implementation_attribute(char *name, bool value); + +#endif diff --git a/test/testutils/domtscondition.c b/test/testutils/domtscondition.c new file mode 100644 index 0000000..39f6c68 --- /dev/null +++ b/test/testutils/domtscondition.c @@ -0,0 +1,32 @@ +/* + * This file is part of libdom test suite. + * Licensed under the MIT License, + * http://www.opensource.org/licenses/mit-license.php + * Copyright 2009 Bo Yang + */ + +#include + +/** + * Just simple functions which meet the needs of DOMTS conditions + */ + +bool less(int excepted, int actual) +{ + return actual < excepted; +} + +bool less_or_equals(int excepted, int actual) +{ + return actual <= excepted; +} + +bool greater(int excepted, int actual) +{ + return actual > excepted; +} + +bool greater_or_equals(int excepted, int actual) +{ + return actual >= excepted; +} diff --git a/test/testutils/domtscondition.h b/test/testutils/domtscondition.h new file mode 100644 index 0000000..164977f --- /dev/null +++ b/test/testutils/domtscondition.h @@ -0,0 +1,18 @@ +/* + * This file is part of libdom test suite. + * Licensed under the MIT License, + * http://www.opensource.org/licenses/mit-license.php + * Copyright 2009 Bo Yang + */ + +#ifndef domtscondition_h_ +#define domtscondition_h_ + +#include + +inline bool less(int excepted, int actual); +inline bool less_or_equals(int excepted, int actual); +inline bool greater(int excepted, int actual); +inline bool greater_or_equals(int excepted, int actual); + +#endif diff --git a/test/testutils/foreach.c b/test/testutils/foreach.c new file mode 100644 index 0000000..c3868df --- /dev/null +++ b/test/testutils/foreach.c @@ -0,0 +1,96 @@ +/* + * This file is part of libdom test suite. + * Licensed under the MIT License, + * http://www.opensource.org/licenses/mit-license.php + * Copyright 2009 Bo Yang + */ + +#include + +#include "foreach.h" +#include "list.h" + +#include + +/** + * Please see foreach.h for the usage of the following functions + */ + +void foreach_initialise_domnodelist(dom_nodelist *list, unsigned int *iterator) +{ + *iterator = 0; +} + +void foreach_initialise_list(list *list, unsigned int *iterator) +{ + *iterator = 0; +} + +void foreach_initialise_domnamednodemap(dom_namednodemap *map, unsigned int *iterator) +{ + *iterator = 0; +} + + +bool _get_next_domnodelist(dom_nodelist *list, unsigned int *iterator, dom_node **ret) +{ + dom_exception err; + unsigned long len; + + err = dom_nodelist_get_length(list, &len); + if (err != DOM_NO_ERR) + return false; + + if (*iterator >= len) + return false; + + err = dom_nodelist_item(list, (*iterator), ret); + if (err != DOM_NO_ERR) + return false; + + (*iterator)++; + return true; +} + +bool get_next_list(list *list, unsigned int *iterator, void **ret) +{ + unsigned int len = *iterator; + unsigned int i = 0; + struct list_elt *elt = list->head; + + for (; i < len; i++) { + if (elt == NULL) + return false; + elt = elt->next; + } + + if (elt == NULL) + return false; + + *ret = elt->data; + + (*iterator)++; + + return true; +} + +bool _get_next_domnamednodemap(dom_namednodemap *map, unsigned int *iterator, dom_node **ret) +{ + dom_exception err; + unsigned long len; + + err = dom_namednodemap_get_length(map, &len); + if (err != DOM_NO_ERR) + return false; + + if (*iterator >= len) + return false; + + err = dom_namednodemap_item(map, (*iterator), ret); + if (err != DOM_NO_ERR) + return false; + + (*iterator)++; + + return true; +} diff --git a/test/testutils/foreach.h b/test/testutils/foreach.h new file mode 100644 index 0000000..75874bc --- /dev/null +++ b/test/testutils/foreach.h @@ -0,0 +1,41 @@ +/* + * This file is part of libdom test suite. + * Licensed under the MIT License, + * http://www.opensource.org/licenses/mit-license.php + * Copyright 2009 Bo Yang + */ + +#ifndef domts_foreach_h_ +#define domts_foreach_h_ + +#include + +#include + +/* The following six functions are used for the XML testcase's + element. + And the element can be converted to : + + unsigned int iterator; + foreach_initialise_*(list, &iterator); + while(get_next_*(list, &iterator, ret)){ + do the loop work. + } +*/ + +void foreach_initialise_domnodelist(dom_nodelist *list, unsigned int *iterator); +void foreach_initialise_list(list *list, unsigned int *iterator); +void foreach_initialise_domnamednodemap(dom_namednodemap *map, unsigned int *iterator); + +bool _get_next_domnodelist(dom_nodelist *list, unsigned int *iterator, dom_node **ret); +#define get_next_domnodelist(l, i, r) _get_next_domnodelist( \ + (dom_nodelist *) (l), (unsigned int *) (i), (dom_node **) (r)) + +bool get_next_list(list *list, unsigned int *iterator, void **ret); + +bool _get_next_domnamednodemap(dom_namednodemap *map, unsigned int *iterator, dom_node **ret); +#define get_next_domnamednodemap(m, i, r) _get_next_domnamednodemap( \ + (dom_namednodemap *) (m), (unsigned int *) (i), (dom_node **) (r)) + + +#endif diff --git a/test/testutils/list.c b/test/testutils/list.c new file mode 100644 index 0000000..09a8cfc --- /dev/null +++ b/test/testutils/list.c @@ -0,0 +1,171 @@ +/* + * This file is part of libdom test suite. + * Licensed under the MIT License, + * http://www.opensource.org/licenses/mit-license.php + * Copyright 2007 James Shaw + * Copyright 2009 Bo Yang + */ + + +#include +#include +#include + +#include +#include + +#include "comparators.h" +#include "list.h" +#include "domtsasserts.h" + +/** + * Private helper function. + * Create a new list_elt and initialise it. + */ +struct list_elt* list_new_elt(void* data); + +struct list_elt* list_new_elt(void* data) { + struct list_elt* elt = malloc(sizeof(struct list_elt)); + assert(elt != NULL); + elt->data = data; + elt->next = NULL; + return elt; +} + +struct list* list_new(TYPE type) +{ + struct list* list = malloc(sizeof(struct list)); + assert(list != NULL); + list->size = 0; + list->type = type; + list->head = NULL; + list->tail = NULL; + return list; +} + +void list_destroy(struct list* list) +{ + struct list_elt* elt = list->head; + while (elt != NULL) { + if (list->type == DOM_STRING) + dom_string_unref((dom_string *) elt->data); + if (list->type == NODE) + dom_node_unref(elt->data); + struct list_elt* nextElt = elt->next; + free(elt); + elt = nextElt; + } + free(list); +} + +void list_add(struct list* list, void* data) +{ + struct list_elt* elt = list_new_elt(data); + struct list_elt* tail = list->tail; + + /* if tail was set, make its 'next' ptr point to elt */ + if (tail != NULL) { + tail->next = elt; + } + + /* make elt the new tail */ + list->tail = elt; + + if (list->head == NULL) { + list->head = elt; + } + + /* inc the size of the list */ + list->size++; + if (list->type == DOM_STRING) + dom_string_ref((dom_string *) data); + if (list->type == NODE) + dom_node_ref(data); +} + +bool list_remove(struct list* list, void* data) +{ + struct list_elt* prevElt = NULL; + struct list_elt* elt = list->head; + + bool found = false; + + while (elt != NULL) { + struct list_elt* nextElt = elt->next; + + /* if data is identical, fix up pointers, and free the element */ + if (data == elt->data) { + if (prevElt == NULL) { + list->head = nextElt; + } else { + prevElt->next = nextElt; + } + free(elt); + list->size--; + found = true; + break; + } + + prevElt = elt; + elt = nextElt; + } + + return found; +} + +struct list* list_clone(struct list* list) +{ + struct list* newList = list_new(list->type); + struct list_elt* elt = list->head; + + while (elt != NULL) { + list_add(newList, elt->data); + elt = elt->next; + } + + return newList; +} + +bool list_contains(struct list* list, void* data, comparator comparator) +{ + struct list_elt* elt = list->head; + while (elt != NULL) { + if (comparator(elt->data, data) == 0) { + return true; + } + elt = elt->next; + } + return false; +} + +bool list_contains_all(struct list* superList, struct list* subList, + comparator comparator) +{ + struct list_elt* subElt = subList->head; + struct list* superListClone = list_clone(superList); + + bool found = true; + + while (subElt != NULL) { + struct list_elt* superElt = superListClone->head; + + found = false; + while (superElt != NULL && found == false) { + if (comparator(superElt->data, subElt->data) == 0) { + found = true; + list_remove(superListClone, superElt->data); + break; + } + superElt = superElt->next; + } + + if (found == false) + break; + subElt = subElt->next; + } + + free(superListClone); + + return found; +} + diff --git a/test/testutils/list.h b/test/testutils/list.h new file mode 100644 index 0000000..6b0f209 --- /dev/null +++ b/test/testutils/list.h @@ -0,0 +1,70 @@ +/* + * This file is part of libdom test suite. + * Licensed under the MIT License, + * http://www.opensource.org/licenses/mit-license.php + * Copyright 2007 James Shaw + */ + +#ifndef list_h_ +#define list_h_ + +#include + +#include "comparators.h" + +/* The element type in the list + * + * The high byte is used for category type + * The low byte is used for concrete type + */ +typedef enum TYPE { + INT = 0x0001, + STRING = 0x0100, + DOM_STRING = 0x0101, + NODE = 0x0200 +} TYPE; + + +struct list_elt { + void* data; + struct list_elt* next; +}; + +typedef struct list { + unsigned int size; + TYPE type; + struct list_elt* head; + struct list_elt* tail; +} list; + +struct list* list_new(TYPE type); +void list_destroy(struct list* list); + +/** + * Add data to the tail of the list. + */ +void list_add(struct list* list, void* data); + +/** + * Remove element containing data from list. + * The list element is freed, but the caller must free the data itself + * if necessary. + * + * Returns true if data was found in the list. + */ +bool list_remove(struct list* list, void* data); + +struct list* list_clone(struct list* list); +/** + * Tests if data is equal to any element in the list. + */ +bool list_contains(struct list* list, void* data, + comparator comparator); + +/** + * Tests if superlist contains all elements in sublist. Order is not important. + */ +bool list_contains_all(struct list* superList, struct list* subList, + comparator comparator); + +#endif diff --git a/test/testutils/load.c b/test/testutils/load.c new file mode 100644 index 0000000..74cc009 --- /dev/null +++ b/test/testutils/load.c @@ -0,0 +1,151 @@ +/* + * This file is part of libdom test suite. + * Licensed under the MIT License, + * http://www.opensource.org/licenses/mit-license.php + * Copyright 2009 Bo Yang + */ + +#include +#include +#include + +#include +#include +#include +#include + +#include + +// For parsers +#include +#include +#include +#include + +#include "utils.h" + +extern lwc_context *ctx; + +/** + * Load the file as it is a XML file + * + * \param file The file path + * \param willBeModified Whether this file will be modified, not used + */ +dom_document *load_xml(char *file, bool willBeModified) +{ + dom_xml_parser *parser = NULL; + int handle; + int readed; + dom_xml_error error; + dom_document *ret; + char buffer[1024]; + + UNUSED(willBeModified); + + parser = dom_xml_parser_create(NULL, NULL, + myrealloc, NULL, mymsg, NULL, ctx); + if (parser == NULL) { + fprintf(stderr, "Can't create XMLParser\n"); + return NULL; + } + + handle = open(file, O_RDONLY); + if (handle == -1) { + dom_xml_parser_destroy(parser); + fprintf(stderr, "Can't open test input file: %s\n", file); + return NULL; + } + + readed = read(handle, buffer, 1024); + error = dom_xml_parser_parse_chunk(parser, buffer, readed); + if (error != DOM_XML_OK) { + dom_xml_parser_destroy(parser); + fprintf(stderr, "Parsing errors occur\n"); + return NULL; + } + + while(readed == 1024) { + readed = read(handle, buffer, 1024); + error = dom_xml_parser_parse_chunk(parser, buffer, readed); + if (error != DOM_XML_OK) { + dom_xml_parser_destroy(parser); + fprintf(stderr, "Parsing errors occur\n"); + return NULL; + } + } + + error = dom_xml_parser_completed(parser); + if (error != DOM_XML_OK) { + dom_xml_parser_destroy(parser); + fprintf(stderr, "Parsing error when construct DOM\n"); + return NULL; + } + + ret = dom_xml_parser_get_document(parser); + dom_xml_parser_destroy(parser); + + return ret; +} + +/** + * Load the file as it is a HTML file + * + * \param file The file path + * \param willBeModified Whether this file will be modified, not used + */ +dom_document *load_html(char *file, bool willBeModified) +{ + dom_hubbub_parser *parser = NULL; + int handle; + int readed; + dom_hubbub_error error; + dom_document *ret; + char buffer[1024]; + + UNUSED(willBeModified); + + parser = dom_hubbub_parser_create("data/Aliases", NULL, true, + myrealloc, NULL, mymsg, NULL, ctx); + if (parser == NULL) { + fprintf(stderr, "Can't create XMLParser\n"); + return NULL; + } + + handle = open(file, O_RDONLY); + if (handle == -1) { + dom_hubbub_parser_destroy(parser); + fprintf(stderr, "Can't open test input file: %s\n", file); + return NULL; + } + + readed = read(handle, buffer, 1024); + error = dom_hubbub_parser_parse_chunk(parser, buffer, readed); + if (error != DOM_HUBBUB_OK) { + dom_hubbub_parser_destroy(parser); + fprintf(stderr, "Parsing errors occur\n"); + return NULL; + } + + while(readed == 1024) { + readed = read(handle, buffer, 1024); + error = dom_hubbub_parser_parse_chunk(parser, buffer, readed); + if (error != DOM_HUBBUB_OK) { + dom_hubbub_parser_destroy(parser); + fprintf(stderr, "Parsing errors occur\n"); + return NULL; + } + } + + error = dom_hubbub_parser_completed(parser); + if (error != DOM_HUBBUB_OK) { + dom_hubbub_parser_destroy(parser); + fprintf(stderr, "Parsing error when construct DOM\n"); + return NULL; + } + + ret = dom_hubbub_parser_get_document(parser); + dom_hubbub_parser_destroy(parser); + + return ret; +} diff --git a/test/testutils/utils.c b/test/testutils/utils.c new file mode 100644 index 0000000..739933f --- /dev/null +++ b/test/testutils/utils.c @@ -0,0 +1,34 @@ +/* + * This file is part of libdom test suite. + * Licensed under the MIT License, + * http://www.opensource.org/licenses/mit-license.php + * Copyright 2007 John-Mark Bell + */ + +#include +#include +#include + +#include "utils.h" + +void *myrealloc(void *ptr, size_t len, void *pw) +{ + UNUSED(pw); + + return realloc(ptr, len); +} + +void mymsg(uint32_t severity, void *ctx, const char *msg, ...) +{ + va_list l; + + UNUSED(ctx); + + va_start(l, msg); + + fprintf(stderr, "%d: ", severity); + vfprintf(stderr, msg, l); + fprintf(stderr, "\n"); +} + + diff --git a/test/testutils/utils.h b/test/testutils/utils.h new file mode 100644 index 0000000..b57db36 --- /dev/null +++ b/test/testutils/utils.h @@ -0,0 +1,35 @@ +/* + * This file is part of libdom test suite. + * Licensed under the MIT License, + * http://www.opensource.org/licenses/mit-license.php + * Copyright 2007 John-Mark Bell + */ + +#ifndef utils_h_ +#define utils_h_ + +#include +#include + +#ifndef max +#define max(a,b) ((a)>(b)?(a):(b)) +#endif + +#ifndef min +#define min(a,b) ((a)<(b)?(a):(b)) +#endif + +#ifndef SLEN +/* Calculate length of a string constant */ +#define SLEN(s) (sizeof((s)) - 1) /* -1 for '\0' */ +#endif + +#ifndef UNUSED +#define UNUSED(x) ((x) = (x)) +#endif + +void *myrealloc(void *ptr, size_t len, void *pw); +void mymsg(uint32_t severity, void *ctx, const char *msg, ...); + +#endif + diff --git a/test/transform.pl b/test/transform.pl new file mode 100755 index 0000000..4ab0b46 --- /dev/null +++ b/test/transform.pl @@ -0,0 +1,21 @@ +#!/bin/perl +# This file is part of libdom. +# It is used to generate libdom test files from the W3C DOMTS. +# +# Licensed under the MIT License, +# http://www.opensource.org/licenses/mit-license.php +# Author: Bo Yang + +use warnings; +use strict; + +use XML::Parser::PerlSAX; +use DOMTSHandler; + +if ($#ARGV ne 1) { + die "Usage: perl transform.pl dtd-file testcase-file"; +} + +my $handler = DOMTSHandler->new($ARGV[0]); +my $parser = XML::Parser::PerlSAX->new(Handler => $handler); +$parser->parse(Source => {SystemId => "$ARGV[1]"}); diff --git a/test/transform/ctypes.xml b/test/transform/ctypes.xml deleted file mode 100644 index 579e317..0000000 --- a/test/transform/ctypes.xml +++ /dev/null @@ -1,71 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - dom_node_type - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/test/transform/dom1-interfaces.xml b/test/transform/dom1-interfaces.xml deleted file mode 100644 index 0c2488e..0000000 --- a/test/transform/dom1-interfaces.xml +++ /dev/null @@ -1,3665 +0,0 @@ - - - - - - -

DOM operations only raise exceptions in "exceptional" circumstances, i.e., when an operation is impossible to perform (either for logical reasons, because data is lost, or because the implementation has become unstable). In general, DOM methods return specific error values in ordinary processing situation, such as out-of-bound errors when usingNodeList.

-

Implementations may raise other exceptions under other circumstances. For example, implementations may raise an implementation-dependent exception if anullargument is passed.

-

Some languages and object systems do not support the concept of exceptions. For such systems, error conditions may be indicated using native error reporting mechanisms. For some bindings, for example, methods may return error codes similar to those listed in the corresponding method descriptions.

-
- -unsigned short - -
- - -

An integer indicating the type of error generated.

-
- - -

If index or size is negative, or greater than the allowed value

-
-
- - -

If the specified range of text does not fit into a DOMString

-
-
- - -

If any node is inserted somewhere it doesn't belong

-
-
- - -

If a node is used in a different document than the one that created it (that doesn't support it)

-
-
- - -

If an invalid character is specified, such as in a name.

-
-
- - -

If data is specified for a node which does not support data

-
-
- - -

If an attempt is made to modify an object where modifications are not allowed

-
-
- - -

If an attempt was made to reference a node in a context where it does not exist

-
-
- - -

If the implementation does not support the type of object requested

-
-
- - -

If an attempt is made to add an attribute that is already inuse elsewhere

-
-
-
- - -

TheDOMImplementationinterface provides a number of methods for performing operations that are independent of any particular instance of the document object model.

-

The DOM Level 1 does not specify a way of creating a document instance, and hence document creation is an operation specific to an implementation. Future Levels of the DOM specification are expected to provide methods for creating documents directly.

-
- - -

Test if the DOM implementation implements a specific feature.

-
- - - -

The package name of the feature to test. In Level 1, the legal values are "HTML" and "XML" (case-insensitive).

-
- - - -

This is the version number of the package name to test. In Level 1, this is the string "1.0". If the version is not specified, supporting any version of the feature will cause the method to returntrue.

-
- -
- - -

-trueif the feature is implemented in the specified version,falseotherwise.

-
-
- -
-
- - -

-DocumentFragmentis a "lightweight" or "minimal"Documentobject. It is very common to want to be able to extract a portion of a document's tree or to create a new fragment of a document. Imagine implementing a user command like cut or rearranging a document by moving fragments around. It is desirable to have an object which can hold such fragments and it is quite natural to use a Node for this purpose. While it is true that aDocumentobject could fulfil this role, aDocumentobject can potentially be a heavyweight object, depending on the underlying implementation. What is really needed for this is a very lightweight object.DocumentFragmentis such an object.

-

Furthermore, various operations -- such as inserting nodes as children of anotherNode-- may takeDocumentFragmentobjects as arguments; this results in all the child nodes of theDocumentFragmentbeing moved to the child list of this node.

-

The children of aDocumentFragmentnode are zero or more nodes representing the tops of any sub-trees defining the structure of the document.DocumentFragmentnodes do not need to be well-formed XML documents (although they do need to follow the rules imposed upon well-formed XML parsed entities, which can have multiple top nodes). For example, aDocumentFragmentmight have only one child and that child node could be aTextnode. Such a structure model represents neither an HTML document nor a well-formed XML document.

-

When aDocumentFragmentis inserted into aDocument(or indeed any otherNodethat may take children) the children of theDocumentFragmentand not theDocumentFragmentitself are inserted into theNode. This makes theDocumentFragmentvery useful when the user wishes to create nodes that are siblings; theDocumentFragmentacts as the parent of these nodes so that the user can use the standard methods from theNodeinterface, such asinsertBefore()andappendChild().

-
-
- - -

TheDocumentinterface represents the entire HTML or XML document. Conceptually, it is the root of the document tree, and provides the primary access to the document's data.

-

Since elements, text nodes, comments, processing instructions, etc. cannot exist outside the context of aDocument, theDocumentinterface also contains the factory methods needed to create these objects. TheNodeobjects created have aownerDocumentattribute which associates them with theDocumentwithin whose context they were created.

-
- - -

The Document Type Declaration (seeDocumentType) associated with this document. For HTML documents as well as XML documents without a document type declaration this returnsnull. The DOM Level 1 does not support editing the Document Type Declaration, thereforedocTypecannot be altered in any way.

-
-
- - -

TheDOMImplementationobject that handles this document. A DOM application may use objects from multiple implementations.

-
-
- - -

This is a convenience attribute that allows direct access to the child node that is the root element of the document. For HTML documents, this is the element with the tagName "HTML".

-
-
- - -

Creates an element of the type specified. Note that the instance returned implements theElementinterface, so attributes can be specified directly on the returned object.

-
- - - -

The name of the element type to instantiate. For XML, this is case-sensitive. For HTML, thetagNameparameter may be provided in any case, but it must be mapped to the canonical uppercase form by the DOM implementation.

-
- -
- - -

A newElementobject.

-
-
- - - -

INVALID_CHARACTER_ERR: Raised if the specified name contains an invalid character.

-
-
-
-
- - -

Creates an emptyDocumentFragmentobject.

-
- - - -

A newDocumentFragment.

-
-
- -
- - -

Creates aTextnode given the specified string.

-
- - - -

The data for the node.

-
- -
- - -

The newTextobject.

-
-
- -
- - -

Creates aCommentnode given the specified string.

-
- - - -

The data for the node.

-
- -
- - -

The newCommentobject.

-
-
- -
- - -

Creates aCDATASectionnode whose value is the specified string.

-
- - - -

The data for theCDATASectioncontents.

-
- -
- - -

The newCDATASectionobject.

-
-
- - - -

NOT_SUPPORTED_ERR: Raised if this document is an HTML document.

-
-
-
-
- - -

Creates aProcessingInstructionnode given the specified name and data strings.

-
- - - -

The target part of the processing instruction.

-
- - - -

The data for the node.

-
- -
- - -

The newProcessingInstructionobject.

-
-
- - - -

INVALID_CHARACTER_ERR: Raised if an invalid character is specified.

-

NOT_SUPPORTED_ERR: Raised if this document is an HTML document.

-
-
-
-
- - -

Creates anAttrof the given name. Note that theAttrinstance can then be set on anElementusing thesetAttributemethod.

-
- - - -

The name of the attribute.

-
- -
- - -

A newAttrobject.

-
-
- - - -

INVALID_CHARACTER_ERR: Raised if the specified name contains an invalid character.

-
-
-
-
- - -

Creates an EntityReference object.

-
- - - -

The name of the entity to reference.

-
- -
- - -

The newEntityReferenceobject.

-
-
- - - -

INVALID_CHARACTER_ERR: Raised if the specified name contains an invalid character.

-

NOT_SUPPORTED_ERR: Raised if this document is an HTML document.

-
-
-
-
- - -

Returns aNodeListof all theElements with a given tag name in the order in which they would be encountered in a preorder traversal of theDocumenttree.

-
- - - -

The name of the tag to match on. The special value "*" matches all tags.

-
- -
- - -

A newNodeListobject containing all the matchedElements.

-
-
- -
-
- - -

TheNodeinterface is the primary datatype for the entire Document Object Model. It represents a single node in the document tree. While all objects implementing theNodeinterface expose methods for dealing with children, not all objects implementing theNodeinterface may have children. For example,Textnodes may not have children, and adding children to such nodes results in aDOMExceptionbeing raised.

-

The attributesnodeName,nodeValueandattributesare included as a mechanism to getat node information without casting down to the specific derived interface. In cases where there is no obvious mapping of these attributes for a specificnodeType(e.g.,nodeValuefor an Element orattributesfor a Comment), this returnsnull. Note that the specialized interfaces may contain additional and more convenient mechanisms to get and set the relevant information.

-
- - -

An integer indicating which type of node this is.

-
- - -

The node is aElement.

-
-
- - -

The node is anAttr.

-
-
- - -

The node is aTextnode.

-
-
- - -

The node is aCDATASection.

-
-
- - -

The node is anEntityReference.

-
-
- - -

The node is anEntity.

-
-
- - -

The node is aProcessingInstruction.

-
-
- - -

The node is aComment.

-
-
- - -

The node is aDocument.

-
-
- - -

The node is aDocumentType.

-
-
- - -

The node is aDocumentFragment.

-
-
- - -

The node is aNotation.

-
-
-
-

The values ofnodeName,nodeValue, andattributesvary according to the node type as follows: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-nodeNamenodeValueattributes
ElementtagNamenullNamedNodeMap
Attrname of attributevalue of attributenull
Text#textcontent of the text nodenull
CDATASection#cdata-sectioncontent of the CDATA Sectionnull
EntityReferencename of entity referencednullnull
Entityentity namenullnull
ProcessingInstructiontargetentire content excluding the targetnull
Comment#commentcontent of the commentnull
Document#documentnullnull
DocumentTypedocument type namenullnull
DocumentFragment#document-fragmentnullnull
Notationnotation namenullnull
-

- - -

The name of this node, depending on its type; see the table above.

-
-
- - -

The value of this node, depending on its type; see the table above.

-
- - - -

NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.

-
-
-
- - - -

DOMSTRING_SIZE_ERR: Raised when it would return more characters than fit in aDOMStringvariable on the implementation platform.

-
-
-
-
- - -

A code representing the type of the underlying object, as defined above.

-
-
- - -

The parent of this node. All nodes, exceptDocument,DocumentFragment, andAttrmay have a parent. However, if a node has just been created and not yet added to the tree, or if it has been removed from the tree, this isnull.

-
-
- - -

ANodeListthat contains all children of this node. If there are no children, this is aNodeListcontaining no nodes. The content of the returnedNodeListis "live" in the sense that, for instance, changes to the children of the node object that it was created from are immediately reflected in the nodes returned by theNodeListaccessors; it is not a static snapshot of the content of the node. This is true for everyNodeList, including the ones returned by thegetElementsByTagNamemethod.

-
-
- - -

The first child of this node. If there is no such node, this returnsnull.

-
-
- - -

The last child of this node. If there is no such node, this returnsnull.

-
-
- - -

The node immediately preceding this node. If there is no such node, this returnsnull.

-
-
- - -

The node immediately following this node. If there is no such node, this returnsnull.

-
-
- - -

ANamedNodeMapcontaining the attributes of this node (if it is anElement) ornullotherwise.

-
-
- - -

TheDocumentobject associated with this node. This is also theDocumentobject used to create new nodes. When this node is aDocumentthis isnull.

-
-
- - -

Inserts the nodenewChildbefore the existing child noderefChild. IfrefChildisnull, insertnewChildat the end of the list of children.

-

IfnewChildis aDocumentFragmentobject, all of its children are inserted, in the same order, beforerefChild. If thenewChildis already in the tree, it is first removed.

-
- - - -

The node to insert.

-
- - - -

The reference node, i.e., the node before which the new node must be inserted.

-
- -
- - -

The node being inserted.

-
-
- - - -

HIERARCHY_REQUEST_ERR: Raised if this node is of a type that does not allow children of the type of thenewChildnode, or if the node to insert is one of this node's ancestors.

-

WRONG_DOCUMENT_ERR: Raised ifnewChildwas created from a different document than the one that created this node.

-

NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.

-

NOT_FOUND_ERR: Raised ifrefChildis not a child of this node.

-
-
-
-
- - -

Replaces the child nodeoldChildwithnewChildin the list of children, and returns theoldChildnode. If thenewChildis already in the tree, it is first removed.

-
- - - -

The new node to put in the child list.

-
- - - -

The node being replaced in the list.

-
- -
- - -

The node replaced.

-
-
- - - -

HIERARCHY_REQUEST_ERR: Raised if this node is of a type that does not allow children of the type of thenewChildnode, or it the node to put in is one of this node's ancestors.

-

WRONG_DOCUMENT_ERR: Raised ifnewChildwas created from a different document than the one that created this node.

-

NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.

-

NOT_FOUND_ERR: Raised ifoldChildis not a child of this node.

-
-
-
-
- - -

Removes the child node indicated byoldChildfrom the list of children, and returns it.

-
- - - -

The node being removed.

-
- -
- - -

The node removed.

-
-
- - - -

NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.

-

NOT_FOUND_ERR: Raised ifoldChildis not a child of this node.

-
-
-
-
- - -

Adds the nodenewChildto the end of the list of children of this node. If thenewChildis already in the tree, it is first removed.

-
- - - -

The node to add.

-

If it is aDocumentFragmentobject, the entire contents of the document fragment are moved into the child list of this node

-
- -
- - -

The node added.

-
-
- - - -

HIERARCHY_REQUEST_ERR: Raised if this node is of a type that does not allow children of the type of thenewChildnode, or if the node to append is one of this node's ancestors.

-

WRONG_DOCUMENT_ERR: Raised ifnewChildwas created from a different document than the one that created this node.

-

NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.

-
-
-
-
- - -

This is a convenience method to allow easy determination of whether a node has any children.

-
- - - -

-trueif the node has any children,falseif the node has no children.

-
-
- -
- - -

Returns a duplicate of this node, i.e., serves as a generic copy constructor for nodes. The duplicate node has no parent (parentNodereturnsnull.).

-

Cloning anElementcopies all attributes and their values, including those generated by the XML processor to represent defaulted attributes, but this method does not copy any text it contains unless it is a deep clone, since the text is contained in a childTextnode. Cloning any other type of node simply returns a copy of this node.

-
- - - -

Iftrue, recursively clone the subtree under the specified node; iffalse, clone only the node itself (and its attributes, if it is anElement).

-
- -
- - -

The duplicate node.

-
-
- -
-
- - -

TheNodeListinterface provides the abstraction of an ordered collection of nodes, without defining or constraining how this collection is implemented.

-

The items in theNodeListare accessible via an integral index, starting from 0.

-
- - -

Returns theindexth item in the collection. Ifindexis greater than or equal to the number of nodes in the list, this returnsnull.

-
- - - -

Index into the collection.

-
- -
- - -

The node attheindexth position in theNodeList, ornullif that is not a valid index.

-
-
- -
- - -

The number of nodes in the list. The range of valid child node indices is 0 tolength-1inclusive.

-
-
-
- - -

Objects implementing theNamedNodeMapinterface are used to represent collections of nodes that can be accessed by name. Note thatNamedNodeMapdoes not inherit fromNodeList;NamedNodeMaps are not maintained in any particular order. Objects contained in an object implementingNamedNodeMapmay also be accessed by an ordinal index, but this is simply to allow convenient enumeration of the contents of aNamedNodeMap, and does not imply that the DOM specifies an order to these Nodes.

-
- - -

Retrieves a node specified by name.

-
- - - -

Name of a node to retrieve.

-
- -
- - -

ANode(of any type) with the specified name, ornullif the specified name did not identify any node in the map.

-
-
- -
- - -

Adds a node using itsnodeNameattribute.

-

As thenodeNameattribute is used to derive the name which the node must be stored under, multiple nodes of certain types (those that have a "special" string value) cannot be stored as the names would clash. This is seen as preferable to allowing nodes to be aliased.

-
- - - -

A node to store in a named node map. The node will later be accessible using the value of thenodeNameattribute of the node. If a node with that name is already present in the map, it is replaced by the new one.

-
- -
- - -

If the newNodereplaces an existing node with the same name the previously existingNodeis returned, otherwisenullis returned.

-
-
- - - -

WRONG_DOCUMENT_ERR: Raised ifargwas created from a different document than the one that created theNamedNodeMap.

-

NO_MODIFICATION_ALLOWED_ERR: Raised if thisNamedNodeMapis readonly.

-

INUSE_ATTRIBUTE_ERR: Raised ifargis anAttrthat is already an attribute of anotherElementobject. The DOM user must explicitly cloneAttrnodes to re-use them in other elements.

-
-
-
-
- - -

Removes a node specified by name. If the removed node is anAttrwith a default value it is immediately replaced.

-
- - - -

The name of a node to remove.

-
- -
- - -

The node removed from the map ornullif no node with such a name exists.

-
-
- - - -

NOT_FOUND_ERR: Raised if there is no node named name in this map.

-

NO_MODIFICATION_ALLOWED_ERR: Raised if this map is readonly.

-
-
-
-
- - -

Returns theindexth item in the map. Ifindexis greater than or equal to the number of nodes in the map, this returnsnull.

-
- - - -

Index into the map.

-
- -
- - -

The node at theindexth position in theNamedNodeMap, ornullif that is not a valid index.

-
-
- -
- - -

The number of nodes in the map. The range of valid child node indices is 0 tolength-1inclusive.

-
-
-
- - -

TheCharacterDatainterface extends Node with a set of attributes and methods for accessing character data in the DOM. For clarity this set is defined here rather than on each object that uses these attributes and methods. No DOM objects correspond directly toCharacterData, thoughTextand others do inherit the interface from it. Alloffsets in this interface start from 0.

-
- - -

The character data of the node that implements this interface. The DOM implementation may not put arbitrary limits on the amount of data that may be stored in aCharacterDatanode. However, implementation limits may mean that the entirety of a node's data may not fit into a singleDOMString. In such cases, the user may callsubstringDatato retrieve the data in appropriately sized pieces.

-
- - - -

NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.

-
-
-
- - - -

DOMSTRING_SIZE_ERR: Raised when it would return more characters than fit in aDOMStringvariable on the implementation platform.

-
-
-
-
- - -

The number of characters that are available throughdataand thesubstringDatamethod below. This may have the value zero, i.e.,CharacterDatanodes may be empty.

-
-
- - -

Extracts a range of data from the node.

-
- - - -

Start offset of substring to extract.

-
- - - -

The number of characters to extract.

-
- -
- - -

The specified substring. If the sum ofoffsetandcountexceeds thelength, then all characters to the end of the data are returned.

-
-
- - - -

INDEX_SIZE_ERR: Raised if the specified offset is negative or greater than the number of characters indata, or if the specifiedcountis negative.

-

DOMSTRING_SIZE_ERR: Raised if the specified range of text does not fit into aDOMString.

-
-
-
-
- - -

Append the string to the end of the character data of the node. Upon success,dataprovides access to the concatenation ofdataand theDOMStringspecified.

-
- - - -

TheDOMStringto append.

-
- -
- - -

- - - - - -

NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.

-
- - -
- - -

Insert a string at the specified character offset.

-
- - - -

The character offset at which to insert.

-
- - - -

TheDOMStringto insert.

-
- -
- - -

- - - - - -

INDEX_SIZE_ERR: Raised if the specified offset is negative or greater than the number of characters indata.

-

NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.

-
- - -
- - -

Remove a range of characters from the node. Upon success,dataandlengthreflect the change.

-
- - - -

The offset from which to remove characters.

-
- - - -

The number of characters to delete. If the sum ofoffsetandcountexceedslengththen all characters fromoffsetto the end of the data are deleted.

-
- -
- - -

- - - - - -

INDEX_SIZE_ERR: Raised if the specified offset is negative or greater than the number of characters indata, or if the specifiedcountis negative.

-

NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.

-
- - -
- - -

Replace the characters starting at the specified character offset with the specified string.

-
- - - -

The offset from which to start replacing.

-
- - - -

The number of characters to replace. If the sum ofoffsetandcountexceedslength, then all characters to the end of the data are replaced (i.e., the effect is the same as aremovemethod call with the same range, followed by anappendmethod invocation).

-
- - - -

TheDOMStringwith which the range must be replaced.

-
- -
- - -

- - - - - -

INDEX_SIZE_ERR: Raised if the specified offset is negative or greater than the number of characters indata, or if the specifiedcountis negative.

-

NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.

-
- - -
-
- - -

TheAttrinterface represents an attribute in anElementobject. Typically the allowable values for the attribute are defined in a document type definition.

-

-Attrobjects inherit theNodeinterface, but since they are not actually child nodes of the element they describe, the DOM does not consider them part of the document tree. Thus, theNodeattributesparentNode,previousSibling, andnextSiblinghave a null value forAttrobjects. The DOM takes the view that attributes are properties of elements rather than having a separate identity from the elements they are associated with; this should make it more efficient to implement such features as default attributes associated with all elements of a given type. Furthermore,Attrnodes may not be immediate children of aDocumentFragment. However, they can be associated withElementnodes contained within aDocumentFragment. In short, users and implementors of the DOM need to be aware thatAttrnodes have some things in common with other objects inheriting theNodeinterface, but they also are quite distinct.

-

The attribute's effective value is determined as follows: if this attribute has been explicitly assigned any value, that value is the attribute's effective value; otherwise, if there is a declaration for this attribute, and that declaration includes a default value, then that default value is the attribute's effective value; otherwise, the attribute does not exist on this element in the structure model until it has been explicitly added. Note that thenodeValueattribute on theAttrinstance can also be used to retrieve the string version of the attribute's value(s).

-

In XML, where the value of an attribute can contain entity references, the child nodes of theAttrnode provide a representation in which entity references are not expanded. These child nodes may be eitherTextorEntityReferencenodes. Because the attribute type may be unknown, there are no tokenized attribute values.

-
- - -

Returns the name of this attribute.

-
-
- - -

If this attribute was explicitly given a value in the original document, this istrue; otherwise, it isfalse. Note that the implementation is in charge of this attribute, not the user. If the user changes the value of the attribute (even if it ends up having the same value as the default value) then thespecifiedflag is automatically flipped totrue. To re-specify the attribute as the default value from the DTD, the user must delete the attribute. The implementation will then make a new attribute available withspecifiedset tofalseand the default value (if one exists).

-

In summary: - -

If the attribute has an assigned value in the document thenspecifiedistrue, and the value is the assigned value.

- - -

If the attribute has no assigned value in the document and has a default value in the DTD, thenspecifiedisfalse, and the value is the default value in the DTD.

-
- -

If the attribute has no assigned value in the document and has a value of #IMPLIED in the DTD, then the attribute does not appear in the structure model of the document.

-
- -

-
-
- - -

On retrieval, the value of the attribute is returned as a string. Character and general entity references are replaced with their values.

-

On setting, this creates aTextnode with the unparsed contents of the string.

-
- - - -

NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.

-
-
-
-
-
- - -

By far the vast majority of objects (apart from text) that authors encounter when traversing a document areElementnodes. Assume the following XML document:<elementExample id="demo"> <subelement1/> <subelement2><subsubelement/></subelement2> </elementExample> -

-

When represented using DOM, the top node is anElementnode for "elementExample", which contains two childElementnodes, one for "subelement1" and one for "subelement2". "subelement1" contains no child nodes.

-

Elements may have attributes associated with them; since theElementinterface inherits fromNode, the genericNodeinterface methodgetAttributesmay be used to retrieve the set of all attributes for an element. There are methods on theElementinterface to retrieve either anAttrobject by name or an attribute value by name. In XML, where an attribute value may contain entity references, anAttrobject should be retrieved to examine the possibly fairly complex sub-tree representing the attribute value. On the other hand, in HTML, where all attributes have simple string values, methods to directly access an attribute value can safely be used as a convenience.

-
- - -

The name of the element. For example, in:<elementExample id="demo"> ... </elementExample> , -tagNamehas the value"elementExample". Note that this is case-preserving in XML, as are all of the operations of the DOM. The HTML DOM returns thetagNameof an HTML element in the canonical uppercase form, regardless of the case in the source HTML document.

-
-
- - -

Retrieves an attribute value by name.

-
- - - -

The name of the attribute to retrieve.

-
- -
- - -

TheAttrvalue as a string, or the empty string if that attribute does not have a specified or default value.

-
-
- -
- - -

Adds a new attribute. If an attribute with that name is already present in the element, its value is changed to be that of the value parameter. This value is a simple string, it is not parsed as it is being set. So any markup (such as syntax to be recognized as an entity reference) is treated as literal text, and needs to be appropriately escaped by the implementation when it is written out. In order to assign an attribute value that contains entity references, the user must create anAttrnode plus anyTextandEntityReferencenodes, build the appropriate subtree, and usesetAttributeNodeto assign it as the value of an attribute.

-
- - - -

The name of the attribute to create or alter.

-
- - - -

Value to set in string form.

-
- -
- - -

- - - - - -

INVALID_CHARACTER_ERR: Raised if the specified name contains an invalid character.

-

NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.

-
- - -
- - -

Removes an attribute by name. If the removed attribute has a default value it is immediately replaced.

-
- - - -

The name of the attribute to remove.

-
- -
- - -

- - - - - -

NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.

-
- - -
- - -

Retrieves anAttrnode by name.

-
- - - -

The name of the attribute to retrieve.

-
- -
- - -

TheAttrnode with the specified attribute name ornullif there is no such attribute.

-
-
- -
- - -

Adds a new attribute. If an attribute with that name is already present in the element, it is replaced by the new one.

-
- - - -

TheAttrnode to add to the attribute list.

-
- -
- - -

If thenewAttrattribute replaces an existing attribute with the same name, the previously existingAttrnode is returned, otherwisenullis returned.

-
-
- - - -

WRONG_DOCUMENT_ERR: Raised ifnewAttrwas created from a different document than the one that created the element.

-

NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.

-

INUSE_ATTRIBUTE_ERR: Raised ifnewAttris already an attribute of anotherElementobject. The DOM user must explicitly cloneAttrnodes to re-use them in other elements.

-
-
-
-
- - -

Removes the specified attribute.

-
- - - -

TheAttrnode to remove from the attribute list. If the removedAttrhas a default value it is immediately replaced.

-
- -
- - -

TheAttrnode that was removed.

-
-
- - - -

NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.

-

NOT_FOUND_ERR: Raised ifoldAttris not an attribute of the element.

-
-
-
-
- - -

Returns aNodeListof all descendant elements with a given tag name, in the order in which they would be encountered in a preorder traversal of theElementtree.

-
- - - -

The name of the tag to match on. The special value "*" matches all tags.

-
- -
- - -

A list of matchingElementnodes.

-
-
- -
- - -

Puts allTextnodes in the full depth of the sub-tree underneath thisElementinto a "normal" form where only markup (e.g., tags, comments, processing instructions, CDATA sections, and entity references) separatesTextnodes, i.e., there are no adjacentTextnodes. This can be used to ensure that the DOM view of a document is the same as if it were saved and re-loaded, and is useful when operations (such as XPointer lookups) that depend on a particular document tree structure are to be used.

-
- - - -

- - - - - - - -

TheTextinterface represents the textual content (termedcharacterdatain XML) of anElementorAttr. If there is no markup inside an element's content, the text is contained in a single object implementing theTextinterface that is the only child of the element. If there is markup, it is parsed into a list of elements andTextnodes that form the list of children of the element.

-

When a document is first made available via the DOM, there is only oneTextnode for each block of text. Users may create adjacentTextnodes that represent the contents of a given element without any intervening markup, but should be aware that there is no way to represent the separations between these nodes in XML or HTML, so they will not (in general) persist between DOM editing sessions. Thenormalize()method onElementmerges any such adjacentTextobjects into a single node for each block of text; this is recommended before employing operations that depend on a particular document structure, such as navigation withXPointers. -

-
- - -

Breaks thisTextnode into two Text nodes at the specified offset, keeping both in the tree as siblings. This node then only contains all the content up to theoffsetpoint. And a newTextnode, which is inserted as the next sibling of this node, contains all the content at and after theoffsetpoint.

-
- - - -

The offset at which to split, starting from 0.

-
- -
- - -

The newTextnode.

-
-
- - - -

INDEX_SIZE_ERR: Raised if the specified offset is negative or greater than the number of characters indata.

-

NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.

-
-
-
-
-
- - -

This represents the content of a comment, i.e., all the characters between the starting '<!--' and ending '-->'. Note that this is the definition of a comment in XML, and, in practice, HTML, although some HTML tools may implement the full SGML comment structure.

-
-
- - -

CDATA sections are used to escape blocks of text containing characters that would otherwise be regarded as markup. The only delimiter that is recognized in a CDATA section is the "]]>" string that ends the CDATA section. CDATA sections can not be nested. The primary purpose is for including material such as XML fragments, without needing to escape all the delimiters.

-

TheDOMStringattribute of theTextnode holds the text that is contained by the CDATA section. Note that thismaycontain characters that need to be escaped outside of CDATA sections and that, depending on the character encoding ("charset") chosen for serialization, it may be impossible to write out some characters as part of a CDATA section.

-

TheCDATASectioninterface inherits theCharacterDatainterface through theTextinterface. AdjacentCDATASectionsnodes are not merged by use of the Element.normalize() method.

-
-
- - -

EachDocumenthas adoctypeattribute whose value is eithernullor aDocumentTypeobject. TheDocumentTypeinterface in the DOM Level 1 Core provides an interface to the list of entities that are defined for the document, and little else because the effect of namespaces and the various XML scheme efforts on DTD representation are not clearly understood as of this writing.

-

The DOM Level 1 doesn't support editingDocumentTypenodes.

-
- - -

The name of DTD; i.e., the name immediately following theDOCTYPEkeyword.

-
-
- - -

ANamedNodeMapcontaining the general entities, both external and internal, declared in the DTD. Duplicates are discarded. For example in:<!DOCTYPE ex SYSTEM "ex.dtd" [ <!ENTITY foo "foo"> <!ENTITY bar "bar"> <!ENTITY % baz "baz"> ]> <ex/>the interface provides access tofooandbarbut notbaz. Every node in this map also implements theEntityinterface.

-

The DOM Level 1 does not support editing entities, thereforeentitiescannot be altered in any way.

-
-
- - -

ANamedNodeMapcontaining the notations declared in the DTD. Duplicates are discarded. Every node in this map also implements theNotationinterface.

-

The DOM Level 1 does not support editing notations, thereforenotationscannot be altered in any way.

-
-
-
- - -

This interface represents a notation declared in the DTD. A notation either declares, by name, the format of an unparsed entity (see section 4.7 of the XML 1.0 specification), or is used for formal declaration of Processing Instruction targets (see section 2.6 of the XML 1.0 specification). ThenodeNameattribute inherited fromNodeis set to the declared name of the notation.

-

The DOM Level 1 does not support editingNotationnodes; they are therefore readonly.

-

ANotationnode does not have any parent.

-
- - -

The public identifier of this notation. If the public identifier was not specified, this isnull.

-
-
- - -

The system identifier of this notation. If the system identifier was not specified, this isnull.

-
-
-
- - -

This interface represents an entity, either parsed or unparsed, in an XML document. Note that this models the entity itselfnotthe entity declaration.Entitydeclaration modeling has been left for a later Level of the DOM specification.

-

ThenodeNameattribute that is inherited fromNodecontains the name of the entity.

-

An XML processor may choose to completely expand entities before the structure model is passed to the DOM; in this case there will be noEntityReferencenodes in the document tree.

-

XML does not mandate that a non-validating XML processor read and process entity declarations made in the external subset or declared in external parameter entities. This means that parsed entities declared in the external subset need not be expanded by some classes of applications, and that the replacement value of the entity may not be available. When the replacement value is available, the correspondingEntitynode's child list represents the structure of that replacement text. Otherwise, the child list is empty.

-

The resolution of the children of theEntity(the replacement value) may be lazily evaluated; actions by the user (such as calling thechildNodesmethod on theEntityNode) are assumed to trigger the evaluation.

-

The DOM Level 1 does not support editingEntitynodes; if a user wants to make changes to the contents of anEntity, every relatedEntityReferencenode has to be replaced in the structure model by a clone of theEntity's contents, and then the desired changes must be made to each of those clones instead. All the descendants of anEntitynode are readonly.

-

AnEntitynode does not have any parent.

-
- - -

The public identifier associated with the entity, if specified. If the public identifier was not specified, this isnull.

-
-
- - -

The system identifier associated with the entity, if specified. If the system identifier was not specified, this isnull.

-
-
- - -

For unparsed entities, the name of the notation for the entity. For parsed entities, this isnull.

-
-
-
- - -

-EntityReferenceobjects may be inserted into the structure model when an entity reference is in the source document, or when the user wishes to insert an entity reference. Note that character references and references to predefined entities are considered to be expanded by the HTML or XML processor so that characters are represented by their Unicode equivalent rather than by an entity reference. Moreover, the XMLprocessor may completely expand references to entities while building the structure model, instead of providingEntityReferenceobjects. If it does provide such objects, then for a givenEntityReferencenode, it may be that there is noEntitynode representing the referenced entity; but if such anEntityexists, then the child list of theEntityReferencenode is the same as that of theEntitynode. As with theEntitynode, all descendants of theEntityReferenceare readonly.

-

The resolution of the children of theEntityReference(the replacement value of the referencedEntity) may be lazily evaluated; actions by the user (such as calling thechildNodesmethod on theEntityReferencenode) are assumed to trigger the evaluation.

-
-
- - -

TheProcessingInstructioninterface represents a "processing instruction", used in XML as a way to keep processor-specific information in the text of the document.

-
- - -

The target of this processing instruction. XML defines this as being the first token following the markup that begins the processing instruction.

-
-
- - -

The content of this processing instruction. This is from the first non white space character after the target to the character immediately preceding the?>.

-
- - - -

NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.

-
-
-
-
-
- - -

AnHTMLCollectionis a list of nodes. An individual node may be accessed by either ordinal index or the node'snameoridattributes.Note:Collections in the HTML DOM are assumed to belivemeaning that they are automatically updated when the underlying document is changed.

-
- - -

This attribute specifies the length orsizeof the list.

-
-
- - -

This method retrieves a node specified by ordinal index. Nodes are numbered in tree order (depth-first traversal order).

-
- - - -

The index of the node to be fetched. The index origin is 0.

-
- -
- - -

TheNodeat the corresponding position upon success. A value ofnullis returned if the index is out of range.

-
-
- -
- - -

This method retrieves aNodeusing a name. It first searches for aNodewith a matchingidattribute. If it doesn't find one, it then searches for aNodewith a matchingnameattribute, but only on those elements that are allowed a name attribute.

-
- - - -

The name of theNodeto be fetched.

-
- -
- - -

TheNodewith anameoridattribute whose value corresponds to the specified string. Upon failure (e.g., no node with this name exists), returnsnull.

-
-
- -
-
- - -

AnHTMLDocumentis the root of the HTML hierarchy and holds the entire content. Beside providing access to the hierarchy, it also provides some convenience methods for accessing certain sets of information from the document.

-

The following properties have been deprecated in favor of the corresponding ones for the BODY element:

- - -

alinkColor

-
- -

background

-
- -

bgColor

-
- -

fgColor

-
- -

linkColor

-
- -

vlinkColor

-
-
-

- - - -

The title of a document as specified by theTITLEelement in the head of the document.

-
- - - -

Returns the URI of the page that linked to this page. The value is an empty string if the user navigated to the page directly (not through a link, but, for example, via a bookmark).

-
-
- - -

The domain name of the server that served the document, or a null string if the server cannot be identified by a domain name.

-
-
- - -

The complete URI of the document.

-
-
- - -

The element that contains the content for the document. In documents withBODYcontents, returns theBODYelement, and in frameset documents, this returns the outermostFRAMESETelement.

-
-
- - -

A collection of all theIMGelements in a document. The behavior is limited toIMGelements for backwards compatibility.

-
-
- - -

A collection of all theOBJECTelements that include applets andAPPLET(deprecated) elements in a document.

-
-
- - -

A collection of allAREAelements and anchor (A) elements in a document with a value for thehrefattribute.

-
-
- - -

A collection of all the forms of a document.

-
-
- - -

A collection of all the anchor (A) elements in a document with a value for thenameattribute.Note.For reasons of backwards compatibility, the returned set of anchors only contains those anchors created with thenameattribute, not those created with theidattribute.

-
-
- - -

The cookies associated with this document. If there are none, the value is an empty string. Otherwise, the value is a string: a semicolon-delimited list of "name, value" pairs for all the cookies associated with the page. For example,name=value;expires=date.

-
-
- - -

-Note.This method and the ones following allow a user to add to or replace the structure model of a document using strings of unparsed HTML. At the time of writing alternate methods for providing similar functionality for both HTML and XML documents were being considered. The following methods may be deprecated at some point in the future in favor of a more general-purpose mechanism.

-

Open a document stream for writing. If a document exists in the target, this method clears it.

-
- - - -

- - - - - - -

Closes a document stream opened byopen()and forces rendering.

-
- - - -

- - - - - - -

Write a string of text to a document stream opened byopen(). The text is parsed into the document's structure model.

-
- - - -

The string to be parsed into some structure in the document structure model.

-
- -
- - -

- - - - - - -

Write a string of text followed by a newline character to a document stream opened byopen(). The text is parsed into the document's structure model.

-
- - - -

The string to be parsed into some structure in the document structure model.

-
- -
- - -

- - - - - - -

Returns the Element whoseidis given by elementId. If no such element exists, returnsnull. Behavior is not defined if more than one element has thisid.

-
- - - -

The uniqueidvalue for an element.

-
- -
- - -

The matching element.

-
-
- -
- - -

Returns the (possibly empty) collection of elements whosenamevalue is given byelementName.

-
- - - -

Thenameattribute value for an element.

-
- -
- - -

The matching elements.

-
-
- -
-
- - -

All HTML element interfaces derive from this class. Elements that only expose the HTML core attributes are represented by the baseHTMLElementinterface. These elements are as follows:

- - -

HEAD

-
- -

special: SUB, SUP, SPAN, BDO

-
- -

font: TT, I, B, U, S, STRIKE, BIG, SMALL

-
- -

phrase: EM, STRONG, DFN, CODE, SAMP, KBD, VAR, CITE, ACRONYM, ABBR

-
- -

list: DD, DT

-
- -

NOFRAMES, NOSCRIPT

-
- -

ADDRESS, CENTER

-
-
-

-Note.Thestyleattribute for this interface is reserved for future usage.

-
- - -

The element's identifier. See theid attribute definitionin HTML 4.0.

-
-
- - -

The element's advisory title. See thetitle attribute definitionin HTML 4.0.

-
-
- - -

Language code defined in RFC 1766. See thelang attribute definitionin HTML 4.0.

-
-
- - -

Specifies the base direction of directionally neutral text and the directionality of tables. See thedir attribute definitionin HTML 4.0.

-
-
- - -

The class attribute of the element. This attribute has been renamed due to conflicts with the "class" keyword exposed by many languages. See theclass attribute definitionin HTML 4.0.

-
-
-
- - -

Root of an HTML document. See theHTML element definitionin HTML 4.0.

-
- - -

Version information about the document's DTD. See theversion attribute definitionin HTML 4.0. This attribute is deprecated in HTML 4.0.

-
-
-
- - -

Document head information. See theHEAD element definitionin HTML 4.0.

-
- - -

URI designating a metadata profile. See theprofile attribute definitionin HTML 4.0.

-
-
-
- - -

TheLINKelement specifies a link to an external resource, and defines this document's relationship to that resource (or vice versa). See theLINK element definitionin HTML 4.0.

-
- - -

Enables/disables the link. This is currently only used for style sheet links, and may be used to activate or deactivate style sheets.

-
-
- - -

The character encoding of the resource being linked to. See thecharset attribute definitionin HTML 4.0.

-
-
- - -

The URI of the linked resource. See thehref attribute definitionin HTML 4.0.

-
-
- - -

Language code of the linked resource. See thehreflang attribute definitionin HTML 4.0.

-
-
- - -

Designed for use with one or more target media. See themedia attribute definitionin HTML 4.0.

-
-
- - -

Forward link type. See therel attribute definitionin HTML 4.0.

-
-
- - -

Reverse link type. See therev attribute definitionin HTML 4.0.

-
-
- - -

Frame to render the resource in. See thetarget attribute definitionin HTML 4.0.

-
-
- - -

Advisory content type. See thetype attribute definitionin HTML 4.0.

-
-
-
- - -

The document title. See theTITLE element definitionin HTML 4.0.

-
- - -

The specified title as a string.

-
-
-
- - -

This contains generic meta-information about the document. See theMETA element definitionin HTML 4.0.

-
- - -

Associated information. See thecontent attribute definitionin HTML 4.0.

-
-
- - -

HTTP response header name. See thehttp-equiv attribute definitionin HTML 4.0.

-
-
- - -

Meta information name. See thename attribute definitionin HTML 4.0.

-
-
- - -

Select form of content. See thescheme attribute definitionin HTML 4.0.

-
-
-
- - -

Document base URI. See theBASE element definitionin HTML 4.0.

-
- - -

The base URI See thehref attribute definitionin HTML 4.0.

-
-
- - -

The default target frame. See thetarget attribute definitionin HTML 4.0.

-
-
-
- - -

This element is used for single-line text input. See theISINDEX element definitionin HTML 4.0. This element is deprecated in HTML 4.0.

-
- - -

Returns theFORMelement containing this control. Returns null if this control is not within the context of a form.

-
-
- - -

The prompt message. See theprompt attribute definitionin HTML 4.0. This attribute is deprecated in HTML 4.0.

-
-
-
- - -

Style information. A more detailed style sheet object model is planned to be defined in a separate document. See theSTYLE element definitionin HTML 4.0.

-
- - -

Enables/disables the style sheet.

-
-
- - -

Designed for use with one or more target media. See themedia attribute definitionin HTML 4.0.

-
-
- - -

The style sheet language (Internet media type). See thetype attribute definitionin HTML 4.0.

-
-
-
- - -

The HTML document body. This element is always present in the DOM API, even if the tags are not present in the source document. See theBODY element definitionin HTML 4.0.

-
- - -

Color of active links (after mouse-button down, but before mouse-button up). See thealink attribute definitionin HTML 4.0. This attribute is deprecated in HTML 4.0.

-
-
- - -

URI of the background texture tile image. See thebackground attribute definitionin HTML 4.0. This attribute is deprecated in HTML 4.0.

-
-
- - -

Document background color. See thebgcolor attribute definitionin HTML 4.0. This attribute is deprecated in HTML 4.0.

-
-
- - -

Color of links that are not active and unvisited. See thelink attribute definitionin HTML 4.0. This attribute is deprecated in HTML 4.0.

-
-
- - -

Document text color. See thetext attribute definitionin HTML 4.0. This attribute is deprecated in HTML 4.0.

-
-
- - -

Color of links that have been visited by the user. See thevlink attribute definitionin HTML 4.0. This attribute is deprecated in HTML 4.0.

-
-
-
- - -

TheFORMelement encompasses behavior similar to a collection and an element. It provides direct access to the contained input elements as well as the attributes of the form element. See theFORM element definitionin HTML 4.0.

-
- - -

Returns a collection of all control elements in the form.

-
-
- - -

The number of form controls in the form.

-
-
- - -

Names the form.

-
-
- - -

List of character sets supported by the server. See theaccept-charset attribute definitionin HTML 4.0.

-
-
- - -

Server-side form handler. See theaction attribute definitionin HTML 4.0.

-
-
- - -

The content type of the submitted form, generally "application/x-www-form-urlencoded". See theenctype attribute definitionin HTML 4.0.

-
-
- - -

HTTP method used to submit form. See themethod attribute definitionin HTML 4.0.

-
-
- - -

Frame to render the resource in. See thetarget attribute definitionin HTML 4.0.

-
-
- - -

Submits the form. It performs the same action as a submit button.

-
- - - -

- - - - - - -

Restores a form element's default values. It performs the same action as a reset button.

-
- - - -

- - - - - - - -

The select element allows the selection of an option. The contained options can be directly accessed through the select element as a collection. See theSELECT element definitionin HTML 4.0.

-
- - -

The type of control created.

-
-
- - -

The ordinal index of the selected option. The value -1 is returned if no element is selected. If multiple options are selected, the index of the first selected option is returned.

-
-
- - -

The current form control value.

-
-
- - -

The number of options in thisSELECT.

-
-
- - -

Returns theFORMelement containing this control. Returns null if this control is not within the context of a form.

-
-
- - -

The collection ofOPTIONelements contained by this element.

-
-
- - -

The control is unavailable in this context. See thedisabled attribute definitionin HTML 4.0.

-
-
- - -

If true, multipleOPTIONelements may be selected in thisSELECT. See themultiple attribute definitionin HTML 4.0.

-
-
- - -

Form control or object name when submitted with a form. See thename attribute definitionin HTML 4.0.

-
-
- - -

Number of visible rows. See thesize attribute definitionin HTML 4.0.

-
-
- - -

Index that represents the element's position in the tabbing order. See thetabindex attribute definitionin HTML 4.0.

-
-
- - -

Add a new element to the collection ofOPTIONelements for thisSELECT.

-
- - - -

The element to add.

-
- - - -

The element to insert before, or NULL for the head of the list.

-
- -
- - -

- - - - - - -

Remove an element from the collection ofOPTIONelements for thisSELECT. Does nothing if no element has the given index.

-
- - - -

The index of the item to remove.

-
- -
- - -

- - - - - - -

Removes keyboard focus from this element.

-
- - - -

- - - - - - -

Gives keyboard focus to this element.

-
- - - -

- - - - - - - -

Group options together in logical subdivisions. See theOPTGROUP element definitionin HTML 4.0.

-
- - -

The control is unavailable in this context. See thedisabled attribute definitionin HTML 4.0.

-
-
- - -

Assigns a label to this option group. See thelabel attribute definitionin HTML 4.0.

-
-
-
- - -

A selectable choice. See theOPTION element definitionin HTML 4.0.

-
- - -

Returns theFORMelement containing this control. Returns null if this control is not within the context of a form.

-
-
- - -

Stores the initial value of theselectedattribute.

-
-
- - -

The text contained within the option element.

-
-
- - -

The index of thisOPTIONin its parentSELECT.

-
-
- - -

The control is unavailable in this context. See thedisabled attribute definitionin HTML 4.0.

-
-
- - -

Option label for use in hierarchical menus. See thelabel attribute definitionin HTML 4.0.

-
-
- - -

Means that this option is initially selected. See theselected attribute definitionin HTML 4.0.

-
-
- - -

The current form control value. See thevalue attribute definitionin HTML 4.0.

-
-
-
- - -

Form control.Note.Depending upon the environment the page is being viewed, the value property may be read-only for the file upload input type. For the "password" input type, the actual value returned may be masked to prevent unauthorized use. See theINPUT element definitionin HTML 4.0.

-
- - -

Stores the initial control value (i.e., the initial value ofvalue).

-
-
- - -

Whentypehas the value "Radio" or "Checkbox", stores the initial value of thecheckedattribute.

-
-
- - -

Returns theFORMelement containing this control. Returns null if this control is not within the context of a form.

-
-
- - -

A comma-separated list of content types that a server processing this form will handle correctly. See theaccept attribute definitionin HTML 4.0.

-
-
- - -

A single character access key to give access to the form control. See theaccesskey attribute definitionin HTML 4.0.

-
-
- - -

Aligns this object (vertically or horizontally) with respect to its surrounding text. See thealign attribute definitionin HTML 4.0. This attribute is deprecated in HTML 4.0.

-
-
- - -

Alternate text for user agents not rendering the normal content of this element. See thealt attribute definitionin HTML 4.0.

-
-
- - -

Describes whether a radio or check box is checked, whentypehas the value "Radio" or "Checkbox". The value is TRUE if explicitly set. Represents the current state of the checkbox or radio button. See thechecked attribute definitionin HTML 4.0.

-
-
- - -

The control is unavailable in this context. See thedisabled attribute definitionin HTML 4.0.

-
-
- - -

Maximum number of characters for text fields, whentypehas the value "Text" or "Password". See themaxlength attribute definitionin HTML 4.0.

-
-
- - -

Form control or object name when submitted with a form. See thename attribute definitionin HTML 4.0.

-
-
- - -

This control is read-only. Whentypehas the value "text" or "password" only. See thereadonly attribute definitionin HTML 4.0.

-
-
- - -

Size information. The precise meaning is specific to each type of field. See thesize attribute definitionin HTML 4.0.

-
-
- - -

When thetypeattribute has the value "Image", this attribute specifies the location of the image to be used to decorate the graphical submit button. See thesrc attribute definitionin HTML 4.0.

-
-
- - -

Index that represents the element's position in the tabbing order. See thetabindex attribute definitionin HTML 4.0.

-
-
- - -

The type of control created. See thetype attribute definitionin HTML 4.0.

-
-
- - -

Use client-side image map. See theusemap attribute definitionin HTML 4.0.

-
-
- - -

The current form control value. Used for radio buttons and check boxes. See thevalue attribute definitionin HTML 4.0.

-
-
- - -

Removes keyboard focus from this element.

-
- - - -

- - - - - - -

Gives keyboard focus to this element.

-
- - - -

- - - - - - -

Select the contents of the text area. ForINPUTelements whosetypeattribute has one of the following values: "Text", "File", or "Password".

-
- - - -

- - - - - - -

Simulate a mouse-click. ForINPUTelements whosetypeattribute has one of the following values: "Button", "Checkbox", "Radio", "Reset", or "Submit".

-
- - - -

- - - - - - - -

Multi-line text field. See theTEXTAREA element definitionin HTML 4.0.

-
- - -

Stores the initial control value (i.e., the initial value ofvalue).

-
-
- - -

Returns theFORMelement containing this control. Returns null if this control is not within the context of a form.

-
-
- - -

A single character access key to give access to the form control. See theaccesskey attribute definitionin HTML 4.0.

-
-
- - -

Width of control (in characters). See thecols attribute definitionin HTML 4.0.

-
-
- - -

The control is unavailable in this context. See thedisabled attribute definitionin HTML 4.0.

-
-
- - -

Form control or object name when submitted with a form. See thename attribute definitionin HTML 4.0.

-
-
- - -

This control is read-only. See thereadonly attribute definitionin HTML 4.0.

-
-
- - -

Number of text rows. See therows attribute definitionin HTML 4.0.

-
-
- - -

Index that represents the element's position in the tabbing order. See thetabindex attribute definitionin HTML 4.0.

-
-
- - -

The type of this form control.

-
-
- - -

The current textual content of the multi-line text field. If the entirety of the data can not fit into a single wstring, the implementation may truncate the data.

-
-
- - -

Removes keyboard focus from this element.

-
- - - -

- - - - - - -

Gives keyboard focus to this element.

-
- - - -

- - - - - - -

Select the contents of theTEXTAREA.

-
- - - -

- - - - - - - -

Push button. See theBUTTON element definitionin HTML 4.0.

-
- - -

Returns theFORMelement containing this control. Returns null if this control is not within the context of a form.

-
-
- - -

A single character access key to give access to the form control. See theaccesskey attribute definitionin HTML 4.0.

-
-
- - -

The control is unavailable in this context. See thedisabled attribute definitionin HTML 4.0.

-
-
- - -

Form control or object name when submitted with a form. See thename attribute definitionin HTML 4.0.

-
-
- - -

Index that represents the element's position in the tabbing order. See thetabindex attribute definitionin HTML 4.0.

-
-
- - -

The type of button. See thetype attribute definitionin HTML 4.0.

-
-
- - -

The current form control value. See thevalue attribute definitionin HTML 4.0.

-
-
-
- - -

Form field label text. See theLABEL element definitionin HTML 4.0.

-
- - -

Returns theFORMelement containing this control. Returns null if this control is not within the context of a form.

-
-
- - -

A single character access key to give access to the form control. See theaccesskey attribute definitionin HTML 4.0.

-
-
- - -

This attribute links this label with another form control byidattribute. See thefor attribute definitionin HTML 4.0.

-
-
-
- - -

Organizes form controls into logical groups. See theFIELDSET element definitionin HTML 4.0.

-
- - -

Returns theFORMelement containing this control. Returns null if this control is not within the context of a form.

-
-
-
- - -

Provides a captionfor aFIELDSETgrouping. See theLEGEND element definitionin HTML 4.0.

-
- - -

Returns theFORMelement containing this control. Returns null if this control is not within the context of a form.

-
-
- - -

A single character access key to give access to the form control. See theaccesskey attribute definitionin HTML 4.0.

-
-
- - -

Text alignment relative toFIELDSET. See thealign attribute definitionin HTML 4.0. This attribute is deprecated in HTML 4.0.

-
-
-
- - -

Unordered list. See theUL element definitionin HTML 4.0.

-
- - -

Reduce spacing between list items. See thecompact attribute definitionin HTML 4.0. This attribute is deprecated in HTML 4.0.

-
-
- - -

Bullet style. See thetype attribute definitionin HTML 4.0. This attribute is deprecated in HTML 4.0.

-
-
-
- - -

Ordered list. See theOL element definitionin HTML 4.0.

-
- - -

Reduce spacing between list items. See thecompact attribute definitionin HTML 4.0. This attribute is deprecated in HTML 4.0.

-
-
- - -

Starting sequence number. See thestart attribute definitionin HTML 4.0. This attribute is deprecated in HTML 4.0.

-
-
- - -

Numbering style. See thetype attribute definitionin HTML 4.0. This attribute is deprecated in HTML 4.0.

-
-
-
- - -

Definition list. See theDL element definitionin HTML 4.0.

-
- - -

Reduce spacing between list items. See thecompact attribute definitionin HTML 4.0. This attribute is deprecated in HTML 4.0.

-
-
-
- - -

Directory list. See theDIR element definitionin HTML 4.0. This element is deprecated in HTML 4.0.

-
- - -

Reduce spacing between list items. See thecompact attribute definitionin HTML 4.0. This attribute is deprecated in HTML 4.0.

-
-
-
- - -

Menu list. See theMENU element definitionin HTML 4.0. This element is deprecated in HTML 4.0.

-
- - -

Reduce spacing between list items. See thecompact attribute definitionin HTML 4.0. This attribute is deprecated in HTML 4.0.

-
-
-
- - -

List item. See theLI element definitionin HTML 4.0.

-
- - -

List item bullet style. See thetype attribute definitionin HTML 4.0. This attribute is deprecated in HTML 4.0.

-
-
- - -

Reset sequence number when used inOLSee thevalue attribute definitionin HTML 4.0. This attribute is deprecated in HTML 4.0.

-
-
-
- - -

Generic block container. See theDIV element definitionin HTML 4.0.

-
- - -

Horizontal text alignment. See thealign attribute definitionin HTML 4.0. This attribute is deprecated in HTML 4.0.

-
-
-
- - -

Paragraphs. See theP element definitionin HTML 4.0.

-
- - -

Horizontal text alignment. See thealign attribute definitionin HTML 4.0. This attribute is deprecated in HTML 4.0.

-
-
-
- - -

For theH1toH6elements. See theH1 element definitionin HTML 4.0.

-
- - -

Horizontal text alignment. See thealign attribute definitionin HTML 4.0. This attribute is deprecated in HTML 4.0.

-
-
-
- - -

For theQandBLOCKQUOTEelements. See theQ element definitionin HTML 4.0.

-
- - -

A URI designating a document that designates a source document or message. See thecite attribute definitionin HTML 4.0.

-
-
-
- - -

Preformatted text. See thePRE element definitionin HTML 4.0.

-
- - -

Fixed width for content. See thewidth attribute definitionin HTML 4.0. This attribute is deprecated in HTML 4.0.

-
-
-
- - -

Force a line break. See theBR element definitionin HTML 4.0.

-
- - -

Control flow of text around floats. See theclear attribute definitionin HTML 4.0. This attribute is deprecated in HTML 4.0.

-
-
-
- - -

Base font. See theBASEFONT element definitionin HTML 4.0. This element is deprecated in HTML 4.0.

-
- - -

Font color. See thecolor attribute definitionin HTML 4.0. This attribute is deprecated in HTML 4.0.

-
-
- - -

Font face identifier. See theface attribute definitionin HTML 4.0. This attribute is deprecated in HTML 4.0.

-
-
- - -

Font size. See thesize attribute definitionin HTML 4.0. This attribute is deprecated in HTML 4.0.

-
-
-
- - -

Local change to font. See theFONT element definitionin HTML 4.0. This element is deprecated in HTML 4.0.

-
- - -

Font color. See thecolor attribute definitionin HTML 4.0. This attribute is deprecated in HTML 4.0.

-
-
- - -

Font face identifier. See theface attribute definitionin HTML 4.0. This attribute is deprecated in HTML 4.0.

-
-
- - -

Font size. See thesize attribute definitionin HTML 4.0. This attribute is deprecated in HTML 4.0.

-
-
-
- - -

Create a horizontal rule. See theHR element definitionin HTML 4.0.

-
- - -

Align the rule on the page. See thealign attribute definitionin HTML 4.0. This attribute is deprecated in HTML 4.0.

-
-
- - -

Indicates to the user agent that there should be no shading in the rendering of this element. See thenoshade attribute definitionin HTML 4.0. This attribute is deprecated in HTML 4.0.

-
-
- - -

The height of the rule. See thesize attribute definitionin HTML 4.0. This attribute is deprecated in HTML 4.0.

-
-
- - -

The width of the rule. See thewidth attribute definitionin HTML 4.0. This attribute is deprecated in HTML 4.0.

-
-
-
- - -

Notice of modification to part of a document. See theINSandDELelement definitions in HTML 4.0.

-
- - -

A URI designating a document that describes the reason for the change. See thecite attribute definitionin HTML 4.0.

-
-
- - -

The date and time of the change. See thedatetime attribute definitionin HTML 4.0.

-
-
-
- - -

The anchor element. See theA element definitionin HTML 4.0.

-
- - -

A single character access key to give access to the form control. See theaccesskey attribute definitionin HTML 4.0.

-
-
- - -

The character encoding of the linked resource. See thecharset attribute definitionin HTML 4.0.

-
-
- - -

Comma-separated list of lengths, defining an active region geometry. See alsoshapefor the shape of the region. See thecoords attribute definitionin HTML 4.0.

-
-
- - -

The URI of the linked resource. See thehref attribute definitionin HTML 4.0.

-
-
- - -

Language code of the linked resource. See thehreflang attribute definitionin HTML 4.0.

-
-
- - -

Anchor name. See thename attribute definitionin HTML 4.0.

-
-
- - -

Forward link type. See therel attribute definitionin HTML 4.0.

-
-
- - -

Reverse link type. See therev attribute definitionin HTML 4.0.

-
-
- - -

The shape of the active area. The coordinates are given bycoords. See theshape attribute definitionin HTML 4.0.

-
-
- - -

Index that represents the element's position in the tabbing order. See thetabindex attribute definitionin HTML 4.0.

-
-
- - -

Frame to render the resource in. See thetarget attribute definitionin HTML 4.0.

-
-
- - -

Advisory content type. See thetype attribute definitionin HTML 4.0.

-
-
- - -

Removes keyboard focus from this element.

-
- - - -

- - - - - - -

Gives keyboard focus to this element.

-
- - - -

- - - - - - - -

Embedded image. See theIMG element definitionin HTML 4.0.

-
- - -

URI designating the source of this image, for low-resolution output.

-
-
- - -

The name of the element (for backwards compatibility).

-
-
- - -

Aligns this object (vertically or horizontally) with respect to its surrounding text. See thealign attribute definitionin HTML 4.0. This attribute is deprecated in HTML 4.0.

-
-
- - -

Alternate text for user agents not rendering the normal content of this element. See thealt attribute definitionin HTML 4.0.

-
-
- - -

Width of border around image. See theborder attribute definitionin HTML 4.0. This attribute is deprecated in HTML 4.0.

-
-
- - -

Override height. See theheight attribute definitionin HTML 4.0.

-
-
- - -

Horizontal space to the left and right of this image. See thehspace attribute definitionin HTML 4.0. This attribute is deprecated in HTML 4.0.

-
-
- - -

Use server-side image map. See theismap attribute definitionin HTML 4.0.

-
-
- - -

URI designating a long description of this image or frame. See thelongdesc attribute definitionin HTML 4.0.

-
-
- - -

URI designating the source of this image. See thesrc attribute definitionin HTML 4.0.

-
-
- - -

Use client-side image map. See theusemap attribute definitionin HTML 4.0.

-
-
- - -

Vertical space above and below this image. See thevspace attribute definitionin HTML 4.0. This attribute is deprecated in HTML 4.0.

-
-
- - -

Override width. See thewidth attribute definitionin HTML 4.0.

-
-
-
- - -

Generic embedded object.Note.In principle, all properties on the object element are read-write but in some environments some properties may be read-only once the underlying object is instantiated. See theOBJECT element definitionin HTML 4.0.

-
- - -

Returns theFORMelement containing this control. Returns null if this control is not within the context of a form.

-
-
- - -

Applet class file. See thecodeattribute for HTMLAppletElement.

-
-
- - -

Aligns this object (vertically or horizontally) with respect to its surrounding text. See thealign attribute definitionin HTML 4.0. This attribute is deprecated in HTML 4.0.

-
-
- - -

Space-separated list of archives. See thearchive attribute definitionin HTML 4.0.

-
-
- - -

Width of border around the object. See theborder attribute definitionin HTML 4.0. This attribute is deprecated in HTML 4.0.

-
-
- - -

Base URI forclassid,data, andarchiveattributes. See thecodebase attribute definitionin HTML 4.0.

-
-
- - -

Content type for data downloaded viaclassidattribute. See thecodetype attribute definitionin HTML 4.0.

-
-
- - -

A URI specifying the location of the object's data. See thedata attribute definitionin HTML 4.0.

-
-
- - -

Declare (for future reference), but do not instantiate, this object. See thedeclare attribute definitionin HTML 4.0.

-
-
- - -

Override height. See theheight attribute definitionin HTML 4.0.

-
-
- - -

Horizontal space to the left and right of this image, applet, or object. See thehspace attribute definitionin HTML 4.0. This attribute is deprecated in HTML 4.0.

-
-
- - -

Form control or object name when submitted with a form. See thename attribute definitionin HTML 4.0.

-
-
- - -

Message to render while loading the object. See thestandby attribute definitionin HTML 4.0.

-
-
- - -

Index that represents the element's position in the tabbing order. See thetabindex attribute definitionin HTML 4.0.

-
-
- - -

Content type for data downloaded viadataattribute. See thetype attribute definitionin HTML 4.0.

-
-
- - -

Use client-side image map. See theusemap attribute definitionin HTML 4.0.

-
-
- - -

Vertical space above and below this image, applet, or object. See thevspace attribute definitionin HTML 4.0. This attribute is deprecated in HTML 4.0.

-
-
- - -

Override width. See thewidth attribute definitionin HTML 4.0.

-
-
-
- - -

Parameters fed to theOBJECTelement. See thePARAM element definitionin HTML 4.0.

-
- - -

The name of a run-time parameter. See thename attribute definitionin HTML 4.0.

-
-
- - -

Content type for thevalueattribute whenvaluetypehas the value "ref". See thetype attribute definitionin HTML 4.0.

-
-
- - -

The value of a run-time parameter. See thevalue attribute definitionin HTML 4.0.

-
-
- - -

Information about the meaning of thevalueattribute value. See thevaluetype attribute definitionin HTML 4.0.

-
-
-
- - -

An embedded Java applet. See theAPPLET element definitionin HTML 4.0. This element is deprecated in HTML 4.0.

-
- - -

Aligns this object (vertically or horizontally) with respect to its surrounding text. See thealign attribute definitionin HTML 4.0. This attribute is deprecated in HTML 4.0.

-
-
- - -

Alternate text for user agents not rendering the normal content of this element. See thealt attribute definitionin HTML 4.0. This attribute is deprecated in HTML 4.0.

-
-
- - -

Comma-separated archive list. See thearchive attribute definitionin HTML 4.0. This attribute is deprecated in HTML 4.0.

-
-
- - -

Applet class file. See thecode attribute definitionin HTML 4.0. This attribute is deprecated in HTML 4.0.

-
-
- - -

Optional base URI for applet. See thecodebase attribute definitionin HTML 4.0. This attribute is deprecated in HTML 4.0.

-
-
- - -

Override height. See theheight attribute definitionin HTML 4.0. This attribute is deprecated in HTML 4.0.

-
-
- - -

Horizontal space to the left and right of this image, applet, or object. See thehspace attribute definitionin HTML 4.0. This attribute is deprecated in HTML 4.0.

-
-
- - -

The name of the applet. See thename attribute definitionin HTML 4.0. This attribute is deprecated in HTML 4.0.

-
-
- - -

Serialized applet file. See theobject attribute definitionin HTML 4.0. This attribute is deprecated in HTML 4.0.

-
-
- - -

Vertical space above and below this image, applet, or object. See thevspace attribute definitionin HTML 4.0. This attribute is deprecated in HTML 4.0.

-
-
- - -

Override width. See thewidth attribute definitionin HTML 4.0. This attribute is deprecated in HTML 4.0.

-
-
-
- - -

Client-side image map. See theMAP element definitionin HTML 4.0.

-
- - -

The list of areas defined for the image map.

-
-
- - -

Names the map (for use withusemap). See thename attribute definitionin HTML 4.0.

-
-
-
- - -

Client-side image map area definition. See theAREA element definitionin HTML 4.0.

-
- - -

A single character access key to give access to the form control. See theaccesskey attribute definitionin HTML 4.0.

-
-
- - -

Alternate text for user agents not rendering the normal content of this element. See thealt attribute definitionin HTML 4.0.

-
-
- - -

Comma-separated list of lengths, defining an active region geometry. See alsoshapefor the shape of the region. See thecoords attribute definitionin HTML 4.0.

-
-
- - -

The URI of the linked resource. See thehref attribute definitionin HTML 4.0.

-
-
- - -

Specifies that this area is inactive, i.e., has no associated action. See thenohref attribute definitionin HTML 4.0.

-
-
- - -

The shape of the active area. The coordinates are given bycoords. See theshape attribute definitionin HTML 4.0.

-
-
- - -

Index that represents the element's position in the tabbing order. See thetabindex attribute definitionin HTML 4.0.

-
-
- - -

Frame to render the resource in. See thetarget attribute definitionin HTML 4.0.

-
-
-
- - -

Script statements. See theSCRIPT element definitionin HTML 4.0.

-
- - -

The script content of the element.

-
-
- - -

-Reserved for future use. -

-
-
- - -

-Reserved for future use. -

-
-
- - -

The character encoding of the linked resource. See thecharset attribute definitionin HTML 4.0.

-
-
- - -

Indicates that the user agent can defer processing of the script. See thedefer attribute definitionin HTML 4.0.

-
-
- - -

URI designating an external script. See thesrc attribute definitionin HTML 4.0.

-
-
- - -

The content type of the script language. See thetype attribute definitionin HTML 4.0.

-
-
-
- - -

The create* and delete* methods on the table allow authors to construct and modify tables. HTML 4.0 specifies that only one of each of theCAPTION,THEAD, andTFOOTelements may exist in a table. Therefore, if one exists, and the createTHead() or createTFoot() method is called, the method returns the existing THead or TFoot element. See theTABLE element definitionin HTML 4.0.

-
- - -

Returns the table'sCAPTION, or void if none exists.

-
-
- - -

Returns the table'sTHEAD, ornullif none exists.

-
-
- - -

Returns the table'sTFOOT, ornullif none exists.

-
-
- - -

Returns a collection of all the rows in the table, including all inTHEAD,TFOOT, allTBODYelements.

-
-
- - -

Returns a collection of the defined table bodies.

-
-
- - -

Specifies the table's position with respect to the rest of the document. See thealign attribute definitionin HTML 4.0. This attribute is deprecated in HTML 4.0.

-
-
- - -

Cell background color. See thebgcolor attribute definitionin HTML 4.0. This attribute is deprecated in HTML 4.0.

-
-
- - -

The width of the border around the table. See theborder attribute definitionin HTML 4.0.

-
-
- - -

Specifies the horizontal and vertical space between cell content and cell borders. See thecellpadding attribute definitionin HTML 4.0.

-
-
- - -

Specifies the horizontal and vertical separation between cells. See thecellspacing attribute definitionin HTML 4.0.

-
-
- - -

Specifies which external table borders to render. See theframe attribute definitionin HTML 4.0.

-
-
- - -

Specifies which internal table borders to render. See therules attribute definitionin HTML 4.0.

-
-
- - -

Supplementary description about the purpose or structure of a table. See thesummary attribute definitionin HTML 4.0.

-
-
- - -

Specifies the desired table width. See thewidth attribute definitionin HTML 4.0.

-
-
- - -

Create a table header row or return an existing one.

-
- - - -

A new table header element (THEAD).

-
-
- -
- - -

Delete the header from the table, if one exists.

-
- - - -

- - - - - - -

Create a table footer row or return an existing one.

-
- - - -

A footer element (TFOOT).

-
-
- -
- - -

Delete the footer from the table, if one exists.

-
- - - -

- - - - - - -

Create a new table caption object or return an existing one.

-
- - - -

ACAPTIONelement.

-
-
- -
- - -

Delete the table caption, if one exists.

-
- - - -

- - - - - - -

Insert a new empty row in the table.Note.A table row cannot be empty according to HTML 4.0 Recommendation.

-
- - - -

The row number where to insert a new row.

-
- -
- - -

The newly created row.

-
-
- -
- - -

Delete a table row.

-
- - - -

The index of the row to be deleted.

-
- -
- - -

- - - - - - - -

Table caption See theCAPTION element definitionin HTML 4.0.

-
- - -

Caption alignment with respect to the table. See thealign attribute definitionin HTML 4.0. This attribute is deprecated in HTML 4.0.

-
-
-
- - -

Regroups theCOLandCOLGROUPelements. See theCOL element definitionin HTML 4.0.

-
- - -

Horizontal alignment of cell data in column. See thealign attribute definitionin HTML 4.0.

-
-
- - -

Alignment character for cells in a column. See thechar attribute definitionin HTML 4.0.

-
-
- - -

Offset of alignment character. See thecharoff attribute definitionin HTML 4.0.

-
-
- - -

Indicates the number of columns in a group or affected by a grouping. See thespan attribute definitionin HTML 4.0.

-
-
- - -

Vertical alignment of cell data in column. See thevalign attribute definitionin HTML 4.0.

-
-
- - -

Default column width. See thewidth attribute definitionin HTML 4.0.

-
-
-
- - -

TheTHEAD,TFOOT, andTBODYelements.

-
- - -

Horizontal alignment of data in cells. See thealignattribute for HTMLTheadElement for details.

-
-
- - -

Alignment character for cells in a column. See thechar attribute definitionin HTML 4.0.

-
-
- - -

Offset of alignment character. See thecharoff attribute definitionin HTML 4.0.

-
-
- - -

Vertical alignment of data in cells. See thevalignattribute for HTMLTheadElement for details.

-
-
- - -

The collection of rows in this table section.

-
-
- - -

Insert a row into this section.

-
- - - -

The row number where to insert a new row.

-
- -
- - -

The newly created row.

-
-
- -
- - -

Delete a row from this section.

-
- - - -

The index of the row to be deleted.

-
- -
- - -

- - - - - - - -

A row in a table. See theTR element definitionin HTML 4.0.

-
- - -

The index of this row, relative to the entire table.

-
-
- - -

The index of this row, relative to the current section (THEAD,TFOOT, orTBODY).

-
-
- - -

The collection of cells in this row.

-
-
- - -

Horizontal alignment of data within cells of this row. See thealign attribute definitionin HTML 4.0.

-
-
- - -

Background color for rows. See thebgcolor attribute definitionin HTML 4.0. This attribute is deprecated in HTML 4.0.

-
-
- - -

Alignment character for cells in a column. See thechar attribute definitionin HTML 4.0.

-
-
- - -

Offset of alignment character. See thecharoff attribute definitionin HTML 4.0.

-
-
- - -

Vertical alignment of data within cells of this row. See thevalign attribute definitionin HTML 4.0.

-
-
- - -

Insert an emptyTDcell into this row.

-
- - - -

The place to insert the cell.

-
- -
- - -

The newly created cell.

-
-
- -
- - -

Delete a cell from the current row.

-
- - - -

The index of the cell to delete.

-
- -
- - -

- - - - - - - -

The object used to represent theTHandTDelements. See theTD element definitionin HTML 4.0.

-
- - -

The index of this cell in the row.

-
-
- - -

Abbreviation for header cells. See theabbr attribute definitionin HTML 4.0.

-
-
- - -

Horizontal alignment of data in cell. See thealign attribute definitionin HTML 4.0.

-
-
- - -

Names group of related headers. See theaxis attribute definitionin HTML 4.0.

-
-
- - -

Cell background color. See thebgcolor attribute definitionin HTML 4.0. This attribute is deprecated in HTML 4.0.

-
-
- - -

Alignment character for cells in a column. See thechar attribute definitionin HTML 4.0.

-
-
- - -

Offset of alignment character. See thecharoff attribute definitionin HTML 4.0.

-
-
- - -

Number of columns spanned by cell. See thecolspan attribute definitionin HTML 4.0.

-
-
- - -

List ofidattribute values for header cells. See theheaders attribute definitionin HTML 4.0.

-
-
- - -

Cell height. See theheight attribute definitionin HTML 4.0. This attribute is deprecated in HTML 4.0.

-
-
- - -

Suppress word wrapping. See thenowrap attribute definitionin HTML 4.0. This attribute is deprecated in HTML 4.0.

-
-
- - -

Number of rows spanned by cell. See therowspan attribute definitionin HTML 4.0.

-
-
- - -

Scope covered by header cells. See thescope attribute definitionin HTML 4.0.

-
-
- - -

Vertical alignment of data in cell. See thevalign attribute definitionin HTML 4.0.

-
-
- - -

Cell width. See thewidth attribute definitionin HTML 4.0. This attribute is deprecated in HTML 4.0.

-
-
-
- - -

Create a grid of frames. See theFRAMESET element definitionin HTML 4.0.

-
- - -

The number of columns of frames in the frameset. See thecols attribute definitionin HTML 4.0.

-
-
- - -

The number of rows of frames in the frameset. See therows attribute definitionin HTML 4.0.

-
-
-
- - -

Create a frame. See theFRAME element definitionin HTML 4.0.

-
- - -

Request frame borders. See theframeborder attribute definitionin HTML 4.0.

-
-
- - -

URI designating a long description of this image or frame. See thelongdesc attribute definitionin HTML 4.0.

-
-
- - -

Frame margin height, in pixels. See themarginheight attribute definitionin HTML 4.0.

-
-
- - -

Frame margin width, in pixels. See themarginwidth attribute definitionin HTML 4.0.

-
-
- - -

The frame name (object of thetargetattribute). See thename attribute definitionin HTML 4.0.

-
-
- - -

When true, forbid user from resizing frame. See thenoresize attribute definitionin HTML 4.0.

-
-
- - -

Specify whether or not the frame should have scrollbars. See thescrolling attribute definitionin HTML 4.0.

-
-
- - -

A URI designating the initial frame contents. See thesrc attribute definitionin HTML 4.0.

-
-
-
- - -

Inline subwindows. See theIFRAME element definitionin HTML 4.0.

-
- - -

Aligns this object (vertically or horizontally) with respect to its surrounding text. See thealign attribute definitionin HTML 4.0. This attribute is deprecated in HTML 4.0.

-
-
- - -

Request frame borders. See theframeborder attribute definitionin HTML 4.0.

-
-
- - -

Frame height. See theheight attribute definitionin HTML 4.0.

-
-
- - -

URI designating a long description of this image or frame. See thelongdesc attribute definitionin HTML 4.0.

-
-
- - -

Frame margin height, in pixels. See themarginheight attribute definitionin HTML 4.0.

-
-
- - -

Frame margin width, in pixels. See themarginwidth attribute definitionin HTML 4.0.

-
-
- - -

The frame name (object of thetargetattribute). See thename attribute definitionin HTML 4.0.

-
-
- - -

Specify whether or not the frame should have scrollbars. See thescrolling attribute definitionin HTML 4.0.

-
-
- - -

A URI designating the initial frame contents. See thesrc attribute definitionin HTML 4.0.

-
-
- - -

Frame width. See thewidth attribute definitionin HTML 4.0.

-
-
-
-
diff --git a/test/transform/string.xsl b/test/transform/string.xsl deleted file mode 100644 index 7b51102..0000000 --- a/test/transform/string.xsl +++ /dev/null @@ -1,1233 +0,0 @@ - - - - - - - - $Id: string.xsl,v 1.13 2004/10/08 06:37:25 balls Exp $ - - - Ball - Steve - - - 2002 - 2001 - Steve Ball - - - - String Processing - - -
- Introduction - - This module provides templates for manipulating strings. - -
-
- -
- - - - - - - - - - - - - Make string uppercase - - - Converts all lowercase letters to uppercase. - - - - - - text - - The string to be converted - - - - - - - Returns string with all uppercase letters. - - - - - - - - - - - - - - ß - - - S - S - - - - - - - - - Make string lowercase - - - Converts all uppercase letters to lowercase. - - - - - - text - - The string to be converted - - - - - - - Returns string with all lowercase letters. - - - - - - - - - - - Capitalise string - - - Converts first character of string to an uppercase letter. All remaining characters are converted to lowercase. - - - - - - text - - The string to be capitalised - - - - all - - Boolean controlling whether all words in the string are capitalised. - Default is true. - - - - - - - Returns string with first character uppcase and all remaining characters lowercase. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Convert a string to one camelcase word - - - Converts a string to one lowerCamelCase or UpperCamelCase - word, depending on the setting of the "upper" - parameter. UpperCamelCase is also called MixedCase while - lowerCamelCase is also called just camelCase. The template - removes any spaces, tabs and slashes, but doesn't deal with - other punctuation. It's purpose is to convert strings like - "hollow timber flush door" to a term suitable as identifier or - XML tag like "HollowTimberFlushDoor". - - - - - - - text - - The string to be capitalised - - - - upper - - Boolean controlling whether the string becomes an - UpperCamelCase word or a lowerCamelCase word. - Default is true. - - - - - - - Returns string with first character uppcase and all remaining characters lowercase. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - String extraction - - - Extracts the portion of string 'text' which occurs before any of the characters in string 'chars'. - - - - - - text - - The string from which to extract a substring. - - - - chars - - The string containing characters to find. - - - - - - - Returns string. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - String extraction - - - Extracts the portion of string 'text' which occurs after the last of the character in string 'chars'. - - - - - - text - - The string from which to extract a substring. - - - - chars - - The string containing characters to find. - - - - - - - Returns string. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - String extraction - - - Extracts the portion of string 'text' which occurs before the first character of the last occurance of string 'chars'. - - - - - - text - - The string from which to extract a substring. - - - - chars - - The string containing characters to find. - - - - - - - Returns string. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - String substitution - - - Substitute 'replace' for 'with' in string 'text'. - - - - - - text - - The string upon which to perform substitution. - - - - replace - - The string to substitute. - - - - with - - The string to be substituted. - - - - disable-output-escaping - - A value of yes indicates that the result should have output escaping disabled. Any other value allows normal escaping of text values. The default is to enable output escaping. - - - - - - - Returns string. - - - - - - - - no - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Count Substrings - - - Counts the number of times a substring occurs in a string. This can also counts the number of times a character occurs in a string, since a character is simply a string of length 1. - - - - Counting Lines - - - - -]]> - - - - - - text - - The source string. - - - - chars - - The substring to count. - - - - - - - Returns a non-negative integer value. - - - - - - - - - - 0 - - - - - - - - - - - - 0 - - - - - - String extraction - - Extracts the portion of a 'char' delimited 'text' string "array" at a given 'position'. - - - - - text - - The string from which to extract a substring. - - - - chars - - delimiters - - - - position - - position of the elements - - - - all - - If true all of the remaining string is returned, otherwise only the element at the given position is returned. Default: false(). - - - - - - Returns string. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - String extraction - - Extracts the portion of a 'char' delimited 'text' string "array" at a given 'position' - - - - - text - - The string from which to extract a substring. - - - - chars - - delimiters - - - - position - - position of the elements - - - - - - Returns string. - - - - - - - - - - - - - - - - - - - - - - - - - - - String insertion - - Insert 'chars' into "text' at any given "position' - - - - - text - - The string upon which to perform insertion - - - - position - - the position where insertion will be performed - - - - with - - The string to be inserted - - - - - - Returns string. - - - - - - - - - - - - - - - - - String reversal - - - Reverse the content of a given string - - - - - - text - - The string to be reversed - - - - - - - Returns string. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Format a string - - - Inserts newlines and spaces into a string to format it as a block of text. - - - - - - text - - String to be formatted. - - - - max - - Maximum line length. - - - - indent - - Number of spaces to insert at the beginning of each line. - - - - justify - - Justify left, right or both. Not currently implemented (fixed at "left"). - - - - - - - Formatted block of text. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Find first occurring character in a string - - - Finds which of the given characters occurs first in a string. - - - - - - text - - The source string. - - - - chars - - The characters to search for. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Match A String To A Pattern - - - Performs globbing-style pattern matching on a string. - - - - Match Pattern - - - - -]]> - - - - - - text - - The source string. - - - - pattern - - The pattern to match against. Certain characters have special meaning: - - - * - - Matches zero or more characters. - - - - ? - - Matches a single character. - - - - \ - - Character escape. The next character is taken as a literal character. - - - - - - - - - - Returns "1" if the string matches the pattern, "0" otherwise. - - - - - - - - - - - 1 - - - 1 - - - 0 - - - - - - - - - - - - - - - - - - - - - - 0 - - - - 1 - - - - - - - - - - - - - - - - - - - - - - - 0 - - - - - - - 1 - - - 0 - - - - - - - - - - - - - - - - - - - - - - - - - 0 - - - - - - - - - - - - - Create A Repeating Sequence of Characters - - - Repeats a string a given number of times. - - - - - - text - - The string to repeat. - - - - count - - The number of times to repeat the string. - - - - - - - - - - - - - - - - - - - - - - -
- diff --git a/test/transform/test-to-c.xsl b/test/transform/test-to-c.xsl deleted file mode 100644 index fd44e93..0000000 --- a/test/transform/test-to-c.xsl +++ /dev/null @@ -1,511 +0,0 @@ - - - - - - - - - - - dom1-interfaces.xml - - http://www.w3.org/2001/DOM-Test-Suite/tests/Level-1/ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Unrecognized element - - - - - - - - - - - - - - int main(int argc, char **argv) -{ - - - - false - - return 0; -} - - - - - - package not implemented - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - assertEventCount not implemented - - - - - - - - - - - - - - - - - - - - - - - - - - - - subtract not implemented - - - - - - - - divide not implemented - - - - - - - - - - - if ( - - ) { - - - - - - - } - - - else { - - - - - - } - - - - - - - - - - TRY - - - - true - - ENDTRY - - - - - - - - - - - - - - - wait not implemented - - - - - - - - - - - - - - - - - - - - - - - - - - userObj not implemented - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - same not implemented - - - - - - - - - - - - - - - lessOrEquals not implemented - - - - - - - - greaterOrEquals not implemented - - - - - isNull not implemented - - - - - - - - - - ( - - | - - ) - - - - - xor not implemented - - - - - - - - instanceOf not implemented - - - - - - - - - - - hasSize not implemented - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/test/xml/tests/dom1.dtd b/test/xml/tests/dom1.dtd deleted file mode 100644 index ad7492d..0000000 --- a/test/xml/tests/dom1.dtd +++ /dev/null @@ -1,2500 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file -- cgit v1.2.3