* r15443 changed the node class with biggest instance size from TDOMAttr to TDOMEntity. Changed that in TDOMDocument constructor, too. Otherwise nodes created with TDOMEntity.CloneNode will leak (they cannot be inserted into tree).
* Do not restore default attributes during document destruction.
* Also added a general check that raises exception if someone tries to allocate from node pool during destruction.
* Fixed replaceChild() method: it was deleting node if that node was replaced by itself.
+ Test for replaceChild.
git-svn-id: trunk@16010 -
o The prefix to resolve should not include following ':*' characters
o NextToken changes CurTokenString, so NextToken must be after reading CurTokenString.
o Added a test for that
* XPath test suite, fixed comparison of numeric result (it is quite tricky in presence of NaNs).
git-svn-id: trunk@15639 -
+ Implemented DOM level 3 properties xmlVersion and xmlEncoding for both TDOMDocument and TDOMEntity classes. Also declared property inputEncoding for these classes.
* Non-conformant TXMLDocument.Encoding has been deprecated; it is now an alias for xmlEncoding property.
* TDOMDocument and TDOMEntity now share a common ancestor, TDOMNode_TopLevel.
* api.xml: enabled testing for the new properties
git-svn-id: trunk@15443 -
* Progress with namespace support. Resolve namespace prefixed while parsing, compare namespaceURI/localNames while evaluating. Existing tests for namespace-uri(), local-name() and name() now all pass, but resolving interface isn't ready for general use yet.
* Fixed name() to default to context node if argument is omitted.
xpathts.pp:
+ support for prefix resolving while testing.
git-svn-id: trunk@13846 -
+ Added TDOMTestBase.LoadStringData method, allows loading documents from string.
* Don't return empty string from GetResourceURI when file doesn't exist. Thus we can see the problematic filename in the test output.
+ Added extras.pp, contains a few tests not present in w3.org test suite.
+ Added extras2.pp, contains some tests ported by hand because no automatic conversion possible yet. It addresses namespace fixup during serialization and canonical-form issues.
README_DOM.txt: updated to reflect the added units.
git-svn-id: trunk@13729 -
- Removed (made abstract) default implementations of TXPathVariable.AsText(), AsNumber() and
AsBoolean(). These methods are overriden by all TXPathVariable descendants, therefore in
TXPathVariable itself they are dead and only increase executable size.
- Removed debug statement committed by accident in r13256.
tests/xpathts.pp:
* Annotated some tests, added a few tests for name(), namespace-uri() and local-name().
git-svn-id: trunk@13322 -
src/dom.pp:
* GetElementsByTagName[NS] results now get cached in a hashtable. Repeated calls to
GetElementsByTagName with same arguments return the same instance of NodeList. All NodeLists
created during document lifetime are destroyed with the document.
src/xmlutils.pp:
* THashTable.Lookup(), changed SetString to SetLength+Move because SetString truncates on #0
+ added THashTable.RemoveData() method
tests/api.xml:
- No longer need to 'garbage collect' the NodeLists.
git-svn-id: trunk@13180 -
* Do not convert tests which request implementation attribute 'signed'='true'.
Such tests aren't applicable to our unsigned DOM, they only cause compiler warnings
and noise in the test report.
+ Support for default properties (obj.item(x) -> obj[x]).
+ Support black-listing of testcases. Some of them (in HTML testsuite) are easier to
rewrite by hand than to convert.
+ Support adding certain units to 'uses' clause (e.g. HTML suite must use dom_html).
git-svn-id: trunk@13172 -
* Partial fix for #13605 (fixes the issue as reported, but a fix for nodelists returned by
GetElementsByTagName[NS] is also needed):
- Each node which can have children has an associated instance of TDOMNodeList;
- Other nodes are substituted by special 'null' node, having an empty child list;
- Muiltiple calls to ChildNodes return the same instance of TDOMNodeList;
- Calling Free on result of ChildNodes is optional; if not freed, it will be destroyed with
the owning node.
tests/domunit.pp:
* Changed TFPObjectList to TObjectList, which has been found to destroy its elements in opposite
order (reported as #13715). As NodeLists became owned by Document, old (FIFO) destruction order is
causing their double destruction.
git-svn-id: trunk@13143 -
domunit.pp:
+ Added AssertEqualsNoCase() method.
* TDOMTestBase.Load chaned doc argument to untyped, because some tests use TDOMNode instead of a
TDOMDocument.
* Completed the URIEquals() method; changed parameter types to PChar in order to be able to
distinguish nil from empty string.
* Modified GetResourceURI method so it is capable to handle the directory structure of CVS
snapshot (level2/html using data files from level1/html).
testgen.pp:
* Counterparts to changes in domunit.pp
+ Support for renaming APIs (e.g. 'type'->'htmlType')
+ Support for enforcing the correct type of function arguments (emits 'as' operator).
api.xml:
+ Added data for DOM Level3 XPath and Level2 HTML suites.
git-svn-id: trunk@13055 -
src/xpath.pp:
+ Implemented sum() and normalize-space() core functions.
* Rewrote comparison code, nodesets are now handled correctly (to the
extent of the tests which I could find).
* starts-with() and contains() return True when second argument is an
empty string - that differs from Pos() behavior.
* NaNs are propagated through mod operator, floor() and ceiling().
* Fixed memory leak caused by not releasing arguments after function
calls.
* string-value of a nodeset is the value of its first node, not all
nodes glued together.
tests/xpathts.pp:
+ Added 120 tests, most coming from OASIS Prototype XSLT/XPath 1.0
conformance test suite.
+ Tests can now take an input xml data as a string.
git-svn-id: trunk@13046 -
+ added TXPathBinaryNode as a common ancestor for binary operations;
+ TXPathBooleanOpNode now handles only 'and' and 'or' operators,
the purpose is to not evaluate the second argument if the result can
be determined by the first argument;
* Comparison operations moved to TXPathCompareNode and fixed
to support INFs and NANs correctly;
* Fixed TranslateWideString() that was not deleting characters;
* Fixed 'substring-after' function so its result is empty when argument
string does not contain the pattern;
* Fixed 'round' funcion so it complies to the specs;
* Completed implementation of 'substring' function (but surrogate pairs
are not handled yet);
* Mask exInvalidOp and exZeroDivide FPU exceptions while evaluating
expressions, this ensures correct calculations with respect to INFs
and NANs.
+ Added testsuite for xpath
git-svn-id: trunk@12961 -
src/xmlread.pp, src/dom.pp
* Improvements to attribute processing: attributes are now validated as
they come. This enables reporting of the corresponding validation
errors at correct positions (previously everything was reported at the
end of element start-tag).
* Search for a declaration for attribute, not for an attribute
corresponding to the declaration. This reduces number of lookups
(because unspecified attributes are not searched) and obsoletes the
need in FDeclared field on every attribute.
tests/domunit.pp, tests/testgen.pp:
* Various improvements required to support converting of the
DOM level 3 XPath module.
git-svn-id: trunk@12026 -
xmlutils.pp, names.inc:
* exclude colon from the NameChar bitmap and handle it in code.
dom.pp:
+ TDOMText.IsElementContentWhitespace now implemented completely.
* Attributes created by TDOMElement.SetAttribute get their
OwnerElement property assigned properly
* Attribute replaced by TDOMNamedNodeMap.SetNamedItem get their
OwnerElement reset to nil
* TDOMElement.SetAttributeNode does not destroy the attribute when it
is being replaced by itself
* Most node boolean properties collected into a single FFlags field
to reduce memory requirements.
xmlread.pp:
+ Syntax-level support of namespaces: handle colons in names, check
correct qualified name syntax, prohibit colons in entity/notation/PI
names and ID/IDREF attribute values (all this only happens when
Options.Namespaces is set to True - not by default).
* Reaching end of input while parsing the Ignore Section is a fatal
error because parameter entities are not recognized there.
* Reaching end of input while parsing entity value literal that was
started in a parameter entity aborts immediately instead of hopelessly
scanning the whole document up to its end.
* Fixed parsing duplicate Element declarations. The content models of
subsequent declarations are now discarded as they should - not
appended to the existing model.
* Fixed parsing duplicate Attlist declarations. In addition to dropping
the attribute declaration itself, do not modify the corresponding
element declaration and suppress 'Duplicate ID attribute' and
'Duplicate NOTATION attribute' validation errors.
* Fixed error position in cases when attribute value lacks the closing
quote.
* Some refactoring in order to reduce number of WideString vars and code
size (some SkipX and ExpectX merged into SkipX(required: Boolean)).
* TXMLCharSource.FLocation record replaced by single integer FLineNo
because LinePosition is always calculated.
* TXMLCharSource.FCursor replaced by local var.
* TXMLReader.NameIs changed to a more general BufEquals(), it eliminates
TXMLReader.GetString and some WideString variables.
tests/xmlts.pp:
* Ignored tests do not change suite conformance state.
tests/testgen.pp
* Added a forgotten semicolon.
git-svn-id: trunk@11869 -
* testgen.pp - an utility to convert w3.org tests from XML format
into fpcunit-compatible Pascal source. The official testsuite uses
xslt for conversion, but, since there is no xslt for Pascal, and no
xslt support in FCL yet, I wrote an utility.
* api.xml - API 'database', needed by testgen.
* domunit.pp - an fpcunit extension, provides DOM-specific runtime
support.
* README_DOM - provides some instructions about putting it all together.
git-svn-id: trunk@11390 -
* excludes #$FFFE and #$FFFF from allowed XML 1.1 name chars, so
IsXmlName result is correct when its argument comes not from the
parser.
xmlread.pp:
+ Two new parsing options, Namespaces and ResolveExternals (not
functional yet but needed to proceed).
* Fixed checking of WFC [28a], forces fatal error as soon as possible
and prevents parsing of further (potentially malicious) data.
Hopefully now it is truly compliant to the specs and not just
satisfies the tests.
* In entity value literals, nesting is checked by entity, not by the
input source (consistent to other places).
- Saving FCursor around attribute default value isn't necessary because
FCursor is always nil while parsing the DTD.
* TList's changed to more lightweight TFPList's.
* Changed once more (probably the last time) recognizing the standalone
percent sign in parameter entity declarations. Rationale is that
FCurChar is no more out of sync with FSource.FBuf^, and therefore may
be removed.
tests/xmlts.pp and tests/README:
+ Added support for the latest XML test suite (by skipping tests
targeted for the upcoming fifth edition of XML specs).
+ 'Namespaces' option is passed to the parser.
* README updated with the latest testsuite URL.
git-svn-id: trunk@11303 -
fcl-xml/src/dom.pp: resolved a number of Level 1 conformance issues:
* Node.Normalize always deletes empty text nodes
* Node.Normalize is recursive into Attributes
* Node.InsertBefore corrected exception code in case when RefChild is
not one of node's children
+ Node.InsertBefore added missing check for possible cycle in tree
+ Node.AppendChild and Node.InsertBefore added checking type of NewChild
+ CloneNode enabled for Fragment and Entity
- CloneNode deleted for DocumentType (w3 specs directly prohibit cloning
it between documents, and cloning within one document is claimed
'implementation specific' - but makes no sense).
+ Node.ImportNode is now working
* Uncommented Level 2 node properties (NamespaceURI, localName and
Prefix), this caused a name clash and a lot of function argument
renames.
fcl-xml/src/xmlutils.pp:
+ overloaded IsXmlName() that accepts PWideChars
fcl-xml/src/xmlconf.pp
* Applied a fix similar to xmlcfg.pp for Mantis #10554
fcl-xml/src/xmlread.pp:
* Major: Got errors reported at correct locations for all 1600+ negative
tests. Easy to say, but it required modifying almost every second
line of code.
* TContentParticle references an existing element definition instead of
storing its own name (this allows content model matching without
string comparisons).
* Resorted to old-style 'object' for TElementValidator and to plain
procedures for decoders (allows to drop almost all related memory
management).
* Moved parameter entity detection from char to token level, this
simplifies things a bit.
+ Added second level of buffering to input source (a step towards
supporting arbitrary encodings).
* The main parsing loop contains no implicit exception frames now.
fcl-xml/src/xmlwrite.pp
* Replaced the stupid indenting algorithm with a simple rule: "Do not
write indents adjacent to text nodes". Now it does not make a mess
out of the documents which were parsed with PreserveWhitespace=True.
* Use specialized node properties instead of generic ones, this
eliminates WideString copies and results in almost 2x performance
boost in Windows.
* Even more performance:
* Write line endings together with indents -> twice less calls.
* Increase slack in buffer and write strings with known length (i.e.
most of markup) without overflow checking.
fcl-xml/tests/xmlts.pp:
* Use parser options instead of dedicated procedure to 'canonicalize'
documents, the parser has become mature enough to do that.
* Fatal error in non-valid category is a test failure, as well as
validation error alone in not-wellformed category.
fcl-xml/src/README
* Brought a bit up to date
fcl-xml/tests/README
+ Added testsuite errata/issues
git-svn-id: trunk@10314 -
xmlread.pp:
* As a step towards SAX-based validation, element content validator is
rewritten from scratch, so it now accepts child elements one by
one. This also enables reporting location of validation errors (however,
most locations aren't reported correctly yet).
* More straightforward handling of comments and PIs in internal subset.
* Attribute text is handled separately from element text.
* Unified handling of fatal and validation errors.
xmlutils.pp:
* Removed auto widechar->char conversions. These should have been a part
of fix for #9528, but were not noticed at that moment.
dom.pp:
* Reworked 'ugly workarounds' in node removal code.
+ Element nodes remove themselves from document list of IDs, so no invalid pointers are left around.
xmlts.pp:
* Corrected validation diagnostics (display the first message and ingore subsequent ones).
* Validation error alone in a not-well-formed case is a test failure.
git-svn-id: trunk@8896 -