Skip to content

Commit

Permalink
added jsonpath support
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgecastro05 committed Dec 23, 2021
1 parent c3484f5 commit b572d22
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 3 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ Where x belongs to release version

## Building the project (for developers)

### Install dependencies

python3 -m pip install --upgrade build
python -m build

build and install
Expand Down
Binary file removed dist/camel-xml2dsl-0.0.19.tar.gz
Binary file not shown.
Binary file added dist/camel-xml2dsl-0.0.20.tar.gz
Binary file not shown.
Binary file removed dist/camel_xml2dsl-0.0.19-py3-none-any.whl
Binary file not shown.
Binary file added dist/camel_xml2dsl-0.0.20-py3-none-any.whl
Binary file not shown.
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = camel-xml2dsl
version = 0.0.19
version = 0.0.20
author = Jorge Castro
author_email = jorgecastro05@hotmail.com
description = xml definition to dsl definition routes
Expand Down
5 changes: 4 additions & 1 deletion src/camel_xml2dsl.egg-info/PKG-INFO
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Metadata-Version: 2.1
Name: camel-xml2dsl
Version: 0.0.19
Version: 0.0.20
Summary: xml definition to dsl definition routes
Home-page: https://github.com/jorgecastro05/script-aro.git
Author: Jorge Castro
Expand Down Expand Up @@ -31,6 +31,9 @@ Where x belongs to release version

## Building the project (for developers)

### Install dependencies

python3 -m pip install --upgrade build
python -m build

build and install
Expand Down
13 changes: 12 additions & 1 deletion src/xml2dsl/xml2dsl.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,10 @@ def simple_def(self, node):
return simple_def

def constant_def(self, node):
return 'constant("' + node.text + '")'
if node.text is not None:
return 'constant("' + node.text + '")'
else:
return 'constant("")'

def groovy_def(self, node):
text = node.text.replace('"','\'')
Expand All @@ -197,6 +200,14 @@ def xpath_def(self, node):
xpath_def += '.saxon()'
return xpath_def


def jsonpath_def(self, node):
jsonpath_def = 'jsonpath("' + node.text + '")'
if 'resultType' in node.attrib:
jsonpath_def = 'jsonpath("' + node.text + '",' + \
node.attrib['resultType']+'.class)'
return jsonpath_def

def to_def(self, node):
if 'pattern' in node.attrib and 'InOnly' in node.attrib['pattern']:
return '\n.inOnly("' + self.componentOptions(node.attrib['uri']) + '")'
Expand Down

0 comments on commit b572d22

Please sign in to comment.