{"id":15009984,"url":"https://github.com/znc-sistemas/xpath_validator","last_synced_at":"2026-04-01T20:29:20.971Z","repository":{"id":57497936,"uuid":"189657736","full_name":"znc-sistemas/xpath_validator","owner":"znc-sistemas","description":"xpath_validator","archived":false,"fork":false,"pushed_at":"2019-08-29T19:36:20.000Z","size":46,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2026-03-15T08:07:35.371Z","etag":null,"topics":["expression","expression-evaluator","expression-language","expression-parser","expressionengine","python27","python3","validate","validation","validation-library","validators","xpath"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/znc-sistemas.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-05-31T20:59:10.000Z","updated_at":"2019-08-29T19:36:21.000Z","dependencies_parsed_at":"2022-08-28T16:11:20.556Z","dependency_job_id":null,"html_url":"https://github.com/znc-sistemas/xpath_validator","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/znc-sistemas/xpath_validator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/znc-sistemas%2Fxpath_validator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/znc-sistemas%2Fxpath_validator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/znc-sistemas%2Fxpath_validator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/znc-sistemas%2Fxpath_validator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/znc-sistemas","download_url":"https://codeload.github.com/znc-sistemas/xpath_validator/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/znc-sistemas%2Fxpath_validator/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31291638,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-01T13:12:26.723Z","status":"ssl_error","status_checked_at":"2026-04-01T13:12:25.102Z","response_time":53,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["expression","expression-evaluator","expression-language","expression-parser","expressionengine","python27","python3","validate","validation","validation-library","validators","xpath"],"created_at":"2024-09-24T19:29:22.234Z","updated_at":"2026-04-01T20:29:20.940Z","avatar_url":"https://github.com/znc-sistemas.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"xpath_validator \n===============\n\n.. image:: https://travis-ci.org/znc-sistemas/xpath_validator.svg?branch=master\n    :target: https://travis-ci.org/znc-sistemas/xpath_validator\n\n.. image:: https://coveralls.io/repos/github/znc-sistemas/xpath_validator/badge.svg?branch=master\n    :target: https://coveralls.io/github/znc-sistemas/xpath_validator?branch=master\n\n.. image:: https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square\n    :target: https://raw.githubusercontent.com/znc-sistemas/xpath_validator/master/LICENSE.txt\n    :alt: Package license\n\nValidate boolean expressions with XPath syntax\n\nvalidate('expression', 'value', 'context', 'returns_bool')\n\n- expression: string with the expression text\n- value: value that will be validated (it is replaced by the occurrences of '.' in the expression)\n- context: dictionary that will make substitutions in $ {name}\n- returns_bool: if true, automatically returns a boolean\n\nExamples\n--------\n\n.. code-block:: python\n    \n    \u003e\u003e\u003e validate('. \u003e= 1 and . \u003c= 100', 10)\n    True\n    \u003e\u003e\u003e validate('. \u003e= 1 and . \u003c= 100', 101)\n    False\n    \u003e\u003e\u003e validate('not(. \u003e= 1 and . \u003c= 100)', -10)\n    True\n    \u003e\u003e\u003e validate('ceiling(.) = 5', 4.3)\n    True\n    \u003e\u003e\u003e validate('floor(.) = 4', 4.7)\n    True\n    \u003e\u003e\u003e validate('floor(.) = 4', 4.2)\n    True\n    \u003e\u003e\u003e validate('int(.) = 4', 4.7)\n    True\n    \u003e\u003e\u003e validate('number(.) = 3.2', 3.2)\n    True\n    \u003e\u003e\u003e validate('choose(true(), 1, 2) = 1', None)\n    True\n    \u003e\u003e\u003e validate('choose(false(), 1, 2) = 2', None)\n    True\n    \u003e\u003e\u003e validate('contains(\"abc\", .)', \"b\")\n    True\n    \u003e\u003e\u003e validate('contains(\"abc\", .)', \"e\")\n    False\n    \u003e\u003e\u003e validate('number(string(.)) = 6', 6)\n    True\n    \u003e\u003e\u003e validate('string-length(.) = 15', \"632587415222360\")\n    True\n    \u003e\u003e\u003e validate('string_length(.) = 11', \"40258997853\")\n    True\n    \u003e\u003e\u003e validate('string_length(.) = 7', \"abacate\")\n    True\n    \u003e\u003e\u003e validate('5 \u003c .', 10)\n    True\n    \u003e\u003e\u003e validate('5 \u003e .', 10)\n    False\n    \u003e\u003e\u003e validate('5 != .', 5)\n    False\n    \u003e\u003e\u003e validate('5 != .', 10)\n    True\n    \u003e\u003e\u003e validate('5 + 5 = .', 10)\n    True\n    \u003e\u003e\u003e validate('5 - 51 = .', -46)\n    True\n    \u003e\u003e\u003e validate('true() or false()', None)\n    True\n    \u003e\u003e\u003e validate('false() or false()', None)\n    False\n    \u003e\u003e\u003e validate('(. div 5) = 2', 10)\n    True\n    \u003e\u003e\u003e validate('(. * 5) = 50', 10)\n    True\n    \u003e\u003e\u003e validate('(. div 5) \u003c .', 10)\n    True\n    \u003e\u003e\u003e validate('(. * 5) \u003e .', 10)\n    True\n    \u003e\u003e\u003e validate('(. mod 2) = 0', 10)\n    True\n    \u003e\u003e\u003e validate('(. mod 2) = 1', 11)\n    True\n    \u003e\u003e\u003e validate('(. mod 2) = 1', 10)\n    False\n    \u003e\u003e\u003e validate('(. mod 2) = 0', 11)\n    False\n    \u003e\u003e\u003e validate(\"int(format-date-time(., '%H')) = 19\", '2019-05-14T19:13:35.450686Z')\n    True\n    \u003e\u003e\u003e validate(\"int(format-date-time(., '%m')) = 5\", '2019-05-14T19:13:35.450686Z')\n    True\n    \u003e\u003e\u003e validate(\"int(format-date-time(., '%M')) = 13\", '2019-05-14T19:13:35.450686Z')\n    True\n    \u003e\u003e\u003e validate(\"int(format-date-time(., '%Y')) = 2019\", '2019-05-14T19:13:35.450686Z')\n    True\n    \u003e\u003e\u003e validate(\"int(format-date-time(., '%d')) = 14\", '2019-05-14T19:13:35.450686Z')\n    True\n    \u003e\u003e\u003e validate(\"format-date-time(., '%d/%m/%Y') = '14/05/2019'\", '2019-05-14T19:13:35.450686Z')\n    True\n    \u003e\u003e\u003e validate('. \u003e= ${min} and . \u003c= ${max}', 10, {\"max\": 100, \"min\": 10})\n    True\n    \u003e\u003e\u003e validate('. \u003e= ${min} and . \u003c= ${max}', 10, {\"max\": 100, \"min\": 20})\n    False\n    \u003e\u003e\u003e validate('${min} = \"\" and ${max} = \"\"', None, {\"max\": 100, \"min\": 20})\n    False\n    \u003e\u003e\u003e validate(\"substring-after('aa\u0026bb', ${sep}) = 'bb'\", \"\u0026\", {'sep': '\u0026'})\n    True\n    \u003e\u003e\u003e validate(\"substring-before('aa\u0026bb', ${sep}) = 'aa'\", \"\u0026\", {'sep': '\u0026'})\n    True\n    \u003e\u003e\u003e validate(\"normalize-space('    abacate ') = 'abacate'\", None)\n    True\n    \u003e\u003e\u003e validate(\"starts-with('abacate', 'ab')\", None)\n    True\n    \u003e\u003e\u003e validate(\"starts-with('abacate', 'ac')\", None)\n    False\n    \u003e\u003e\u003e validate(\"uuid()\", None, returns_bool=False)\n    '2327c8bc-ac46-4968-a73c-5f21f9e9b1ce'\n    \u003e\u003e\u003e validate('(. div -5)', 10, returns_bool=False)\n    -2.0\n    \u003e\u003e\u003e validate(\"selected('peixe abacate', .)\", 'peixe')\n    True\n    \u003e\u003e\u003e validate(\"selected('peixe abacate', 'peixe')\", None)\n    True\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fznc-sistemas%2Fxpath_validator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fznc-sistemas%2Fxpath_validator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fznc-sistemas%2Fxpath_validator/lists"}