Commit Graph

227 Commits

Author SHA1 Message Date
Davide Brunato 583d1eb14b Fix cast() to accept tuples for XPath constructors 2019-10-09 17:19:46 +02:00
Davide Brunato d11524f50b Add __getstate__() for XPath2Parser pickling
- An XPath2Parser drops schema bind on pickling, the bind has to
    be restored by the schema objects. This is necessary because
    when a schema is bound to a parser token classes are created
    for XSD atomic types constructors.
  - Add bind_parser() to AbstractSchemaProxy
  - Add is_schema_bound() to XPath2Parser
  - Add statimethod create_tokenizer to TDOP Parser
  - Rename Parser.build_tokenizer() to build()
2019-10-09 14:00:07 +02:00
Davide Brunato 9e2e5d45e3 Use boolean_value() for 'and' and 'or' operators 2019-10-07 18:04:04 +02:00
Davide Brunato ad41660f9e Fix typed selection
- Fix XPathToken.select_results() for element selection
  - Fix XPathContext.get_parent() for typed elements
2019-10-07 17:08:47 +02:00
Davide Brunato 9c4b942700 Split and rename test_helpers module
- Unify XPathToken unit tests into class XPathTokenTest
2019-10-07 08:34:21 +02:00
Davide Brunato 526e9baa9f Add schema matching by path 2019-10-05 20:47:32 +02:00
Davide Brunato 04f63f6b4d Add LRU cached resolvers to context class
- Add get_parent() and get_path() to XPathContext
2019-10-04 20:44:39 +02:00
Davide Brunato de6955b36c Update test requirements
- Now uses xmlschema~=1.0.14
  - Update fn:in-scope-prefixes()
  - Remove module xpath_helpers.py
2019-10-04 10:00:39 +02:00
Davide Brunato 22d9f4258d Add select_results() to XPathToken 2019-09-30 17:17:05 +02:00
Davide Brunato 4aeee2bb34 Fix data_value() in XPathToken 2019-09-30 15:54:12 +02:00
Davide Brunato 72a99dc39f Adapt XPathContext to typed iterations
renamed:    tests/test_context.py -> tests/test_xpath_context.py
2019-09-30 11:17:04 +02:00
Davide Brunato 3cd4c95272 Add typed nodes for XSD decoded values processing
- Added TypedAttribute and TypedElement nametuples
2019-09-28 09:15:17 +02:00
Davide Brunato c367bdfd95 Improve node sequence operators
- Add is_root class attribute to XPathToken
  - '(name)' token yield AttributeNode objects for non-root tokens
2019-09-27 18:31:02 +02:00
Davide Brunato 93c6521a23 Add iter_results() method to XPathContext 2019-09-27 18:15:41 +02:00
Davide Brunato 03d31a0598 Add duplicate() class method to TDOP Parser 2019-09-27 18:14:05 +02:00
Davide Brunato 77afa93a15 Add validate() to XSD type interface 2019-09-26 16:24:29 +02:00
Davide Brunato 8cc023d077 Add iter_preceding() to XPathContext 2019-09-24 16:17:51 +02:00
Davide Brunato 307d638f96 Fix count() function and '//', '/' binding power 2019-09-24 11:16:23 +02:00
Davide Brunato 18871936cb Fix datatypes, context and token classes
- Fix leap year calculation into AbstractDateTime
  - Fix _iter_context for yielding AttributeNode tuples
  - Fix '|' select method for attribute matching
  - Fix get_atomized_operand() for XSD decode of untyped data
2019-09-21 15:21:25 +02:00
Davide Brunato 23fc3542ca Fix 24-hour time for DateTime 2019-09-11 22:18:49 +02:00
Davide Brunato 52d3220f8d Fix typed selection for token '(name)'
- Check the type but yield the element
2019-09-11 06:42:57 +02:00
Davide Brunato 04258f5c43 Fix '//' operator and text() function
- '//' without a left token has to start from the document root,
    like an absolute path.
2019-09-09 07:16:00 +02:00
Davide Brunato 910b63603a Add tests for XPathToken helpers and datatypes 2019-08-30 08:16:38 +02:00
Davide Brunato d89b2ad987 Fix xs:dayTimeDuration ad xs:duration comparison 2019-08-28 23:21:23 +02:00
Davide Brunato 0e4f050abb Add hashing methods to XSD datatypes classes 2019-08-28 07:07:30 +02:00
Davide Brunato cf59d52ca9 Fix xs:language pattern and XPathToken.get_results() 2019-08-14 18:15:56 +02:00
Davide Brunato bc78682fe8 Extend fn:string() to schema nodes
- Removed node_string_value(), replaced entirely by the method
    string_value() of the class XPathToken.
