Commit Graph

468 Commits

Author SHA1 Message Date
joost
092892ee82 * Replaced 5 StringReplaces with one StringsReplace
git-svn-id: trunk@17755 -
2011-06-14 19:23:05 +00:00
michael
10124c6f1f * Applied and tested patch by August Klein for bug #19351
git-svn-id: trunk@17721 -
2011-06-11 20:39:56 +00:00
michael
8f49adf3c8 * Patch from Ido Kanner to add HTMLEncode and HTMLDecode
git-svn-id: trunk@17718 -
2011-06-11 11:54:01 +00:00
michael
dec9a74507 * Marked TXMLConfig component as deprecated as well
git-svn-id: trunk@17357 -
2011-04-21 11:28:20 +00:00
michael
baf0ed35f3 * Patch from Inoussa to fix AV in certain cases
git-svn-id: trunk@17184 -
2011-03-26 18:54:44 +00:00
sergei
b7e26ed986 * sax_html.pp, ignore markup in STYLE and SCRIPT elements, Mantis #18826
git-svn-id: trunk@17003 -
2011-02-26 16:59:57 +00:00
sergei
884ec3abb3 * Cleanup ParseContent()
- XMLVersion property has been made available in TDOMDocument, removed inheritance check.
* Improved parsing the content model a bit
* Cleanup comments

git-svn-id: trunk@16987 -
2011-02-23 15:55:18 +00:00
sergei
e46c51e1bf * xmlread.pp: split handling of node and validation stacks. Validation stack is now maintained only in validation mode.
git-svn-id: trunk@16973 -
2011-02-22 13:14:31 +00:00
sergei
9ca12c0377 * xmlread.pp, remove FCursorStack and resort back to a single cursor node. But this time it is simply a local variable.
git-svn-id: trunk@16962 -
2011-02-21 16:11:38 +00:00
sergei
8ed16bb3ab * xmlread.pp, continue separating validation checks from the rest of code.
* Fixed reported locations for (hopefully) all namespace-related errors.

git-svn-id: trunk@16959 -
2011-02-21 01:50:49 +00:00
sergei
6a26b9cff3 * xmlread.pp, started separating validation checks from the rest of code.
git-svn-id: trunk@16946 -
2011-02-20 10:44:25 +00:00
sergei
6ccb769768 * xmlread.pp, the end of root element is now detected without involving DOM nodes.
git-svn-id: trunk@16942 -
2011-02-19 18:14:08 +00:00
sergei
58725cdedd * xmlread.pp, handle entity references in streaming style.
* Renamed TXMLCharSource.DTDSubsetType to Kind and changed its definition to reflect its purpose better.

git-svn-id: trunk@16932 -
2011-02-18 15:27:35 +00:00
sergei
3ea7f81f7e + fcl-xml, initial implementation of 'shared' DTD: it now consists of the model (classes TDTDModel, TEntityDecl, TNotationDecl), which is referenced by one or more TDOMDocumentType nodes.
git-svn-id: trunk@16914 -
2011-02-14 17:53:09 +00:00
sergei
f74c81aaeb * Don't mess with DOM stuff in TXMLReader.ParseXmlOrTextDecl. Instead, put declaration attributes into fields of FSource, and copy them to DOM objects later.
* Small improvement to CheckMaxChars.

git-svn-id: trunk@16913 -
2011-02-13 19:27:56 +00:00
sergei
c369605056 - dom.pp, removed TDOMNamedNodeMap.FNodeType field. This reduces memory requirements.
git-svn-id: trunk@16901 -
2011-02-09 18:30:16 +00:00
sergei
124487b9b2 * xmlcfg.pp, changed 'exit' to 'break' so that function won't exit without result assigned, Mantis #18589
git-svn-id: trunk@16803 -
2011-01-23 15:52:47 +00:00
sergei
caa786af56 * xmlread.pp, fixed condition that was causing an infinite loop in case when a malformed xml contained a null character within whitespace (to be exact, within parts processed by SkipS procedure). Great thanks to alexs75 for finding and supplying such xml file :)
git-svn-id: trunk@16766 -
2011-01-15 07:35:40 +00:00
michael
a8e4234aca * Patch from Graeme Geldenhuys to check for XMLDocument before typecasting it
git-svn-id: trunk@16443 -
2010-11-26 12:44:23 +00:00
sergei
b6c0948bb2 * unit xmlcfg.pp marked as deprecated.
git-svn-id: trunk@16307 -
2010-11-06 07:28:56 +00:00
sergei
b066395a2b * xmlread.pp: separated DOM-specific code into DoStartElement(); introduced FNameTable.
git-svn-id: trunk@16270 -
2010-10-31 02:23:42 +00:00
sergei
6cb9cdcc0d * xmlread.pp: maintain ID map at reader side, so it can do ID/IDREF validation without DOM.
* also don't allocate TForwardRef records for backward references, saves some ticks and bytes.

git-svn-id: trunk@16264 -
2010-10-30 15:18:44 +00:00
sergei
22f0692745 * xmlread.pp: since FIdRefs and FNotationRefs are never used at the same time (the former is used only while parsing root, the latter only while parsing DTD), simplify things a bit by replacing them with a single FForwardRefs.
git-svn-id: trunk@16259 -
2010-10-30 10:25:33 +00:00
sergei
b4aa087aad * xmlread.pp, implemented some c14n features: when parsing with Options.CanonicalForm=True, report all attributes as specified and drop superfluous namespace declaration attributes. Fixes level3/ls/canonicalform10 and level3/ls/canonicalform11.
git-svn-id: trunk@16253 -
2010-10-29 03:36:55 +00:00
sergei
d96e17da77 * xmlread.pp, fixed an issue introduced by combination of r16046 and r16172: assigning doc.DocumentType only after DTD has been completely parsed prevented inner reader from parsing 2nd+ level entity references in default attribute values. This went unnoticed because of no positive tests, and was detected only by examining negative test diagnostic, namely for not-wf-sa-079 and not-wf-sa-080.
git-svn-id: trunk@16248 -
2010-10-28 20:23:42 +00:00
sergei
4468f72f6c * xmlread.pp, added location information to TNodeData and got namespace-related errors reported at correct locations.
git-svn-id: trunk@16234 -
2010-10-27 22:42:01 +00:00
sergei
068d2fba37 * xmlread.pp, modified attribute parsing code to use DOM-independent data structures (third part)
* Namespace handling rewritten to fit into XMLReader's own data structures.
  * Remaining TDOMElementDef's replaced by TElementDecl.
  * Removed DoAttrText(), it has become obsolete.
  * Create objects that are needed for namespace processing only if actually doing namespace processing, reduces memory requirements.
  * Improved TAttributeDef construction.

git-svn-id: trunk@16230 -
2010-10-27 11:57:03 +00:00
sergei
4579226771 + New unit dtdmodel.pp containing DTD-related classes.
* TXMLNodeType, TNodeData and TAttrDataType moved to xmlutils.pp, so they can be shared between dom, xmlread and dtdmodel.
* TContentParticle class moved from xmlread.pp to dtdmodel.pp.
* dom.pp and xmlread.pp switched to DOM-independent representation of DTD element declarations and attribute defaults.

git-svn-id: trunk@16221 -
2010-10-25 15:26:29 +00:00
sergei
b585a6a1d0 * xmlread.pp, continued reducing DOM dependencies:
* TContentParticle only stores and compares a pointer to an element definition, a particular type of that definition doesn't matter - so change it to TObject.
  * In case of mixed content model, assign Type and Quantity to the root content particle, and process it the same way as element-only models.
  * While parsing, store entities in THashTable instead of TDOMNamedNodeMap.
  * Assign Prefix to element and attribute NodeData.

git-svn-id: trunk@16208 -
2010-10-23 18:20:49 +00:00
sergei
7e5ff8ca89 * xmlread.pp, modified attribute parsing code to use DOM-independent data structures (second part)
* ExpectAttValue() now builds both plain string value and first-level node chain.
  * Normalize() procedure moved to xmlutils.pp and made publicly available as BufNormalize.
  * ParseLiteral() cleaned of attribute-specific code; at this point it is clear it won't be used for parsing attributes.

git-svn-id: trunk@16186 -
2010-10-19 15:14:33 +00:00
sergei
e0d8556cae * xmlread.pp, modified attribute parsing code to use DOM-independent data structures (first part)
git-svn-id: trunk@16184 -
2010-10-18 20:46:35 +00:00
sergei
dfe1c0f228 xmlread.pp, r16175 caused a regression in level1/core/commentgetcomment; we should ignore comments in DTD, but not between DTD and root element. Fixed.
git-svn-id: trunk@16183 -
2010-10-18 20:19:32 +00:00
sergei
d248315ae4 * xmlread.pp, do some cleanup and get rid of FCursor field.
git-svn-id: trunk@16175 -
2010-10-16 22:56:55 +00:00
sergei
6cb12d0efc * xmlread.pp, doing progress with streaming API:
* correct handling of comments, PIs and (partially) DocumentType

