diff --git a/README.md b/README.md old mode 100644 new mode 100755 index a82e735..e7e1fa4 --- a/README.md +++ b/README.md @@ -59,6 +59,14 @@ You can force the creation of an array by adding the `force-array` parameter to The `force-array` attribute will not be copied to the output JSON . +You can force the creation of a string by adding the `force-string` parameter to your XML. So instead of creating a number, the following example will create a string. + + 123 + + {fruitId: '123'} + +The `force-string` attribute will not be copied to the output JSON . + ### Output formats There are four output formats in XSLTJSON, which one to use depends on your target application. If you want the most compact JSON, use the basic output. If you want to transform XML to JSON and JSON back to XML, use the [BadgerFish](http://badgerfish.ning.com/) output. If you want something in between, you could use the RabbitFish output; which is similar to the basic version, but does distinguish between elements and attributes. If you're dealing with a lot of data centric XML, you could use the highly structured Rayfish output. All four output formats ignore XML namespaces unless the `use-namespaces` parameter is set to `true()`, in which case namespaces are created according to the BadgerFish convention. diff --git a/conf/xml-to-json.xsl b/conf/xml-to-json.xsl old mode 100755 new mode 100644 index cd17aed..cf88a5e --- a/conf/xml-to-json.xsl +++ b/conf/xml-to-json.xsl @@ -1,8 +1,8 @@ + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:xs="http://www.w3.org/2001/XMLSchema" + xmlns:json="http://json.org/"> @@ -93,23 +93,23 @@ be used on the command line. --> - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + - + "" @@ -419,7 +421,13 @@ - null + + + + + null + + @@ -433,7 +441,7 @@ [ - + ] diff --git a/input/tests/general.xml b/input/tests/general.xml index 08a2a93..62424b8 100755 --- a/input/tests/general.xml +++ b/input/tests/general.xml @@ -7,6 +7,36 @@ false + + + + 1234 + + + + + + + + + + root + + + + element + 1234 + + + + + + + + + + +