Change History:
1.16 (enno) 2/23/1999
- Added XML::DOM::Element::setTagName
- Methods returning NodeList objects will now return regular perl lists when
called in list context, e.g:
@list = $elem->getChildNodes; # returns a list
$nodelist = $elem->getChildNodes; # return a NodeList (object reference)
Note that a NodeList is 'live' (except the one returned by
getElementsByTagName) and that a list is not 'live'.
- Fixed getElementsByTagName.
- It would return the node that it was called on (if the tagName matched)
- It would return the nodes in the wrong order (they should be in
document order)
1.15 (enno) 2/12/1999
- 28% Performance improvements. Benchmark was the following program:
use XML::DOM;
$dom = XML::DOM::Parser->new;
my $doc = $dom->parsefile ("samples/REC-xml-19980210.xml");
Running it 20 times on a Sun Ultra-1, using the ksh function 'time',
the average time was 9.02s (real time.) XML::Parser 2.19, Perl 5.005_02.
As a comparison, XML-Grove-0.05 takes 2.17s running:
use XML::Parser;
use XML::Parser::Grove;
use XML::Grove;
$parser = XML::Parser->new(Style => 'Grove');
$grove = $parser->parsefile ("samples/REC-xml-19980210.xml");
And XML::Parser 2.19 takes 0.71s running (i.e. building nothing):
use XML::Parser;
$parser = XML::Parser->new;
$parser->parsefile ("samples/REC-xml-19980210.xml");
XML-Grove-0.40alpha takes 4.62s running the following script:
use XML::Grove::Builder;
use XML::Parser::SAXPerl;
$grove_builder = XML::Grove::Builder->new;
$parser = XML::Parser::SAXPerl->new ( Handler => $grove_builder );
$document = $parser->parse ( Source => {
SystemId => "samples/REC-xml-19980210.xml" } );
Each following improvement knocked a few tenths of a second off:
- Reimplemented the ReadOnly mechanism, because it was spending a lot of
time in setReadOnly when parsing large documents (new time: 8.00s)
- Hacked appendChild to squeeze out a little speed (new time: 7.70s)
- Eliminated calls to addText in the Start handler which had to figure out
every time wether it should add a piece of text to a previous text node.
Now I keep track of whether the previous node was a text node in the
XML::DOM::Parser code and take care of adding the text and creating a
new Text node right there, without the overhead of several function calls
(new time: 6.45s)
1.14 (enno) 15/1/1999
- Bug in Document::dispose - it tried to call dispose on XMLDecl even
if it didn't exist
- Bug with XML::Parser 2.19 (and up):
XML::Parser 2.19 added support for CdataStart and CdataEnd handlers which
will call the Default handler instead if those handlers aren't defined.
This caused the exception "XML::DOM::DOMException(Code=5, Name=INVALID_CHARACTER_ERR, Message=bad Entity Name [] in EntityReference)"
whenever it encountered a CDATASection.
(Thanks to Roger Espinosa at roger@umich.edu)
- Added a new XML::DOM::Parser option 'KeepCDATA' which will store CDATASections
as CDATASection nodes instead of converting them to Text nodes (which is the
default/old behavior)
- Fixed bug in CDATASection print routine. It printed "<!CDATA[" instead of
"<![CDATA[".
1.13 (enno) 12/21/1998
- (Bug introduced by 1.12) Could not replace the Document root element with
replaceChild. (Thanks again, Francois)
1.12 (enno) 12/18/1998
- Attr::print doesn't print a leading space anymore and Element::print does
print the space. This should affect hardly anybody.
- Added test for HIERARCHY_REQUEST_ERR to Node::replaceChild
- getChildNodes now returns empty NodeList for Nodes that can't have kids
(instead of undef)
- Fixed bug in removeAttribute. It would throw an exception.
(Thanks to Francois Belanger at francois@sitepak.com)
- removeChildNodes was using $_, which was somehow messing up the global $_.
(Thanks again, Francois)
1.11 (enno) 12/16/1998
- Fixed checking of XML::Parser version number. Newer versions should be
allowed as well. Current version works with XML::Parser 2.17.
(Thanks to Martin Kolbuszewski at MKolbuszewski@mail.cebra.com)
- Fixed typo in SYNOPSIS: "print $node->getValue ..." should have been
"print $href->getValue ..." (Thanks again Martin)
- Fixed typo in documentation: 'getItem' method should have been 'item'
(in 2 places.) (Thanks again Martin)
1.10 (enno) 12/8/1998
- Attributes with non-alphanumeric characters in the attribute name (like "-")
were mistaken for default attribute values. (Bug in checkUnspecAttr regexp.)
Default attribute values aren't printed out, so it appeared those attributes
just vanished.
(Thanks to Aravind Subramanian at aravind@genome.wi.mit.edu)
1.09 (enno) 12/3/1998
- Changed NamedNodeMap {Values} to a NodeList instead of []
This way getValues can return a (live) NodeList.
- Added NodeList and NamedNodeMap to documentation
- Fixed documentation section near list of node type constants.
I accidentally pasted some text in between and messed up that whole section.
- getNodeTypeName() always returned empty strings and the documentation
said @XML::DOM::NodeNames, which should have been @XML::DOM::Node::NodeNames
(Thanks to Andrew Fitzhugh at fitzhugh@cup.hp.com)
- Added dispose to NodeList
- Added setOwnerDocument to all Nodes, NodeList and NamedNodeMap, to allow
cut and paste between XML::DOM::Documents.
It does nothing when called on a Document node.
1.08 (enno) 12/1/1998
- No changes - I messed up uploading to PAUS and had to up the version number.
1.07 (enno) 12/1/1998
- added Node::isElementNode for optimization
- added NamedNodeMap::getChildIndex
- fixed documentation regarding getNodeValue. It said it should return
getTagName for Element nodes, but it should return undef.
(thanks to Aravind Subramanian at aravind@genome.wi.mit.edu)
- added CAVEATS in documentation (getElementsByTagName does not return "live"
NodeLists)
- added section about Notation node in documentation
1.06 (enno) 11/16/1998
- fixed example in the SYNOPSIS of the man page
(thanks to Aravind Subramanian at aravind@genome.wi.mit.edu)
- added test case t/example.t (it's also a simple example)
1.05 (enno) 11/11/1998
- added use strict, use vars etc.
- fixed replaceData - changed $str to $data
- merged getElementsByTagName and getElementsByTagName2
- added parsing of attributes (CheckUnspecAttr) to support Attr::isSpecified
- added XML::DOM::Parser class to perform proper cleanup when an exception
is thrown
- more performance improvements, e.g. SafeMode, removed SUPER::new
- added frequency comments for performance optimization: e.g. "REC 7473"
means that that code is hit 7473 times when parsing REC-xml-19980210.xml
- updated POD documentation
- fixed problem in perl 5.004 (can't seems to use references to strings, e.g.
*str = \ "constant";)
1.04 (enno) 10/21/1998
- Removed internal calls to getOwnerDocument, getParentNode
- fixed isAncestor: $node->isAncestor($node) should return true
- Fixed ReadOnly mechanism. Added isAlwaysReadOnly.
- DocumentType::getDefaultAttrValue was using getElementDecl
instead of getAttlistDecl
- Attr::cloneNode cloneChildren was missing 2nd parameter=1 (deep)
- NamedNodeMap::cloneNode forgot to copy {Values} list
- Element::setAttributeNode was comparing {UsedIn} against $self instead of {A}
- fixed AttDef::cloneNode, Value was copied wrong