git-svn-id: trunk@16172 -
2010-10-15 23:47:33 +00:00
sergei
d3bdf2577c * xmlread.pp, doing progress with streaming API:
+ state transitions needed to report start/end element events correctly
  + procedures for maintaining attribute data
  * excluded FCursor from attribute value parsing

git-svn-id: trunk@16161 -
2010-10-14 19:41:22 +00:00
mazen
b127fc154a * Fixed spell error revealed by lintian.
git-svn-id: trunk@16094 -
2010-10-06 20:33:57 +00:00
sergei
6cc206ac77 * xmlread.pp: started implementing the streaming API, aka XmlTextReader from .net world.
git-svn-id: trunk@16079 -
2010-10-05 07:35:00 +00:00
sergei
1dc083438e * xmlread.pp, renamed all parameters and local vars named 'Name', 'Prefix', 'BaseUri' and 'Value', so it becomes possible to add properties with these names to TXMLReader without duplicate identifier errors.
git-svn-id: trunk@16078 -
2010-10-04 15:41:47 +00:00
sergei
594919cc70 * dom.pp, fixed TDOMText.SplitText() to use custom allocation, so newly created node won't leak if initial node has no parent .
git-svn-id: trunk@16072 -
2010-10-01 11:05:30 +00:00
sergei
fd892533c3 * xmlread.pp, a bit better separation of DOM-specific and DOM-independent code in ParseComment() and ParsePI().
git-svn-id: trunk@16070 -
2010-09-30 15:30:49 +00:00
sergei
5808fd23c9 * dom.pp, moved remaining TDOMAttr-specific code from TDOMNamedNodeMap to TAttributeMap.
git-svn-id: trunk@16066 -
2010-09-29 23:10:58 +00:00
Jonas Maebe
8b0301409a + i386/iphonesim target for the new iPhoneSimulator in Xcode 3.2.4 and
later: the same as i386/darwin, except
      a) uses the non-fragile Objective-C ABI/runtime
      b) does not require stubs for direct calls/jumps (not required for
         i386/darwin under 10.6 and later either, but still generated
         there for backwards compatibility)
      c) only the same packages are enabled as for ARM/Darwin
      d) MacOSAll is compiled specifically for the iPhoneSimulator SDK
    This target also defines the symbol "darwin" apart from the target
    name "iphonesim" for source code compatibility reasons.

git-svn-id: trunk@16065 -
2010-09-29 21:56:47 +00:00
sergei
03b06dc7a1 * dom.pp, moved default attribute handling code from TDOMNamedNodeMap to TAttributeMap.
git-svn-id: trunk@16060 -
2010-09-28 22:46:05 +00:00
sergei
27948a5f06 sax_xml.pp: cleanup:
- remove duplicated code from constructor
- use CreateXXXBuf to create DOM nodes, eliminates temporary string vars.

