You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by ja...@apache.org on 2001/10/07 01:52:02 UTC
cvs commit: xml-xerces/perl/t IDOMParser.t
jasons 01/10/06 16:52:02
Modified: perl/t IDOMParser.t
Log:
* t/IDOMParser.t (Repository):
Test ignorable whitespace handling
Revision Changes Path
1.5 +16 -5 xml-xerces/perl/t/IDOMParser.t
Index: IDOMParser.t
===================================================================
RCS file: /home/cvs/xml-xerces/perl/t/IDOMParser.t,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- IDOMParser.t 2001/09/06 04:33:43 1.4
+++ IDOMParser.t 2001/10/06 23:52:02 1.5
@@ -7,14 +7,14 @@
# Change 1..1 below to 1..last_test_to_print .
# (It may become useful if the test is moved to ./t subdirectory.)
-BEGIN { $| = 1; print "1..6\n"; }
+BEGIN { $| = 1; print "1..8\n"; }
END {print "not ok 1\n" unless $loaded;}
use Carp;
-# use blib;
+use blib;
use XML::Xerces;
use lib 't';
-use TestUtils qw(result $PERSONAL_FILE_NAME $PERSONAL $DOM);
+use TestUtils qw(result $PERSONAL_FILE_NAME $PERSONAL_NO_DOCTYPE $PERSONAL $DOM);
use vars qw($i $loaded);
use strict;
@@ -46,16 +46,19 @@
# since IDOM can't create XML Decl nodes
$DOM->setToCreateXMLDeclTypeNode(0);
-$DOM->parse(XML::Xerces::MemBufInputSource->new($PERSONAL, 'foo'));
+$DOM->parse(XML::Xerces::MemBufInputSource->new($PERSONAL_NO_DOCTYPE, 'foo'));
$PERSONAL = $DOM->getDocument->serialize;
my $IDOM = XML::Xerces::IDOMParser->new();
-$IDOM->parse(XML::Xerces::MemBufInputSource->new($PERSONAL, 'foo'));
+$IDOM->parse(XML::Xerces::MemBufInputSource->new($PERSONAL_NO_DOCTYPE, 'foo'));
my $serialize = $IDOM->getDocument->serialize;
result($serialize eq $PERSONAL);
+# now test reparsing a file
$IDOM->reset();
$IDOM->parse(XML::Xerces::MemBufInputSource->new($document, 'foo'));
+result(1);
+
my $doc = $IDOM->getDocument();
my @persons = $doc->getElementsByTagName('person');
result(scalar @persons == 3);
@@ -68,3 +71,11 @@
$IDOM->parse($PERSONAL_FILE_NAME);
result(1);
+$IDOM = XML::Xerces::IDOMParser->new();
+$IDOM->setValidationScheme($XML::Xerces::IDOMParser::Val_Always);
+$IDOM->setIncludeIgnorableWhitespace(0);
+$IDOM->parse($PERSONAL_FILE_NAME);
+
+# now check that we do *not* get whitespace nodes
+my @nodes = $IDOM->getDocument->getDocumentElement->getChildNodes();
+result(scalar @nodes == 6);
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-cvs-help@xml.apache.org