2019-08-13 18:06:49 +02:00
Davide Brunato 116e43fc4a Add tests for helpers and schema proxy 2019-08-09 08:56:39 +02:00
Davide Brunato 852d50c087 Add get_operands() instance method to XPathToken class 2019-08-08 09:34:55 +02:00
Davide Brunato 5ae6d0f0ff Fix function conversion rules in XPathToken.get_argument()
- Added type proxy classes for XSD numeric and datetime data
  - Added tests for 'mod' operator token
2019-08-08 06:55:22 +02:00
Davide Brunato 9994139e17 Fix xs:decimal based datatypes validation and function converion rules 2019-08-05 17:51:33 +02:00
Davide Brunato f00732ede5 Fix XPath2Parser.parse() method
- In case of schema binding the static context evaluation uses
    the XPathToken.select() method because a context with a tree
    of nodes is provided.
2019-08-05 11:37:59 +02:00
Davide Brunato b5a0a87a3e Refactor xmlschema related tests
- XMLSchemaProxy will be moved to xmlschema package because
    it requires a specialized context class. Schema tests will
    be kept in elementpath to help integration and to test
    elementpath schema-related features.
2019-08-05 10:10:11 +02:00
Davide Brunato 3f50cfd962 Add __mod__ operator to UntypedAtomic class 2019-08-04 07:33:41 +02:00
Davide Brunato aeba3aab05 Split xpath_helpers module in two parts
- Datatype conversion helpers moved fo token class
  - Node helpers moved to a new module
  - Kept boolean_value() for backward compatibility
2019-08-03 22:53:37 +02:00
Davide Brunato ad96ad7e7e Add XSD special types (anyType, anySimpleType, anyAtomicType) 2019-08-03 12:35:52 +02:00
Davide Brunato 74db431c25 Add build section to tox.ini and add tests for schema proxy 2019-05-29 15:39:42 +02:00
Davide Brunato fea7c0d7b5 Add tests for XPathContext to increase coverage
- Removed circularity checks that not works with ElementTree and
    is not necessary for lxml.etree
2019-05-22 19:11:47 +02:00
Davide Brunato c97acb9eb8 Added a script for testing XPathContext class 2019-05-21 07:17:58 +02:00
Davide Brunato 1d23f5b13f Update to release v1.1.8
- Added coverage and flake8 to testing
  - Removed py34 from tox.ini
  - Added py38 with a limited testing
  - ElementPathMissingContextError renamed to MissingContextError
  - Added exceptions to API docs
2019-05-20 23:22:14 +02:00
Davide Brunato 46ac3a6a1c Raise err:XPST0081 for a prefix associated to no namespace 2019-05-20 13:56:02 +02:00
Davide Brunato 9bfdedc831 Raise a more specific error for wrong number of arguments
- Applied to functions and constructors
  - Raises a TypeError instead of a generic SyntaxError
  - Added tests for execptions in test_helpers.py
2019-05-20 11:08:49 +02:00
Davide Brunato cface8447b Fix issue #4
- Added a context manager method use_locale() to XPathToken class
  - Added an exception class ElementPathLocaleError
2019-05-19 16:24:19 +02:00
Davide Brunato 5d715f98fc Add coverage to testing
- Added .coveragerc
  - Added tests/test_helpers.py
  - Added coverage to develop requirements
  - Code cleaning for xpath_helpers.py
2019-05-17 07:35:41 +02:00
Davide Brunato 12f94db836 Update to release v1.1.7 and fix for max()/min() functions
- Fix fn:max() and fn:min() error in case of an empty sequence: now
    the error is intercepted and the functions return an empty list.
2019-04-25 16:18:34 +02:00
Davide Brunato 12b71ba5ee Fix spacing errors
- Added is_spaced() to TODP Parser base class
  - Remove '/' from next_is_path_step_token() methods
  - Increase release and update API documentation
2019-03-30 10:59:23 +01:00
Davide Brunato 66dcdf2f25 Update to release v1.1.6 2019-03-28 14:14:27 +01:00
Davide Brunato a0ca1eb135 Fixes for XSD datatypes
- Add '.' equivalent Unicode characters to QName pattern
  - Fix integers validators
2019-03-27 08:29:57 +01:00
Davide Brunato 75101d530a Change default year from 1900 to 2000
- 2000 is a leap year, that is needed by gMonthDay value '--02-29'
  - Start new release v1.1.6
2019-03-05 18:19:42 +01:00
Davide Brunato a1506e8334 Hotfix release v1.1.5
- Fix issue #3 splitting xs:gYear type, creating an unordered base
    type XPathGregorianYear and then deriving GregorianYear10 also from
    OrderedDateTime to implement comparison operators.
  - Rewritten in the same way the remaining gregorian types, inverting
    the bases (put XSD 1.0 only types as the base).
2019-02-23 22:25:14 +01:00