git-svn-id: trunk@16049 -
2010-09-26 19:54:20 +00:00
sergei
3648247faf XML reader, forgot to pass current settings to the nested reader (although it doesn't seem to change test suite behavior).
git-svn-id: trunk@16048 -
2010-09-26 19:50:37 +00:00
sergei
347267dfe6 XML reader:
* Parse entities by creating another instance of TXMLReader. This is much more straightforward than saving/restoring context of the existing reader.
* Fixed version setting logic so that ReadXMLFragment procedures are now suitable to read entities:
 accept streams conforming to extParsedEnt [78], correctly read fragments into documents having version=1.1.

git-svn-id: trunk@16046 -
2010-09-26 04:50:55 +00:00
sergei
1d3a1e6691 * dom.pp, removed TDOMAttr.FOwnerElement field, storing owner element in FParentNode. This reduces memory requirements.
git-svn-id: trunk@16014 -
2010-09-19 16:46:35 +00:00
sergei
2786259d77 dom.pp:
* 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 -
2010-09-19 14:11:20 +00:00
sergei
3bef71aaf9 * xmlread.pp, removed FRecognizePE field. Its functionality is replaced by checking other fields.
git-svn-id: trunk@15984 -
2010-09-14 12:53:55 +00:00
sergei
cc82844a9d * xmlread.pp: refactoring, no function chages:
* Renamed ParseElement to ParseStartTag to reflect its actual functionality
  * Changed ParseQuantity into function returning a enumeration type
  * Simplified TXMLDecodingSource.NewLine
  * Changed the main loop (ParseContent) so that multiple calls to DoText() are replaced by a single call.
  - Removed "if FCDSectinsAsText" branch in DoCDSect. It is obsolete since this case is handled in ParseContent.

git-svn-id: trunk@15975 -
2010-09-13 16:07:50 +00:00
sergei
06c1413fb0 * xmlread.pp, a misplaced assignment could cause a #13 character to pass non-normalized to #10 if it was the last character in input stream.
git-svn-id: trunk@15974 -
2010-09-13 07:07:53 +00:00
sergei
320f67eab2 xmlwrite.pp, htmwrite.pp: replaced inheritance by composition. TxxxWriter always writes to a TStream (or its descendant), and for text files we use a simple TStream-compatible wrapper.
git-svn-id: trunk@15755 -
2010-08-08 22:25:37 +00:00
sergei
1c7c97dc93 sax_xml.pp:
* Applied counterpart of sax_html.pp r15564, eliminating redundant wide-to-ansi conversions;
* AStart parameter of IgnorableWhitespace event should be zero, not 1;
* XML is case-sensitive, removed calls to lowercase();
* Accumulate token characters in FRawTokenText, then convert it all at once to SAXString. Without it, handling multi-byte encodings like UTF-8 was impossible, because it was converting by individual bytes which always resulted in errors. Provides a partial fix for Mantis #16732. Also provides a single location to insert a proper decoding procedure.

git-svn-id: trunk@15738 -
2010-08-08 05:13:45 +00:00
sergei
f138637678 xmlread.pp, moved decoder procedures to xmlutils.pp, so they can be reused by other code.
git-svn-id: trunk@15737 -
2010-08-08 03:27:31 +00:00
sergei
118f1d645b xmlread.pp:
- removed an unused field FDocNotValid
- optimized away a variable in ParseEndTag().

git-svn-id: trunk@15736 -
2010-08-08 02:47:04 +00:00
sergei
f39e793448 * Moved TWideCharBuf and associated functions from xmlread.pp to xmlutils.pp, so this stuff can be reused by other code.
git-svn-id: trunk@15718 -
2010-08-06 08:00:45 +00:00
sergei
e1eec8c687 - xmlread.pp, removed redundant 'var' modifiers from TStream arguments of less common used functions. This should have been done a long ago, as part of r11788.
git-svn-id: trunk@15717 -
2010-08-06 07:44:51 +00:00
sergei
1876fb1c74 XPath: now when predicate filtering is no longer dependent on axis, it becomes possible to use the same code for TStep and TXPathFilterNode. Inherited TStep from TXPathFilterNode, removed duplicating code.
git-svn-id: trunk@15654 -
2010-07-28 15:25:19 +00:00
sergei
ae7aef0861 XPath: reworked step processing:
* For ancestor and ancestor-or-self axes, added checks for attribute nodes similar to parent axis.
* For reverse axes, collect and filter nodes in 'natural' (i.e. reversed) order, and only then reverse order while adding to result node set. This is much simpler to implement.
* Fixed memory leak (not destroying TXPathFilterNode.FExpr)

git-svn-id: trunk@15652 -
2010-07-28 14:25:08 +00:00
sergei
22038d7db6 + XPath test suite, implemented possibility to use a specified context node instead of fixed root element.
* enabled expressions which start with a FilterNode.
+ added a test for ancestor:: axis of attribute.

git-svn-id: trunk@15650 -
2010-07-28 12:24:27 +00:00
sergei
c902b96673 * XPath, change parsing of function call so that function arguments are parsed before creating the function node. This way function nodes can validate their arguments at creation time.
* also changed function argument container type from TFPList to dynamic array.

git-svn-id: trunk@15641 -
2010-07-26 19:30:26 +00:00
sergei
5352b78c4a * XPath, fixed parsing of 'prefix:*' node tests:
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 -
2010-07-26 16:35:35 +00:00
sergei
0f5795baaf XPath, use a perfect hash to recognize all possible keywords.
git-svn-id: trunk@15638 -
2010-07-26 13:49:46 +00:00
sergei
83711ff972 XPath improvements:
- Deleted TXPathLocationPathNode, it was too much overhead to store a single bit of information. The path root (if any) is now represented by TStep node with Axis=axisRoot.
* Changed TStep linkage from 'right' to 'left', this is consistent with the way of parsing  expressions and considerably simplifies evaluation.
* Fixed ParsePathExpr procedure so it no longer accepts empty/truncated expressions.

git-svn-id: trunk@15632 -
2010-07-24 23:15:35 +00:00
sergei
d44a1603db * TXPathScanner.ParseStep split into two functions in order to reduce complexity and improve readability.
* Also modified it so the data is accumulated in local vars, and resulting TStep objects are created only after the parsing is successfully complete.
* TXPathScanner.ParsePrimaryExpr: eliminated variable.

git-svn-id: trunk@15628 -
2010-07-24 03:21:40 +00:00
sergei
b4b83a7edb * HTML reader, attempt recovery from misplaced '<' characters (another part of Mantis #16916).
git-svn-id: trunk@15574 -
2010-07-15 04:54:14 +00:00
sergei
1a50f3ed26 * The fix in r15551 was not entirely correct. Must handle the case when string ends with a single whitespace.
git-svn-id: trunk@15570 -
2010-07-14 14:35:13 +00:00
sergei
7e2f713d09 * HTML parser: in case of malformed input, do not create attributes with invalid names (Mantis #16916).
* Along the way, eliminated one layer of useless converting strings from wide to ansi and back.

git-svn-id: trunk@15564 -
2010-07-14 13:54:09 +00:00
sergei
83238862f7 * The tag name may be followed by any whitespace char, not only #32 (Mantis #16906)
git-svn-id: trunk@15551 -
2010-07-11 13:21:08 +00:00
sergei
ead5707179 + Enumeration type for XML version
+ 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 -
2010-06-15 19:36:22 +00:00
sergei
8f29def76e * xmlread.pp: when IgnoreComments=True, merge together text nodes that precede and follow the skipped comment. With this fix, the reader finally produces normalized documents in all modes, so remove the corresponding cheat from testing program (xmlts.pp).
git-svn-id: trunk@15442 -
2010-06-15 16:13:42 +00:00
sergei
3bb9bfd2b8 * XPath, fixed parent axis of attribute nodes: it must consist of the owner element of an attribute.
+ Tests

git-svn-id: trunk@15439 -
2010-06-14 21:15:53 +00:00
sergei
1ed130e2e1 * Fixed XPath functions name() and local-name(), which should behave different from DOM properties of the same names. name() is empty for text, comment and document nodes. local-name() is the same as name() for non-prefixed attributes and processing instructions.
+ Another dozen of tests.

git-svn-id: trunk@15438 -
2010-06-14 17:21:35 +00:00
sergei
73bafe0444 + Implement TSAXReader.Abort method, which can be used to end the parsing prematurely (Mantis #16703)
git-svn-id: trunk@15414 -
2010-06-12 16:51:10 +00:00
joost
7fea1915e4 * fpmake.pp updates
git-svn-id: trunk@15268 -
2010-05-13 18:15:31 +00:00
sergei
112a288442 xmlread.pp, TXMLFileSource.FetchData, don't lose the data that remains in the input buffer. Fixes Mantis #15776.
git-svn-id: trunk@14919 -
2010-02-15 19:40:26 +00:00
sergei
a24b84c11b * Fixed CDATA section splitting which got broken due to excessive optimization in r14194.
git-svn-id: trunk@14648 -
2010-01-14 21:38:22 +00:00
sergei
5dee45a6a3 * A forgotten part of r13824: the condition in assertion must be the same as the condition of calling TNodePool.AddExtent.
git-svn-id: trunk@14644 -
2010-01-14 16:23:54 +00:00
pierre
55cffbef12 * Update Makefiles
git-svn-id: trunk@14385 -
2009-12-10 08:36:52 +00:00
sergei
14d42da206 * dom.pp: clean up
git-svn-id: trunk@14362 -
2009-12-08 09:09:23 +00:00
sergei
c8efa67ac7 * xmlread.pp, added a flag to force input stack unwinding upon reader destruction.
Without this, certain (malformed) documents (e.g. eduni/xml-1.1/005.xml) were causing
  InputSource leaks.

  Note: these leaks are a side effect from recent changes to entity processing and are not
  observed with older versions.

git-svn-id: trunk@14361 -
2009-12-08 08:10:35 +00:00
sergei
a7d1856620 * Removed null-termination in TXMLStreamInputSource.FetchData(): it isn't necessary and is causing unaligned access errors with ARM CPUs.
git-svn-id: trunk@14360 -
2009-12-08 05:20:44 +00:00
sergei
255c14fc4d * TDOMElement.RemoveAttributeNode() was not resetting OwnerElement property of the removed attribute to nil, fixed and added a test case.
git-svn-id: trunk@14351 -
2009-12-07 16:16:10 +00:00
sergei
9eac0ee0a4 * xmlread.pp: In case of reference to an undefined parameter entity, produce a validation error and ignore further DTD declarations unless the document is standalone (compliance).
git-svn-id: trunk@14293 -
2009-12-01 09:12:28 +00:00
sergei
e45469b377 * xmlread.pp: move all entity recursion checks into one place (in ContextPush).
git-svn-id: trunk@14290 -
2009-11-30 16:15:53 +00:00
sergei
ad3e19de3d * Rewrote TXMLReader.ParseContent to eliminate the inner loop;
* Also modified TXMLReader.ParseContent so that it produces normalized text nodes, i.e. merges text nodes on entity boundaries (when Options.ExpandEntities=True, of course) and merges the text coming from CDATA sections when Options.CDSectionsAsText=True.

git-svn-id: trunk@14248 -
2009-11-21 21:59:16 +00:00
sergei
25a3cc09ef xmlread.pp: More on entity processing:
* General entities are now processed non-recursively;
* They are now re-parsed on each inclusion, enabling proper validation and ensuring SAX-compatible order of events. Also less dependent on DOM-specific calls like CloneNode.

git-svn-id: trunk@14232 -
2009-11-20 23:32:08 +00:00
sergei
968338c428 * Reverted removal of 'ISO8859-1' encoding because it is still used in fcl-registry.
git-svn-id: trunk@14209 -
2009-11-18 11:42:35 +00:00
sergei
4ec8f0c617 * Call StoreLocation once in SkipQuote, rather than every time after calling it.
- Removed recognition of 'ISO8859-1', as it was a workaround for incorrect fpdoc encodings.
- Removed with statement in ParseContent, it won't work if we handle entities non-recusively, because FSource will be changing.

git-svn-id: trunk@14207 -
2009-11-18 00:48:05 +00:00
sergei
73b7248597 * Replaced all literal parsing routines with a single ParseLiteral(). Due to entity handling issues, this isn't yet enabled for attributes, therefore the current code contains some amount of redundancy.
* Started refactoring of the entity processing.

git-svn-id: trunk@14202 -
2009-11-16 23:43:01 +00:00
sergei
0589b2a846 XML writer:
* Moved line ending processing from the encoder to a higher level; without this, implementing/using external encoders is very problematic.
+ Implemented line ending processing for c14n mode.

git-svn-id: trunk@14194 -
2009-11-15 23:04:02 +00:00
sergei
1a28ccb0be + More c14n conformance in the writer:
* dedicated procedure for writing the document node;
  * no indenting in c14n mode;
  * ignore Specified property of the attributes in c14n mode.

git-svn-id: trunk@14192 -
2009-11-15 21:14:39 +00:00
sergei
5c60f0e9e2 XML writer: split CDATA sections at the ']]>' sequence.
git-svn-id: trunk@14186 -
2009-11-15 16:35:13 +00:00
sergei
6a8064fc3f + Added TDOMNode_WithChildren.InternalAppend, and used it to build node tree when cloning nodes. This speeds up the scenario when cloneNode() and node lists are used together, because the document is no longer marked as modified at each call to cloneNode.
git-svn-id: trunk@14147 -
2009-11-11 20:33:03 +00:00
sergei
4c5505b71c - removed dependency on avl_tree, improves speed, thread safety and memory requirements.
git-svn-id: trunk@14145 -
2009-11-11 14:19:50 +00:00
sergei
461fde4ed0 xmlread.pp, tighten up checks while parsing the xml declaration:
* Hard limit of literal lengths: 3 on version, 30 on encoding name, 2 or 3 on standalone. Without this, a misplaced quote could cause excessive amount of processing, because input buffer is reloaded by small 3-char chunks at this time.
* Encoding validity is checked in-line, the very first illegal character aborts processing.

git-svn-id: trunk@13961 -
2009-10-26 21:23:24 +00:00
sergei
158afbb5b4 * Fixed bug in length calculation, causing any namespaced attributes with local part differing only in the last character (or consisting of a single character), to be erroneously reported as duplicate.
git-svn-id: trunk@13960 -
2009-10-26 19:17:54 +00:00
sergei
b1d0bfef75 * Fixed the order of checks during parsing the xml declaration, this provides more accurate diagnostic for tests dtd07, encoding07, ibm77n03.
* Delay switching to xml 1.1 rules until the declaration has been parsed, this ensures that NEL and LSEP chars in declaration are rejected (rmt-056, rmt-057).

git-svn-id: trunk@13922 -
2009-10-23 04:16:15 +00:00
sergei
06b5b65534 Straightening handling of base URI and SystemID:
- TXMLCharSource.PublicID removed, it is unused.
* Base URI of an entity is stored in FURI field of entity, and passed to ResolveEntity.
* When error happens while parsing an internal entity, report the URI where that entity was declared, not where it was included.

git-svn-id: trunk@13921 -
2009-10-22 23:41:24 +00:00
sergei
d44c6876cd xpath.pp:
* text() selector matches text and CDATA nodes, but not comments
* Names of processing instructions are now matched as they should.

git-svn-id: trunk@13915 -
2009-10-20 22:13:13 +00:00
sergei
0c50cfe10a + Initial implementation of property TDOMParseOptions.CanonicalForm. The only thing it does yet is ignoring the DTD.
* Fixed relevant tests.

git-svn-id: trunk@13914 -
2009-10-20 22:09:51 +00:00
sergei
edb79b62e0 * Changed TSpecialCharCallback from method into a regular procedure, this allows to drop all the {$ifdef fpc}@{$endif} ugliness.
* Also changed TSpecialCharCallback to take the string and the index, so it can process certain sequences, not only single chars.
* In canonical mode, CDATA sections are written as text.

git-svn-id: trunk@13906 -
2009-10-17 22:09:20 +00:00
sergei
d2fa20949a XML writer: write namespace declarations before attribites and optionally sort them as required by c14n.
git-svn-id: trunk@13894 -
2009-10-17 12:30:04 +00:00
sergei
df5dec2106 * TNSSupport.CheckAttribute added check for null nsURI, it should not emit prefixes for namespaceless attributes.
* Reformatted and fixed comments.

git-svn-id: trunk@13886 -
2009-10-17 11:02:01 +00:00
sergei
013fbb8566 Fixed memory leaks in tests.
git-svn-id: trunk@13878 -
2009-10-16 22:50:46 +00:00
sergei
f68faa154d xmlread.pp: now uses TNSSupport class from xmlutils unit instead of its own copy of the same code.
git-svn-id: trunk@13861 -
2009-10-15 22:11:13 +00:00
sergei
f387d7cb2d * Only EXMLReadError is expected to be thrown from a negative test, any other exception is unexpected and should render the test as failed.
git-svn-id: trunk@13860 -
2009-10-15 21:27:31 +00:00
sergei
b48a0060b8 xmlread.pp, refactoring of literal handling:
* separate procedure SkipQuote, reused by SkipQuotedLiteral and ExpectAttValue;
* inlined SkipPubidLiteral to the (only) place where it is called.

git-svn-id: trunk@13858 -
2009-10-14 22:12:27 +00:00
sergei
ea85a7ec11 xmlwrite.pp: c14n compliance: write whitespace after PI name only if its data is not empty
git-svn-id: trunk@13856 -
2009-10-13 21:50:07 +00:00
sergei
a283bc4f46 xpath.pp:
* 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 -
2009-10-11 15:04:33 +00:00
sergei
7e731c78b6 xpath.pp: cleaned up and simplified TXPathScanner.GetToken()
git-svn-id: trunk@13842 -
2009-10-10 23:57:39 +00:00
sergei
3f5ce0d228 xpath.pp: Fixed runtime range and overflow checks, at least those which could be detected with existing test suite.
git-svn-id: trunk@13827 -
2009-10-09 17:47:53 +00:00
sergei
d156a08593 * Hunted down another node pool bug, thanks to Vincent Snijders and mighty valgrind. Due to wrong condition, the last block of extent wasn't used to put an object there, but later a cleanup attempt at that address was attempted.
git-svn-id: trunk@13824 -
2009-10-09 15:37:15 +00:00
sergei
8798a9d558 xmlread.pp:
* Report unclosed Ignore section as soon as it is detected, improves error messages and simplifies the code.
* Since SkipUntilSeq is only ever called with 1 or 2 delimiter chars, support just that rather than arbitrary-length array. Simplifies code.

git-svn-id: trunk@13818 -
2009-10-08 14:48:34 +00:00
sergei
dbf48c0535 * Fixed (runtime) overflows and range checks, so the package runs after compiling with OPT="-Criot -gtl". That Delphi compatibility patch is starting to cause more trouble than benefit...
git-svn-id: trunk@13817 -
2009-10-08 00:46:27 +00:00
sergei
2a924d0335 * For some reason, any assignment of NaN cannot be compiled with overflow checking, issue #14748.
git-svn-id: trunk@13816 -
2009-10-07 21:27:11 +00:00
sergei
4d2e6bac7f * TDOMDocument now checks its children and allows only a single Element/DocType child. This fixes about 8 test cases at Level 3.
+ Initial moves to implement TDOMNode.BaseURI (not yet functional)

git-svn-id: trunk@13809 -
2009-10-06 11:03:25 +00:00
sergei
0c41473f7b Two more DOM Level 3 functions + tests for them:
+ TDOMNode.lookupPrefix()
+ TDOMNode.isDefaultNamespaceURI()

git-svn-id: trunk@13800 -
2009-10-03 23:35:20 +00:00
sergei
78b41cd8f6 + XML writer now performs the namespace normalization.
git-svn-id: trunk@13789 -
2009-10-01 19:29:13 +00:00
sergei
eb18aa8831 + 3 more tests for verifying the namespace fixup
git-svn-id: trunk@13788 -
2009-10-01 19:14:36 +00:00
sergei
d2c3ab0730 * r13729 was broken due to missing typecast, shame on me. Fixed.
git-svn-id: trunk@13787 -
2009-10-01 19:11:47 +00:00
Jonas Maebe
2db72437e8 * fixed range check errors
git-svn-id: trunk@13736 -
2009-09-18 10:34:06 +00:00
sergei
fc34dc84ff domunit.pp:
+ 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 -
2009-09-17 09:58:15 +00:00
sergei
425170167d * Base units of the package now can be compiled also with Delphi, patch from Dariusz Mazur (with some modifications).
git-svn-id: trunk@13627 -
2009-08-30 21:01:08 +00:00
sergei
e9e6439345 * dom.pp: fixed one possible reason of crashing in Delphi 2009
* xmlutils.pp: clean up

git-svn-id: trunk@13604 -
2009-08-29 18:11:08 +00:00
michael
f853ac4c63 * Undid previous patch, because not all compiles
git-svn-id: trunk@13603 -
2009-08-27 20:10:54 +00:00
michael
612d58c80f * Patch from Dariusz Mazur to fix compilation with Delphi
git-svn-id: trunk@13602 -
2009-08-27 18:40:17 +00:00
sergei
a4c60f81a0 Fixed buffer reloading logic which happened to crash on x64 when reading DTD with unterminated ignore section.
git-svn-id: trunk@13549 -
2009-08-17 15:57:31 +00:00
sergei
d6244f680a * InstanceSize must be rounded up to sizeof(Pointer) everywhere, fixes #14348
git-svn-id: trunk@13548 -
2009-08-17 13:41:02 +00:00
Jonas Maebe
847354fe10 * Makefiles version 2.5.1
git-svn-id: trunk@13533 -
2009-08-13 21:21:28 +00:00
sergei
f748a01baf * Once the #14143 is fixed, I may (and actually must) remove the related workarounds.
git-svn-id: trunk@13504 -
2009-08-09 05:42:53 +00:00
Jonas Maebe
e246cac3ac * regenerated using latest fpcmake
git-svn-id: trunk@13487 -
2009-08-02 18:40:14 +00:00
sergei
a9d9841eee * XPath: number-to-string conversion is now compliant to the specs (no scientific notation, decimal separator is a hardcoded period, correct output values for INF/NAN) + tests.
git-svn-id: trunk@13389 -
2009-07-15 09:56:48 +00:00
sergei
4545f311a7 * A huge initial patch for HTML DOM module, makes most of the properties/methods functional, although a lot more work is still required.
git-svn-id: trunk@13383 -
2009-07-11 13:07:24 +00:00
sergei
cc253cca5b SAX cleanup, part 1:
* dynamic -> virtual (does not change anything, in fact, because FPC handles these two keywords identically).
* Default implementations for GetFeature, GetProperty, SetFeature, SetProperty - removes warnings about abstract methods at build time.

git-svn-id: trunk@13382 -
2009-07-11 12:57:55 +00:00
sergei
d8a74620a5 + Added definitions for deprecated (in HTML 4.01) attributes. Deprecated elements are already there.
git-svn-id: trunk@13381 -
2009-07-11 12:53:31 +00:00
sergei
26366263f1 sax_xml.pp:
* Recognize only five predefined XML entities, not all the stuff defined for HTML.
* Recognize character refs in hex notation only using lowercase 'x'.

git-svn-id: trunk@13376 -
2009-07-09 23:12:16 +00:00
sergei
173a0647a3 Reworked entity reference handling in SAX parsers:
* htmldefs.pp - no more limited to Latin-1; uses binary search instead of linear.
* sax_html.pp - no longer emits SkippedEntity events; any reference is either resolved or handled as text.
* sax_xml.pp - in contrast to HTML, never handles entities as text (either resolved or passed to SkippedEntity).

git-svn-id: trunk@13368 -
2009-07-07 20:40:32 +00:00
sergei
e4e62b2ac0 * Removed argument to TXMLCharSource.NewLine, it is redundant.
* In case of decoding error, count line endings in the same way as during normal processing.
* Improved error diagnostics in ParseAttlistDecl().

git-svn-id: trunk@13359 -
2009-07-03 21:51:58 +00:00
sergei
fcd96805fa htmldefs.pp:
+ Define elements which may omit end-tag (except HTML, HEAD and BODY which may also omit the start-tag)
+ Define which elements may close other elements (modelled after libxml2).
* DIV may have #PCDATA content.

sax_html.pp:
* Improve the parser to report startElement/endElement events properly. Should resolve Mantis #14073 and related element hierarchy issues.

git-svn-id: trunk@13357 -
2009-07-02 23:13:44 +00:00
sergei
5f45dd409b SAX readers: never transition from scText to scWhitespace state, and don't reset token while transitioning from scWhitespace to scText. This ensures that only pure-whitespace chunks are ever reported via IgnorableWhitespace event, and that text nodes are not broken into words.
This provides a partial fix for Mantis #14073.

git-svn-id: trunk@13355 -
2009-07-01 22:00:22 +00:00
sergei
ccb730c051 *HTML writer: change charset in 'meta' tag (if any) to utf-8, because it is the encoding we actually write.
git-svn-id: trunk@13354 -
2009-07-01 16:02:46 +00:00
sergei
a8e6f79ef3 * SAX parsers: support hexadecimal notation in character references and return result in a SAXChar
instead of Char, provides a partial fix for #14074

git-svn-id: trunk@13351 -
2009-06-29 14:20:50 +00:00
Jonas Maebe
1f6ec379de * moved field definitions before method/property definitions (see mantis
#13971)

git-svn-id: trunk@13330 -
2009-06-27 11:27:31 +00:00
sergei
106a605e05 xpath.pp:
- 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 -
2009-06-24 19:16:33 +00:00
sergei
986dfd01fb xmlread.pp:
+ Character count checks for parameter entities, protects against entity expansion attacks using PE's.
+ Cache external PE's so they are only fetched once, considerably reduces traffic and CPU load in
  case of attack.
* Do not repeat attempts to read from input stream once the read operation has returned less bytes
  than requested.

git-svn-id: trunk@13321 -
2009-06-23 22:46:26 +00:00
sergei
09867a1f6e xmlread.pp:
+ New option TDOMParseOptions.DisallowDoctype - prohibits processing of the DTD (specs compliant,
  targeted for SOAP applications).
+ New option TDOMParseOptions.MaxChars - limits max document length, protects against entity
  expansion attacks and DoS by feeding in too long documents. Default value of 0 means no
  restrictions. Tested with internal and external general entities, TBD with parameter entities.
* Fixed calculation of URIs used to retrieve external entities, they should be evaluated at the
  point of entity declaration rather than at the point of resolving (which happens at the first
  inclusion). 
dom.pp:
* TDOMNode.SetReadOnly, calling Attributes was causing creation of TAttributeMap on every element.
  Fixed.

git-svn-id: trunk@13313 -
2009-06-22 19:57:11 +00:00
sergei
0a7e62ac04 - dropped remaining calls to GetChar (replaced with FSource.NextChar).
* simplified AddForwardRef, now it always uses FTokenStart as position.

git-svn-id: trunk@13304 -
2009-06-20 16:28:18 +00:00
sergei
dbd2759da9 + Implementation of TDOMDocument.DocumentURI and TDOMAttr.IsID + tests.
git-svn-id: trunk@13291 -
2009-06-18 21:34:07 +00:00
sergei
64966ccae1 * Refactored the main parsing loop, it is no longer recursive with respect to elements (still
recursive with respect to entities, however). This enables more useful backtrace in case of
  parsing errors, and makes more fun at profiling.

git-svn-id: trunk@13275 -
2009-06-14 18:00:26 +00:00
marco
1d5758b29d * Minor fixes to $ifdef writeln's I had lying around.
git-svn-id: trunk@13268 -
2009-06-12 21:09:20 +00:00
sergei
f31048dc01 * Flag undeclared elements with ContentType = ctUndeclared, it's much more self-documenting than the
mysterious HasElementDecl.

git-svn-id: trunk@13266 -
2009-06-12 20:20:14 +00:00
sergei
f31d31049e Improved XPath test suite and added some more tests.
git-svn-id: trunk@13260 -
2009-06-11 19:21:37 +00:00
sergei
44ebbec358 Minor fixes to the reader:
- Removed remaining assignments of TXMLFileInputSource.SystemID, as it is assigned in constructor.
- As attributes now remove themselves from owner upon destruction, removed the redundant check.
* ReadXMLFile, ReadDTDFile: Moved all assignments of Document to the 'finally' sections to avoid
  leaks if parsing error happens. This was already done in most frequently used overloaded
  ReadXMLFile, but wasn't noticed in other places.
* TXMLReader.CheckName was unable to detect a malformed local part of a QName if its prefix is
  well-formed and crosses the buffer boundary. Fixed.

git-svn-id: trunk@13259 -
2009-06-11 18:29:25 +00:00
sergei
a45049155e XPath parser improvements:
* Qualified names, 'NCName:*' and  variable references are handled as single tokens (no
  whitespace is allowed between parts).
* Function and variable names may have a prefix now.

git-svn-id: trunk@13256 -
2009-06-10 21:42:46 +00:00
sergei
538f82091a XPath improvements:
+ Utility function TXPathScanner.SkipToken, saves some amount of typing.
* Allow TXPathLocationPathNode to have FFirstStep = nil, and don't create a redundant
  initial step while parsing.

git-svn-id: trunk@13253 -
2009-06-09 22:52:16 +00:00
sergei
f0e6946688 XML/HTML writers, handle denormalized line-ending sequences (#13 and #13#10), fixes #13879.
git-svn-id: trunk@13247 -
2009-06-08 20:01:30 +00:00
sergei
26767125f0 * Refactored TXPathLocationPathNode.Evaluate(), split that awful 3-level nested procedure into
TStep.SelectNodes, TStep.ApplyPredicates and the remaining part.
* Since predicates contained in a location path are evaluated within separate contexts of their own,
  evaluation of the location path itself does not require a full context (only need context nodes).
  This simplifies things quite a bit.
+ Added support for evaluating filter expressions follwed by location path. Things like
  "id('foo')/bar" work now.

git-svn-id: trunk@13244 -
2009-06-06 18:51:50 +00:00
sergei
e66e35ac2c XPath: reducing memory load:
* Store predicates of TStep and TXPathFilterNode in dynarrays instead of TList, this way we allocate
  only as much memory as needed, and allocate anything only when predicates are actually present
  (that's minority of all cases).
* Eliminated intermediate TList in filtering step results.
* Remaining TList's replaced by TFPList's.
* Fixed ordering of nodes on preceding-sibling axis.

git-svn-id: trunk@13230 -
2009-06-03 09:09:53 +00:00
sergei
3327371e24 + Implemented DOM level 3 method TDOMNode.LookupNamespaceURI().
* Default attributes which have a colon in name now get a namespace assigned upon restoring. This
  fixes remaining level 2 testsuite failures.

git-svn-id: trunk@13229 -
2009-06-02 13:56:24 +00:00
sergei
32b98580fa + Namespace support in TDOMElementList, makes GetElementsByTagNameNS() operational.
+ Modified TDOMImplentation.HasFeature to return True for level 2 features.

Now the DOM Level 2 support is fairly complete (1 error and 1 failure still remain).

git-svn-id: trunk@13228 -
2009-06-01 21:19:36 +00:00
sergei
c5114c7423 * Modified TDOMNodeList. It now has a fixed BuildList procedure which iterates descendant nodes,
calling NodeFilter for each node. The NodeFilter return value determines whether the node will
  be added to the list, and whether node's children should be recursively iterated.
  This considerably simplifies creating TDOMNodeList descendants, as they no longer need to mess
  with the class internals (FRevision, FList, etc).

git-svn-id: trunk@13227 -
2009-06-01 20:55:18 +00:00
sergei
2cd0a1ad27 + Part of DOM level 2 namespace support (handling namespaced attributes)
* Cloning/importing attributes and elements preserves their namespaces
* Importing an element does not import non-specified attributes.
+ Separate, much faster, implementation for element cloning.

git-svn-id: trunk@13226 -
2009-06-01 19:43:34 +00:00
sergei
baa07b1a22 Bringing readme's up to date
git-svn-id: trunk@13216 -
2009-05-31 10:38:28 +00:00
sergei
466c41da12 * Added .txt extension to README_DOM (this one was missed while fixing Mantis #12358)
git-svn-id: trunk@13215 -
2009-05-31 09:14:37 +00:00
sergei
b631754754 + Processing of prefixed attributes and prefix bindings. This completes namespace support at
the XML reader side.

git-svn-id: trunk@13214 -
2009-05-31 08:18:06 +00:00
sergei
cf98a19e8e + Implementation of TDOMDocument.CreateAttributeNS and CreateElementsNS
+ Initial part of TDOMElement.SetAttributeNS
+ TDOMImplementation.CreateDocumentType checks validity of QualifiedName
* Use 'managed' memory allocation in TDOMEntity.CloneNode and TDOMNotation.CloneNode to avoid leaks
* TDOMDocument.RemoveID now using THashTable.RemoveData(), simplifies things

git-svn-id: trunk@13200 -
2009-05-26 22:14:21 +00:00
sergei
55e3c6be3a dom.pp: No more failures on level 1 testsuite... at last.
+ Implemented handling of default attributes:
  * creating an element also creates and attaches the default attributes;
  * removing an attribute restores it with default value, if there's one.
+ Attribute nodes remove themselves from the owner element upon destruction, making it possible
  to Free attributes manually.
* TDOMNamedNodeMap.SetNamedItem does not reset attribute OwnerElement if the argument node is already
  contained in the map (and whole operation is therefore is a no-op).

git-svn-id: trunk@13196 -
2009-05-25 20:28:40 +00:00
sergei
733d2c38d5 dom.pp: Customized memory management, fixes 17 test cases and all memory leaks in testsuite:
* Every node created by Document.CreateXXX method is now guaranteed to be destroyed with the
  document, whether it is part of the tree or not. Therefore, DOM methods which remove nodes
  from the tree (namely, TDOMNode.RemoveChild, TDOMNode.ReplaceChild,
  TDOMElement.SetAttributeNode and TDOMElement.SetAttributeNodeNS) no longer need to destroy
  their return value and are now conformant to the specs.
* Nodes are allocated in arrays of instances (emulates 'placement new operator' in C++ terms).
  Allocation and freeing are as fast as possible (just assigns a couple of pointers).
* Behaviour of nodes that are created by direct call to constructor is unchanged.

git-svn-id: trunk@13185 -
2009-05-21 23:07:32 +00:00
sergei
d3dd0d6aa0 dom.pp: Added node memory management code (pure addition, no functionality changes this time).
git-svn-id: trunk@13184 -
2009-05-21 20:45:16 +00:00
sergei
035fe43b72 Final strike for #13605:
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 -
2009-05-20 23:08:24 +00:00
sergei
17bbe72d08 * Moved TDOMAttrDef class from xmlread.pp to dom.pp (in order to implement default attribute handling at DOM level).
* Using regular CloneNode() method to create copies of TDOMAttrDef.

git-svn-id: trunk@13176 -
2009-05-18 22:03:37 +00:00
sergei
0a242ba49f dom.pp: Ignore node read-only property when its owning document is being destroyed (enables destroying nodes in arbitrary order).
git-svn-id: trunk@13175 -
2009-05-18 20:33:43 +00:00
sergei
6049600ccb DOM test suite enhancements:
* 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 -
2009-05-17 22:56:51 +00:00
sergei
66c0840bce * TDOMText.SplitText should check that its argument isn't readonly before doing anything else.
Since the procedure still raises NO_MODIFICATION_ERR later (while inserting new node to the parent),
the testsuite wasn't able to detect this bug, causing the old node to be modified and the new node to leak :/

git-svn-id: trunk@13144 -
2009-05-15 13:30:31 +00:00
sergei
54b475a68b dom.pp:
* 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 -
2009-05-14 21:00:29 +00:00
sergei
4eef2b87a1 dom.pp: Moved creation of all TDOMNodeList's to TDOMDocument (another part of #13605).
git-svn-id: trunk@13134 -
2009-05-12 19:46:42 +00:00
sergei
448b621ff4 xpath.pp: A slightly more efficient implementation of TXPathCompareNode.Evaluate().
git-svn-id: trunk@13130 -
2009-05-10 19:38:32 +00:00
sergei
7a478e64c2 xpath.pp: Honor axis direction when filtering step result with predicates. For reverse axes, ContextPosition is now relative to the last node of the set. The third argument of TXPathExprNode.EvalPredicate() is redundant and has been removed.
git-svn-id: trunk@13129 -
2009-05-10 19:32:22 +00:00
sergei
4cabfad02a xpath.pp: Fixed lexical analysis in ParseStep(), now conformant with paragraph 3.7 of the specs:
* Identifier is treated as AxisName only if it is followed by '::'
* Identifier is treated as NodeType only if it is followed by '('.

git-svn-id: trunk@13123 -
2009-05-09 20:27:29 +00:00
sergei
f3e64cf8ce xpath.pp: replaced TXPathScanner.SaveState/RestoreState by PeekToken().
git-svn-id: trunk@13120 -
2009-05-09 19:55:38 +00:00
sergei
d03e569ae9 Further XPath improvements:
+ Implemented [more or less] correct parsing of last two variations of PathExpr [19].
  (only parsing - evaluation still has to be done).

git-svn-id: trunk@13116 -
2009-05-08 21:30:55 +00:00
sergei
d839aada5b xpath refactoring:
* Split parsing location steps into a separate procedure, TXPathScanner.ParseStep();
* Changed some case statements to if's, in order to improve indentation and readability.

git-svn-id: trunk@13115 -
2009-05-08 07:42:55 +00:00
sergei
dceb9320f5 Cleanup of dom.pp:
- Removed TRefClass, memory of TDOMNodeList's must be managed in some other way (part of #13605).
- Removed unnecessary forward class declarations.

git-svn-id: trunk@13113 -
2009-05-07 18:13:14 +00:00
sergei
9fe4f59c5a Three XPath scanner fixes:
* #12 is not a whitespace char;
* '!' is not valid unless it is a part of '!=' token;
* Accept full XML 1.0 name character range as identifiers.

git-svn-id: trunk@13109 -
2009-05-07 06:51:41 +00:00
sergei
8c898e963a + Implements XPath function id() + test. Running the test is another story, however, because it requires parsing FilterExpr+'/'+RelativeLocationPath, which is currently not implemented.
git-svn-id: trunk@13106 -
2009-05-06 20:07:09 +00:00
sergei
e17ac308e0 Implementation of XPath function lang() + tests.
git-svn-id: trunk@13060 -
2009-04-29 17:52:39 +00:00
sergei
841625e3dd Refactoring, no functional changes
xmlread.pp:
* Moved assignment of TXMLFileInputSource.SystemID into TXMLInputFileSource.Create.
* Eliminated nested procedure in TXMLReader.ProcessDefaultAttributes, it was redundant since
  r12026.

xpath.pp:
* Moved predicate evaluation code, which is common for filter and step nodes, into
  TXPathExprNode.EvalPredicate().

git-svn-id: trunk@13056 -
2009-04-28 19:35:07 +00:00
sergei
efcccbf895 Test suite improvements, targeted to support the HTML suite:
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 -
2009-04-28 19:18:07 +00:00
sergei
e75bad33e4 Applied a fix similar to r13047:
* Handle empty tags by emitting a pair of StartElement/EndElement
  events. While this is optional in HTML parser, here in XML parser it is a requirement.

git-svn-id: trunk@13048 -
2009-04-26 18:11:03 +00:00
sergei
b9ad8e3755 * Handle xml/xhtml style empty tags by emitting a pair of StartElement/EndElement events with
correct tag name.

Slightly modified patch from Marco van de Voort, resolves #13409.

git-svn-id: trunk@13047 -
2009-04-26 17:56:21 +00:00
sergei
b02aededf8 More progress with XPath:
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 -
2009-04-26 16:06:15 +00:00
michael
f641281a7e * Patch from Sergei Gorelkin:
+ 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 -
2009-03-23 08:37:51 +00:00
michael
8cf5d9abf2 * Patch from Sergei Gorelkin
* TXPathUnionNode.Evaluate: fixed two crashes. The object returned by
    TXPathVariable.AsNodeSet is owned by that TXPathVariable and should
    not be explicitly destroyed. Also TXPathVariable should not be
    released if its AsNodeSet result will be used later.

  * TXPathLocationPathNode.Evaluate/EvaluateStep:

    - fixed crash in axisFollowing case branch (caused by wrong variable
      being used in the loop).
    - rewrote axisPreceding branch so it builds the result node list in
      correct (document) order.
    - Fixed predicate match condition that was always evaluating as True.

  * TXPathScanner.ParseLocationPath: modified so it never returns nil.
    This fixes crash in cases when '/' or '//' are used otherwise than
    the whole expression (e.g. 'string(/)').

  * Replaced manual searching in TList by calls to IndexOf() in two
    places.

git-svn-id: trunk@12934 -
2009-03-20 20:09:55 +00:00
michael
9662260088 * Patch from Sergei Gorelkin:
Fixes a bug in internal DTD subset processing, which was preventing
  tokens that cross input buffer boundary from being correctly added to
  DocType.InternalSubset (the first part of such tokens was dropped).

git-svn-id: trunk@12860 -
2009-03-06 10:32:49 +00:00
michael
478aefebd8 * Patch from Sergei Gorelkin:
* Fixed crash resulting out of changing TDOMDocument.OwnerDocument
    from Self to nil a while ago.
  * Refactored the TXPathScanner code so that it:
    a) does not use UngetToken.
    b) does not build CurTokenString by appending single characters.
    c) moved parsing code from nested procedures to regular TXPathScanner
       methods.
  + Implemented many (but not all yet) core library functions.
  + Support for scanning 'processing-instruction("name")' syntax.
  + Support for scanning 'foo:*' and 'foo:bar' node name tests.
  * NodeSets are always convertible to numbers and booleans.
  * String representation of an Element is its TextContent, not NodeName.
  * TXPathConstantNode must Release its value, not destroy it (enables
    correct result of expressions that consist of a single constant).
  * Some fixes in attempt to make math operations conformant to the specs.

git-svn-id: trunk@12855 -
2009-03-04 10:31:20 +00:00
Jonas Maebe
4bf254bc32 * added .txt extensions to all README, TODO and COPYING files
(mantis #12358)

git-svn-id: trunk@12825 -
2009-02-28 17:34:08 +00:00
michael
c44f0eb6dd * Patch from Sergei Gorelkin:
dom.pp:

  * Added a comment about TDOMDocument destruction order.
  * Changed declaration of standard namespaces from literals to typed
    consts. This makes package operational on arm-wince which has a flaw
    in WideString literal assignments (issue #13237).
    Even without that bug, the change allows to save some bytes in
    executable, because typed consts are only put there once, while
    literals are compiled in for every unit that uses them.

  htmwrite.pp:

* removed an unused variable

git-svn-id: trunk@12819 -
2009-02-28 11:50:19 +00:00
joost
a2f5f7400b * Replaces several direct references to FNSI.QName by the NodeName property, so
that descendent classes can override the NodeName properly
 * Fixed an AV when GetNodeName is called and there is no NodeName set
 * Removed the THtmlCustomElement.NodeName property and override the GetNodeName
   method instead. The hashtable of TDOMNode_NS is not used because
   THtmlCustomElement uses a faster lookupsystem for tag/node-names
 * Added a basic test for the htmlwriter unit

git-svn-id: trunk@12732 -
2009-02-09 21:43:09 +00:00
Jonas Maebe
b39cc14c47 * regenerated after patch to Makefile.fpc in r12636
git-svn-id: trunk@12656 -
2009-02-02 16:07:24 +00:00
florian
c127154efa o Haiku patches by Olivier Coursiere
+ add posix thread support
  * improve signal handling
  * synchronize haiku's baseunix unit with the unix one (maybe it will be possible to remove Haiku's one in a future patch, but i keep it for now)
  + add support for standard sockets
  * fix some functions import to use the right libraries under Haiku
  * fix packages compilation

git-svn-id: trunk@12636 -
2009-02-01 10:30:55 +00:00
michael
ee3ac64afb * Hopefully fixed argument size problem on 64-bit windows
git-svn-id: trunk@12601 -
2009-01-26 09:04:37 +00:00
michael
aecbef27b2 * Patch from Sergei Gorelkin:
* Changed the design of input decoders so they process data by chunks
    instead of char-by-char. It is much faster, and allows supporting
    external pluggable decoders.
  + Interface for external decoders.
  * ResolvePredefined() is rewritten so it doesn't call CompareMem five
    times do determine a single char.
  * ParseCharRef renamed to ParseRef, because it parses entity refs as
    well.
  * Added guard conditions to prevent integer overflows in ParseRef.
  * ContextPush(TXMLCharSource) merged into Initialize().

  xmliconv.pas is a new unit, containing an libiconv-based decoder. It depends on existing iconvenc package, and
  thus supports all platforms that are supported by iconvenc.

  xmliconv_windows.pas is the variation that allows to use libiconv functionality on Windows (It would require
  the iconv.dll to be distributed with the application, but since I haven't succeeded yet in writing a native
  Windows decoder, this is better than nothing).

git-svn-id: trunk@12582 -
2009-01-22 21:53:30 +00:00
michael
7666920852 * Patch from Sergei Gorelkin:
xmlread.pp:
  * Remove TXMLReader.FCurChar, by replacing it by FSource.FBuf^.
  * Aiming to support any input encoding, the parser has been refactored
    to consume UTF-16 produced by 'xml-unaware' decoder (i.e. with line
    endings unadjusted and possibly containing chars that are invalid for
    XML). The majority of parsing is now done in SkipUntil methods of
    TXMLCharSource and TXMLDecodingSource. This design also considerably
    increases performance because it processed chars in batches instead of
    one-by-one (the decoders still process chars one-by-one, but they are
    subject for soon replacement).
  * Signature of BufAppendChunk changed to take starting and ending
    addresses of the buffer instead of starting address and length.
  * More sophisticated parsing of end-tags, avoids calls to StoreLocation
    if possible (despite its trvial look, StoreLocation is quite expensive
    in CPU cycles).


  dom.pp:
  * Some progress with DOM level 2. Implemented namespaceURI, prefix,
    localName properties for Elements and Attributes. The namespace
    information occupies only 32 bits per node.
  * Implemented storing names of elements and attributes in a hash table.
    This considerably reduces amount of used memory because each unique
    string is stored only once. Reducing memory allocation count also
    improves parsing speed.
  * Using the hash table also allows to link DTD declarations directly to
    the element nodes, avoiding any lookup at all.

  dom_htmp.pp:
  * Merely fixes compilation after changes to the DOM.

git-svn-id: trunk@12318 -
2008-12-08 19:51:46 +00:00
peter
2916256b2c * change externalurl to homepageurl
git-svn-id: trunk@12170 -
2008-11-18 23:58:52 +00:00
michael
67f56b7adf * Patch from Sergei Gorelkin:
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 -
2008-11-04 18:33:05 +00:00
marco
054eeff8ee * FCL fpmake manifests
git-svn-id: trunk@11962 -
2008-10-23 21:09:14 +00:00
Jonas Maebe
0cad00fbdb - reverted r11751, 11755 and 11759 because
a) they should not be necessary and only hide the symptoms of a not
      understood bug on some platforms
   b) doing so breaks things on some other platforms

git-svn-id: trunk@11951 -
2008-10-23 14:22:00 +00:00
marco
1295c499c9 * More fpmake fixes. Exampledirs and includefiles mostly fixed for these.
gdbint moves two examples from src to exampledir + makefile fix.

git-svn-id: trunk@11949 -
2008-10-22 22:08:05 +00:00
marco
e5db5e4aa8 * regened makefiles to propagate makefile versions
git-svn-id: trunk@11947 -
2008-10-22 17:32:15 +00:00
marco
3591d54f24 * updated all makefile.fpc versions to 2.2.2 for fppkg compat.
git-svn-id: trunk@11945 -
2008-10-22 17:19:13 +00:00
michael
e632e754cf * Patch from Sergei Gorelkin
xmlutils.pp:
  + Added THashTable - a simple hashed container with WideString keys.

  dom.pp:
  * Use the hash table instead of a sorted list for storing document IDs.
  * Replaced all TLists by TFPList (which is smaller and faster).
  * Fixed TDOMElement.RemoveAttributeNode to throw NOT_FOUND_ERR when
    the requested node is not one of the element's attributes.
  + Added node read-only checks where required by the specs, this fixes
    about 50 DOM tests.

  xmlread.pp:

  * Got rid of TXMLCharSource.FReloadHook, the corresponding procedure may
    be called directly.
  * Used a separate buffer to store the entity value literals, this
    enables correct including of external PEs that have a text declaration
    at the beginning.
  * Some refactoring: ParseAttribute has been split into a separate
    procedure, ProcessTextAndRefs was merged into ParseContent.

git-svn-id: trunk@11942 -
2008-10-22 12:25:12 +00:00
peter
7b188a6a0e * reset version to latest release: 2.2.2-0
git-svn-id: trunk@11907 -
2008-10-17 18:36:45 +00:00
michael
213f8a41c7 * Large patch from Sergei Gorelkin:
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 -
2008-10-08 18:06:52 +00:00
joost
c4789a5ae4 * Removed unnessesary var-keyword in declaration of ReadXMLFile (Fixes compilation)
git-svn-id: trunk@11788 -
2008-09-15 08:17:35 +00:00
marco
e7c43e55c5 * more unaligned fixes for xmlread. Mantis 12137
git-svn-id: trunk@11759 -
2008-09-13 09:54:13 +00:00
florian
7c82bbcbcd * use unaligned instead some hacking :)
git-svn-id: trunk@11755 -
2008-09-13 08:42:35 +00:00
marco
0d9bf5addb * committed fix for unaligned access from id 12079
git-svn-id: trunk@11751 -
2008-09-12 16:59:56 +00:00
marco
622ace494e * fix from Michalis K. for nesting depth of XMLs (# 11957)
git-svn-id: trunk@11644 -
2008-08-24 08:23:02 +00:00
michael
797103884a * Patch from Sergei Gorelkin to handle unicode
git-svn-id: trunk@11637 -
2008-08-23 11:34:47 +00:00
michael
b3d983ce07 * Initial testsuite from Sergei Gorelkin
* 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 -
2008-07-17 14:57:31 +00:00
michael
42601356dd * Patch from Sergei Gorelkin: * Makes TDOMParser.ParseURI throw EXMLReadError when URI is not resolvable (consistent with the Parse method).
git-svn-id: trunk@11389 -
2008-07-17 14:55:07 +00:00
michael
d812fa0c92 * Patch from Sergei Gorelkin:
* 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 -
2008-07-01 19:14:56 +00:00
Jonas Maebe
9d8bee1887 * regenerated with changes in r11233
git-svn-id: trunk@11234 -
2008-06-15 15:52:25 +00:00
michael
fa1b9a1878 * Patch from Sergei Gorelkin to improve DOM compliance:
dom.pp:
* Document.OwnerDocument returns nil.
* Document.TextContent returns empty string and setting it does nothing.
* Fixed EntityReference, it now gets its children upon creation and is
  correctly imported between documents.
+ Node.IsSupported()
* DOM feature name comparison is done case-insensitive.
* Reworked Node.AppendChild/Node.InsertBefore. Duplicate functionality
  removed. Resolves remaining issues with hierarchy/ownership checks
  (except for Document nodes which is a different story altogether).
  The same code is now executed for nodes attached to a Fragment as
  well as for regular nodes.
+ Text.SplitText checks for valid ParentNode.

xmlread.pp:
+ Implemented TDOMParser.ParseWithContext (except the case of replacing
  the whole document)
* Fixed AV when calling ParseXXX methods with input source that could
  not be resolved.
* Completely ignore comments in external DTD subset, it fixes a couple
  of DOM tests and has no effect on XML testsuite.

git-svn-id: trunk@11217 -
2008-06-11 05:40:49 +00:00
giulio
14d4f02fa0 * fixed fpc_zipinstall for go32v2 and the like
* makefiles regenerated

git-svn-id: trunk@11180 -
2008-06-03 14:01:09 +00:00
Tomas Hajny
77581bedd1 * makefiles regenerated with newer fpcmake
git-svn-id: trunk@11107 -
2008-05-28 06:34:32 +00:00
Jonas Maebe
b6c43bad7d * regenerated for i386-Haiku and darwin cross compilation changes
git-svn-id: trunk@11073 -
2008-05-24 09:29:08 +00:00
micha
0b2f80a38b * regenerate Makefiles to get armeb-linux support globally (also arm-darwin, so it seems)
git-svn-id: trunk@10888 -
2008-05-05 18:46:55 +00:00
micha
b0838b13d7 * add armeb target to compiler/Makefiles
git-svn-id: trunk@10552 -
2008-03-24 17:48:11 +00:00
joost
eb34e7b96d * Added Meta, Link and Script methods to THTMLWriter
* Fixed typo Attrubute - Attribute

git-svn-id: trunk@10469 -
2008-03-09 20:00:53 +00:00
michael
77b38b6be5 * Patch from Sergei Gorelkin:
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 -
2008-02-13 10:31:09 +00:00
peter
1c065d8279 * updated
git-svn-id: trunk@10282 -
2008-02-10 19:20:10 +00:00
marco
d115a72549 * Related to #7902, sax_xml now compiled
git-svn-id: trunk@10222 -
2008-02-05 09:02:27 +00:00
peter
0e0fbee1cd * remove dependency on itself
git-svn-id: trunk@9920 -
2008-01-25 16:23:31 +00:00
peter
66b6f5d4f7 * fix netdb dependencies
git-svn-id: trunk@9919 -
2008-01-25 00:40:35 +00:00
peter
875168c56b * new fpmake.pp
git-svn-id: trunk@9911 -
2008-01-24 23:37:32 +00:00
peter
e338befa21 * mode objfpc added
* remove old fpmake

git-svn-id: trunk@9910 -
2008-01-24 23:35:30 +00:00
marco
db3eb67852 * fix for 10554
git-svn-id: trunk@9742 -
2008-01-13 19:31:54 +00:00
marco
523eee3920 * xpath memleak patch from #10573
git-svn-id: trunk@9666 -
2008-01-07 10:27:40 +00:00
michael
915aa94e2d * Implemented dummys for missing methods
git-svn-id: trunk@9411 -
2007-12-07 16:42:09 +00:00
Jonas Maebe
c9ce918485 * regenerated for darwin/x86_64
git-svn-id: trunk@9181 -
2007-11-10 18:37:19 +00:00
peter
a0984505b2 * regenerated to fix fpc detection on non-i386
git-svn-id: trunk@8991 -
2007-10-29 16:34:18 +00:00
peter
324b1732ab * regenerated to update dependencies
git-svn-id: trunk@8988 -
2007-10-29 09:07:18 +00:00
michael
4e6cd59d8c * Patch by Sergei Gorelkin:
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 -
2007-10-21 16:09:41 +00:00
joost
1cfdfe6c72 * Made THTMLWriter.StartElement and EndElement public instead of protected
git-svn-id: trunk@8571 -
2007-09-20 19:26:48 +00:00
michael
169b04a237 * Fixed issue #9528 with patch from Sergei Gorelkin
git-svn-id: trunk@8343 -
2007-08-31 13:25:47 +00:00
Jonas Maebe
cb744d37ff - reverted change for avoiding recompilation of units in subdirs,
it breaks other things

git-svn-id: trunk@8298 -
2007-08-22 08:16:10 +00:00
Jonas Maebe
30bc89cfe5 * fixed dependency checking for source files in subdirectories relative
to the makefile location + regenerated all Makefiles
  * hopefully fixed fpmkunit dependencies

git-svn-id: trunk@8297 -
2007-08-22 07:04:23 +00:00
joost
bb8ba21960 * THTML_Text can now produce text
git-svn-id: trunk@8029 -
2007-07-12 20:56:35 +00:00