zorba-coders team mailing list archive
-
zorba-coders team
-
Mailing list archive
-
Message #03975
[Merge] lp:~zorba-coders/zorba/remove_old_json into lp:zorba/data-converters-module
Paul J. Lucas has proposed merging lp:~zorba-coders/zorba/remove_old_json into lp:zorba/data-converters-module.
Requested reviews:
Paul J. Lucas (paul-lucas)
Matthias Brantner (matthias-brantner)
For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/remove_old_json/+merge/89770
Removed old JSON module.
--
https://code.launchpad.net/~zorba-coders/zorba/remove_old_json/+merge/89770
Your team Zorba Coders is subscribed to branch lp:zorba/data-converters-module.
=== removed file 'cmake_modules/FindJansson.cmake'
--- cmake_modules/FindJansson.cmake 2011-10-06 07:40:17 +0000
+++ cmake_modules/FindJansson.cmake 1970-01-01 00:00:00 +0000
@@ -1,64 +0,0 @@
-# Copyright 2006-2008 The FLWOR Foundation.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-# - Find Jansson
-#
-# Once done this will define
-#
-# Jansson_FOUND - System has Jansson
-# Jansson_INCLUDE_DIRS - The Jansson include directories
-# Jansson_LIBRARIES - The libraries needed to use Jansson
-
-IF (Jansson_INCLUDE AND Jansson_LIBRARY)
- # in cache already
- SET(Jansson_FIND_QUIETLY TRUE)
-ENDIF (Jansson_INCLUDE AND Jansson_LIBRARY)
-
-SET(LIBRARY_NAMES jansson jansson.lib Release/jansson.lib bin/jansson.lib bin/Release/jansson.lib)
-FIND_LIBRARY(
- Jansson_LIBRARY
- NAMES ${LIBRARY_NAMES}
- PATHS /usr/lib /usr/local/lib /opt/local/lib ${Jansson_LIBRARIES})
-
-FIND_PATH(
- Jansson_INCLUDE
- NAMES jansson.h
- PATH_SUFFIXES jansson src
- PATHS ${Jansson_INCLUDE_DIRS})
-
-IF(Jansson_LIBRARY AND Jansson_INCLUDE)
- SET(Jansson_FOUND TRUE)
- SET(Jansson_LIBRARIES ${Jansson_LIBRARY})
- SET(Jansson_INCLUDE_DIRS ${Jansson_INCLUDE})
-ELSE(Jansson_LIBRARY AND Jansson_INCLUDE)
- IF(NOT Jansson_LIBRARY)
- MESSAGE(STATUS "Jansson static library could not be found matching one of: ${LIBRARY_NAMES}")
- ENDIF(NOT Jansson_LIBRARY)
- IF(NOT Jansson_INCLUDE)
- MESSAGE(STATUS "Jansson source directory could not be found.")
- ENDIF(NOT Jansson_INCLUDE)
-
- SET(Jansson_FOUND FALSE)
- SET(Jansson_LIBRARIES)
- SET(Jansson_INCLUDE)
-ENDIF (Jansson_LIBRARY AND Jansson_INCLUDE)
-
-IF(Jansson_FOUND)
- IF(NOT Jansson_FIND_QUIETLY)
- MESSAGE(STATUS "Found Jansson : ${Jansson_LIBRARY}")
- MESSAGE(STATUS "Found Jansson include path : ${Jansson_INCLUDE_DIRS}")
- ENDIF(NOT Jansson_FIND_QUIETLY)
-ELSE(Jansson_FOUND)
- MESSAGE(STATUS "Could not find Jansson library.")
-ENDIF(Jansson_FOUND)
=== modified file 'src/com/zorba-xquery/www/modules/converters/CMakeLists.txt'
--- src/com/zorba-xquery/www/modules/converters/CMakeLists.txt 2011-12-06 08:05:27 +0000
+++ src/com/zorba-xquery/www/modules/converters/CMakeLists.txt 2012-01-23 19:42:25 +0000
@@ -40,40 +40,6 @@
ENDIF (ZORBA_SUPPRESS_LIBTIDY)
MESSAGE (STATUS "")
-
-#
-# Jansson
-#
-IF (ZORBA_SUPPRESS_JANSSON)
- MESSAGE (STATUS "ZORBA_SUPPRESS_JANSSON is true - not searching for Jansson.")
-ELSE (ZORBA_SUPPRESS_JANSSON)
-
- MESSAGE (STATUS "Looking for Jansson")
- FIND_PACKAGE (Jansson)
-
- IF (Jansson_FOUND)
- MESSAGE (STATUS "Found Jansson library -- " ${Jansson_LIBRARIES})
-
- SET (JSON_LINK_LIBRARIES ${Jansson_LIBRARIES})
- INCLUDE_DIRECTORIES (${Jansson_INCLUDE_DIRS})
- INCLUDE_DIRECTORIES ("json.xq.src")
- DECLARE_ZORBA_SCHEMA (FILE "json-options.xsd"
- URI "http://www.zorba-xquery.com/modules/converters/json-options")
- DECLARE_ZORBA_MODULE (URI "http://www.zorba-xquery.com/modules/converters/json" VERSION 1.0 FILE "json.xq" LINK_LIBRARIES "${Jansson_LIBRARIES}")
- ADD_TEST_DIRECTORY ("${PROJECT_SOURCE_DIR}/test_json")
-
- IF(ZORBA_NO_UNICODE)
- SET_TESTS_PROPERTIES(zorba_data-converters_module/converters/jansson/parse_json_03.xq
- PROPERTIES WILL_FAIL TRUE)
- ENDIF(ZORBA_NO_UNICODE)
-
- ELSE (Jansson_FOUND)
- MESSAGE (STATUS "Jansson library not found -- if you want to use Json functionality please set Jansson_INCLUDE_DIRS and Jansson_LIBRARIES cmake parameters.")
- ENDIF (Jansson_FOUND)
-ENDIF (ZORBA_SUPPRESS_JANSSON)
-MESSAGE (STATUS "")
-
-
# csv
DECLARE_ZORBA_SCHEMA (FILE csv-options.xsd
URI "http://www.zorba-xquery.com/modules/converters/csv-options")
@@ -97,4 +63,3 @@
SET_TESTS_PROPERTIES(zorba_data-converters_module/converters/csv/csv_parse_utf8_11.xq
PROPERTIES WILL_FAIL TRUE)
ENDIF(ZORBA_NO_UNICODE)
-
=== removed file 'src/com/zorba-xquery/www/modules/converters/json-options.xsd'
--- src/com/zorba-xquery/www/modules/converters/json-options.xsd 2011-08-11 20:09:07 +0000
+++ src/com/zorba-xquery/www/modules/converters/json-options.xsd 1970-01-01 00:00:00 +0000
@@ -1,47 +0,0 @@
-<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
- xmlns:json="http://www.zorba-xquery.com/modules/converters/json-options"
- targetNamespace="http://www.zorba-xquery.com/modules/converters/json-options"
- elementFormDefault="qualified" attributeFormDefault="unqualified">
-<!--
-:: Copyright 2006-2008 The FLWOR Foundation.
-::
-:: Licensed under the Apache License, Version 2.0 (the "License");
-:: you may not use this file except in compliance with the License.
-:: You may obtain a copy of the License at
-::
-:: http://www.apache.org/licenses/LICENSE-2.0
-::
-:: Unless required by applicable law or agreed to in writing, software
-:: distributed under the License is distributed on an "AS IS" BASIS,
-:: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-:: See the License for the specific language governing permissions and
-:: limitations under the License.
-::
--->
-
-
- <xs:element name="options">
- <xs:complexType>
- <xs:sequence>
- <xs:element name="json-param" minOccurs="1" maxOccurs="1">
- <xs:complexType>
- <xs:simpleContent>
- <xs:extension base="xs:string">
- <xs:attribute name="name" type="xs:string" use="required"/>
- <xs:attribute name="value" use="required">
- <xs:simpleType>
- <xs:restriction base="xs:string">
- <xs:enumeration value="simple-json"/>
- <xs:enumeration value="json-ml"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:attribute>
- <xs:attribute name="type" type="xs:string" use="optional"/>
- </xs:extension>
- </xs:simpleContent>
- </xs:complexType>
- </xs:element>
- </xs:sequence>
- </xs:complexType>
- </xs:element>
-</xs:schema>
=== removed file 'src/com/zorba-xquery/www/modules/converters/json.xq'
--- src/com/zorba-xquery/www/modules/converters/json.xq 2012-01-09 21:58:00 +0000
+++ src/com/zorba-xquery/www/modules/converters/json.xq 1970-01-01 00:00:00 +0000
@@ -1,242 +0,0 @@
-xquery version "3.0";
-
- (:
- : Copyright 2006-2009 The FLWOR Foundation.
- :
- : Licensed under the Apache License, Version 2.0 (the "License");
- : you may not use this file except in compliance with the License.
- : You may obtain a copy of the License at
- :
- : http://www.apache.org/licenses/LICENSE-2.0
- :
- : Unless required by applicable law or agreed to in writing, software
- : distributed under the License is distributed on an "AS IS" BASIS,
- : WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- : See the License for the specific language governing permissions and
- : limitations under the License.
- :)
-
- (:~
- :
- : <p>In order to enable JSON processing with XQuery, Zorba implements a set
- : of functions that open XQuery developers the door to process JSON
- : data. Specifically, this module provides two types of functions. Functions
- : to:
- : <ul>
- : <li>parse JSON and convert it to XDM and</li>
- : <li>serialize XDM in order to output JSON.</li>
- : </ul>
- : </p>
- :
- : <p>Both types of functions are available to parse and serialize two
- : types of XDM-JSON mappings:<ul><li>the first mapping called in this document
- : <strong>simple XDM-JSON</strong> has been
- : <a href="http://john.snelson.org.uk/parsing-json-into-xquery">
- : proposed by John Snelson</a></li><li>the second mapping is called
- : <a href="http://jsonml.org/">JsonML</a></li></ul>In the following, we
- : briefly describe both mappings.</p>
- :
- : <h2>Simple XDM-JSON Mapping</h2>
- : <ul><li>In order to process JSON with XQuery, Zorba implements a mapping between
- : JSON and XML that was initially proposed by John Snelson in his article
- : <a href="http://john.snelson.org.uk/parsing-json-into-xquery"
- : target="_blank">Parsing JSON into XQuery</a></li></ul>
- :
- : <h2>JsonML Mapping</h2>
- : <ul>
- : <li><a href="http://jsonml.org" target="_blank">JSonML</a> (JSON Markup Language)
- : is an application of the JSON format.</li>
- : <li>The purpose of JSonML is to provide a compact format for transporting
- : XML-based markup as JSon. In contrast to the <strong>simple XDM-JSON</strong> mapping described above
- : <strong>JsonML</strong> allows a lossless conversion back and forth.</li></ul>
- :
- : <h2>Important Notes:</h2>
- : <ul><li>Zorba uses the <a href="http://www.digip.org/jansson/">Jansson library</a>
- : for manipulating JSON data.</li>
- : <li>We have tested against the following Jansson library versions:
- : <ul><li><a href="http://www.digip.org/jansson/doc/1.2/">Jansson 1.2.1</a></li>
- : <li><a href="http://www.digip.org/jansson/doc/1.3/">Jansson 1.3</a></li>
- : <li><a href="http://www.digip.org/jansson/doc/2.0/">Jansson 2.0</a></li></ul> available from
- : <a href="http://www.digip.org/jansson/releases/">Jansson releases</a>.</li></ul>
- :
- : @author Sorin Nasoi
- : @library <a href="http://www.digip.org/jansson/">Jansson library for encoding, decoding and manipulating JSON data</a>
- :
- : @see <a href="http://john.snelson.org.uk/parsing-json-into-xquery">Mapping proposed by John Snelson</a>
- : @see <a href="http://jsonml.org" target="_blank">JSonML</a>
- : @see <a href="http://www.digip.org/jansson/doc/2.0/">Jansson library for encoding, decoding and manipulating JSON data</a>
- : @project data processing/data converters
- :
- :)
-module namespace json = "http://www.zorba-xquery.com/modules/converters/json";
-
-import module namespace schema = "http://www.zorba-xquery.com/modules/schema";
-
-import schema namespace json-options = "http://www.zorba-xquery.com/modules/converters/json-options";
-
-declare namespace err = "http://www.w3.org/2005/xqt-errors";
-
-declare namespace ver = "http://www.zorba-xquery.com/options/versioning";
-declare option ver:module-version "1.0";
-
-(:~
- : This function parses a JSON string and returns an XDM instance according
- : to either one of the mappings described above.
- :
- : @param $arg a sequence of valid JSON strings.
- : @param $options a set of name and value pairs that provide options
- : to configure the JSON mapping process that have to be validated against the
- : "http://www.zorba-xquery.com/modules/converters/json-options" schema.
- : @return a sequence of nodes according to either one of the mappings described above.
- : @error err:XQDY0027 if $options can not be validated against the json-options schema
- : @error json:ParseError if the JSON string passed as parameter is not
- : valid JSON.
- : @example test_json/Queries/converters/jansson/parse_json_02.xq
- : @example test_json/Queries/converters/jansson/parse_json_ml_01.xq
- :)
-declare function json:parse(
- $arg as xs:string?,
- $options as element(json-options:options)
-) as document-node(element(*, xs:untyped))
-{
- let $validated-options := if(schema:is-validated($options)) then
- $options
- else
- validate{$options}
- return
- json:parse-internal($arg, $validated-options)
-};
-
-(:~
- : This function parses a JSON string and returns an XDM instance according
- : to simple XDM-JSON mapping described above.
- :
- : @param $arg a sequence of valid JSON strings.
- : @return a sequence of nodes according to Simple XDM-JSON mapping described above.
- : @error json:ParseError if the JSON string passed as parameter is not
- : valid JSON.
- : @example test_json/Queries/converters/jansson/parse_json_11.xq
- :)
-declare function json:parse(
- $arg as xs:string?
-) as document-node(element(*, xs:untyped))
-{
- json:parse-internal($arg,
- validate {
- <options xmlns="http://www.zorba-xquery.com/modules/converters/json-options" >
- <json-param name="mapping" value="simple-json" />
- </options>
- }
- )
-};
-
-(:~
- : This function parses a JSON string and returns an XDM instance according
- : to JsonML mapping described above.
- :
- : @param $arg a sequence of valid JSON strings.
- : @return a sequence of nodes according the JSON-ML mapping described above.
- : @error json:ParseError if the JSON string passed as parameter is not
- : valid JSON.
- : @example test_json/Queries/converters/jansson/parse_json_ml_05.xq
- :)
-declare function json:parse-ml(
- $arg as xs:string?
-) as document-node(element(*, xs:untyped))
-{
- json:parse-internal($arg,
- validate {
- <options xmlns="http://www.zorba-xquery.com/modules/converters/json-options" >
- <json-param name="mapping" value="json-ml" type="array"/>
- </options>
- }
- )
-};
-
-declare %private function json:parse-internal(
- $html as xs:string,
- $options as element(json-options:options)?
-) as document-node(element(*, xs:untyped)) external;
-
-
-(:~
- : The serialize function takes a sequence of nodes as parameter and
- : transforms each element into a valid JSON string according to one of the
- : mappings described above.
- :
- : @param $xml a sequence of nodes.
- : @param $options a set of name and value pairs that provide options
- : to configure the JSON mapping process that have to be validated against the
- : "http://www.zorba-xquery.com/modules/converters/json-options" schema.
- : @return a JSON string.
- : @error err:XQDY0027 if $options can not be validated against the json-options schema
- : @error json:InvalidXDM if the input $xml is not a valid XDM
- : representation of JSON or JSON ML.
- : @example test_json/Queries/converters/jansson/serialize_json_01.xq
- : @example test_json/Queries/converters/jansson/serialize_json_ml_01.xq
- :)
-declare function json:serialize(
- $xml as item()*,
- $options as element(json-options:options)
-) as xs:string
-{
- let $validated-options := if(schema:is-validated($options)) then
- $options
- else
- validate{$options}
- return
- json:serialize-internal($xml, $validated-options)
-};
-
-(:~
- : The serialize function takes a sequence of nodes as parameter and
- : transforms each element into a valid JSON string according to the
- : Simple XDM-JSON mapping described above
- :
- : @param $xml a sequence of nodes.
- : @return a JSON string.
- : @error json:InvalidXDM if the input $xml is not a valid XDM
- : representation of JSON or JSON ML.
- : @example test_json/Queries/converters/jansson/serialize_json_18.xq
- :)
-declare function json:serialize(
- $xml as item()*
-) as xs:string
-{
- json:serialize-internal($xml,
- validate {
- <options xmlns="http://www.zorba-xquery.com/modules/converters/json-options" >
- <json-param name="mapping" value="simple-json" />
- </options>
- }
- )
-};
-
-(:~
- : The serialize function takes a sequence of nodes as parameter and
- : transforms each element into a valid JSON string according to the
- : JsonML mapping described above.
- :
- : @param $xml a sequence of nodes.
- : @return a JSON string.
- : @error json:InvalidXDM if the input $xml is not a valid XDM
- : representation of JSON or JSON ML.
- : @example test_json/Queries/converters/jansson/serialize_json_ml_04.xq
- :)
-declare function json:serialize-ml(
- $xml as item()*
-) as xs:string
-{
- json:serialize-internal($xml,
- validate {
- <options xmlns="http://www.zorba-xquery.com/modules/converters/json-options" >
- <json-param name="mapping" value="json-ml" type="array"/>
- </options>
- }
- )
-};
-
-declare %private function json:serialize-internal(
- $xml as item()*,
- $options as element(json-options:options)?
- ) as xs:string external;
=== removed directory 'src/com/zorba-xquery/www/modules/converters/json.xq.src'
=== removed file 'src/com/zorba-xquery/www/modules/converters/json.xq.src/jansson_wrapper.cpp'
--- src/com/zorba-xquery/www/modules/converters/json.xq.src/jansson_wrapper.cpp 2011-12-07 19:24:59 +0000
+++ src/com/zorba-xquery/www/modules/converters/json.xq.src/jansson_wrapper.cpp 1970-01-01 00:00:00 +0000
@@ -1,729 +0,0 @@
-/*
- * Copyright 2006-2008 The FLWOR Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <sstream>
-#include <cstring>
-
-#include <zorba/zorba.h>
-#include <zorba/iterator.h>
-#include <zorba/store_consts.h>
-
-#include <jansson.h>
-
-#include "jansson_wrapper.h"
-
-namespace zorba
-{
-namespace jsonmodule
-{
-static void serialize_child(
- const zorba::Item& aElement,
- std::stringstream& aResultSs,
- std::stringstream& aErrorLogSs,
- const std::string& aParentType);
-
-bool replace_all( std::string &s, char from, char to ) {
- bool replaced_any = false;
- for ( std::string::size_type pos = 0; pos < s.size(); ++pos ) {
- if ( (pos = s.find( from, pos )) == std::string::npos )
- break;
- s.replace( pos, 1, 1, to );
- replaced_any = true;
- }
- return replaced_any;
-}
-
-bool replace_all( std::string &s,
- char const *from, std::string::size_type from_len,
- char const *to, std::string::size_type to_len ) {
- bool replaced_any = false;
- for ( std::string::size_type pos = 0;
- pos + from_len <= s.size(); pos += to_len ) {
- if ( (pos = s.find( from, pos, from_len )) == std::string::npos )
- break;
- s.replace( pos, from_len, to, to_len );
- replaced_any = true;
- }
- return replaced_any;
-}
-
-bool replace_all( std::string &s, char const *from, char const *to )
-{
- return replace_all( s, from, std::strlen( from ), to, std::strlen( to ) );
-}
-
-void replace_special_chars(
- std::string &aValue)
-{
- replace_all(aValue, "\"", "\\\"" ); //quotation mark
- replace_all(aValue, "\\", "\\\\" ); //reverse solidus
- replace_all(aValue, "/" , "\\/" ); //solidus
- replace_all(aValue, "\b", "\\b" ); //backspace
- replace_all(aValue, "\f", "\\f" ); //formfeed
- replace_all(aValue, "\n", "\\n" ); //new line
- replace_all(aValue, "\r", "\\r" ); //carriage return
- replace_all(aValue, "\t", "\\t" ); //horizontal tab
- replace_all(aValue, "<" , "<" ); // <
- replace_all(aValue, ">" , ">" ); // >
-}
-
-static void parse_Json_value(
- const char *aKey,
- json_t *aValue,
- const char* aParentType,
- std::stringstream& aSs,
- std::stringstream& aErrorLogSs)
-{
- if(!aValue)
- return;
-
- switch(json_typeof(aValue))
- {
- case JSON_OBJECT:
- {
- const char *lKey;
- json_t *lValue;
- std::string lTmp(aKey);
-
- //<pair name=\"[...]\" type=\"object\">[...]</pair>
- aSs << "<pair";
- if(!lTmp.empty())
- aSs << " name=\"" << lTmp << "\"";
- aSs << " type=\"object\">";
-
- void *lIter = json_object_iter(aValue);
- while(lIter)
- {
- lKey = json_object_iter_key(lIter);
- lValue = json_object_iter_value(lIter);
-
- parse_Json_value(lKey, lValue, "object", aSs, aErrorLogSs);
-
- lIter = json_object_iter_next(aValue, lIter);
- }
-
- aSs << "</pair>";
- break;
- }
- case JSON_ARRAY:
- {
- json_t *lValue;
- zorba::String lName(aKey), lEmptyStr("");
-
- //<pair name=\"[...]\" type=\"array\">[...]</pair>
- aSs << "<pair name=\"" << lName << "\" type=\"array\">";
-
- for(size_t i = 0; i < json_array_size(aValue); i++)
- {
- lValue = json_array_get(aValue, i);
-
- parse_Json_value(lEmptyStr.c_str(), lValue, "array", aSs, aErrorLogSs);
- }
-
- aSs << "</pair>";
- break;
- }
- default:
- {
- //only NULL does not have a value
- bool lHaveVal = !(json_is_null(aValue));
-
- std::string lType, lValue;
- if(json_is_null(aValue))
- {
- lType = "null";
- lValue = "null";
- }
- else if(json_is_string(aValue))
- {
- lType = "string";
- lValue = json_string_value(aValue);
- }
- else if(json_is_number(aValue))
- {
- lType = "number";
-
- //json_string_value works just for STRING items so we have to use
- //json_number_value that returns a double
- std::ostringstream lOss;
- lOss << json_number_value(aValue);
- lValue = lOss.str();
- }
- else if(json_is_boolean(aValue))
- {
- lType = "boolean";
- lValue = json_is_true(aValue)?"true":"false";
- }
-
- zorba::String lName(aKey);
- std::string lParent(aParentType);
- std::string lItemName = (lParent.compare("object") == 0)?"pair":"item";
-
-
- aSs << "<" << lItemName;
- if(!lName.empty())
- {
- aSs <<" name=\"" << lName << "\"";
- }
- aSs << " type=\"" << lType;
- if(lHaveVal)
- {
- replace_special_chars(lValue);
- aSs << "\">" << lValue << "</" << lItemName << ">";
- }
- else
- aSs << "\"/>";
-
- break;
- }
- }
-}
-
-
-void JSON_parse(
- const char* aJsonString,
- std::stringstream& aSs,
- std::stringstream& aErrorLogSs)
-{
- json_error_t lerror;
- json_t *ljson;
-
- #if JANSSON_MAJOR_VERSION < 2
- ljson = json_loads(aJsonString, &lerror);
- #else
- ljson = json_loads(aJsonString, 0, &lerror);
- #endif
-
- if(!ljson)
- {
- #if JANSSON_MAJOR_VERSION < 2
- aErrorLogSs << "Error at line: " << lerror.line << std::endl;
- aErrorLogSs << lerror.text << std::endl;
- #else
- aErrorLogSs << "Error at line: " << lerror.line << " column: " << lerror.column << " position: " << lerror.position << std::endl;
- aErrorLogSs << lerror.text << std::endl;
- #endif
- return;
- }
-
- const char *lKey;
- json_t *lValue;
- lKey = json_object_iter_key(ljson);
-
- if(json_is_object(ljson))
- {
- aSs << "<json type=\"object\">";
- void *lIter = json_object_iter(ljson);
- while(lIter)
- {
- lKey = json_object_iter_key(lIter);
- lValue = json_object_iter_value(lIter);
-
- parse_Json_value(lKey, lValue, "object", aSs, aErrorLogSs);
-
- lIter = json_object_iter_next(ljson, lIter);
- }
- aSs << "</json>";
- }
- else if(json_is_array(ljson))
- {
- std::string lEmptyStr("");
- aSs << "<json type=\"array\">";
- for(size_t i = 0; i < json_array_size(ljson); i++)
- {
- lValue = json_array_get(ljson, i);
-
- parse_Json_value(lEmptyStr.c_str(), lValue, "array", aSs, aErrorLogSs);
- }
- aSs << "</json>";
- }
- else
- aErrorLogSs << "Either one of ARRAY and OBJECT are considered valid JSON." << std::endl;
-
-}
-
-void get_text_value(
- const zorba::Item& aElement,
- zorba::String& aValue)
-{
- zorba::Iterator_t lChildrenIt;
- zorba::Item lChild;
-
- lChildrenIt = aElement.getChildren();
- lChildrenIt->open();
- while (lChildrenIt->next(lChild))
- {
- if (lChild.getNodeKind() == store::StoreConsts::textNode)
- aValue = lChild.getStringValue();
- }
- lChildrenIt->close();
-}
-
-void serialize_element(
- const zorba::Item& aElement,
- std::stringstream& aResultSs,
- std::stringstream& aErrorLogSs,
- const std::string& aParentType)
-{
- zorba::Iterator_t lAttrIt, lChildrenIt;
- zorba::Item lAttr, lChild;
- zorba::String lName, lType;
-
- Item lNodeNameItem;
- aElement.getNodeName(lNodeNameItem);
-
- if(((aParentType.compare("object") == 0) &&
- !(lNodeNameItem.getStringValue() == "pair" || lNodeNameItem.getStringValue() == "json")) ||
- ((aParentType.compare("array") == 0) && lNodeNameItem.getStringValue() != "item"))
- {
- aErrorLogSs << "'Object' should have only 'pair' children and 'array' should have only 'item' children." << std::endl;
- return;
- }
-
- lAttrIt = aElement.getAttributes();
- lAttrIt->open();
- while (lAttrIt->next(lAttr))
- {
- if(lAttr.getNodeKind() == store::StoreConsts::attributeNode)
- {
- Item lNodeNameItem;
- lAttr.getNodeName(lNodeNameItem);
- if(lNodeNameItem.getStringValue() == "type")
- lType = lAttr.getStringValue();
- else if(lNodeNameItem.getStringValue() == "name")
- lName = lAttr.getStringValue();
- }
- }
- lAttrIt->close();
-
- if(lType.empty())
- {
- aErrorLogSs << "Element does not have a 'type' attribute defined." << std::endl;
- return;
- }
-
- if(lType == "object")
- {
- if(!lName.empty())
- aResultSs << "\"" << lName.c_str() << "\": ";
-
- //serialize every children
- aResultSs << "{";
- serialize_child(aElement, aResultSs, aErrorLogSs, "object");
- aResultSs << "}";
- }
- else if(lType == "array")
- {
- if(!lName.empty())
- aResultSs << "\"" << lName.c_str() << "\": ";
-
- //serialize every children
- aResultSs << "[";
- serialize_child(aElement, aResultSs, aErrorLogSs, "array");
- aResultSs << "]";
- }
- else if(lType == "string")
- {
- zorba::String lValue;
- get_text_value(aElement, lValue);
- zorba::Item lNodeNameItem;
- aElement.getNodeName(lNodeNameItem);
- if(lNodeNameItem.getStringValue() == "pair")
- {
- if(lName.empty())
- {
- aErrorLogSs << "Element does not have a 'name' attribute defined." << std::endl;
- return;
- }
- if(aParentType.compare("object") != 0)
- {
- aErrorLogSs << "'Pair' is allowed only as part of an object." << std::endl;
- return;
- }
- aResultSs << "\"" << lName.c_str() << "\": ";
- }
- aResultSs << "\"" << lValue.c_str() << "\"";
- }
- else if(lType == "null")
- {
- zorba::Item lNodeNameItem;
- aElement.getNodeName(lNodeNameItem);
- if(lNodeNameItem.getStringValue() == "pair")
- {
- aResultSs << "\"" << lName.c_str() << "\": ";
- }
- aResultSs << "null";
- }
- else if(lType == "number" ||
- lType == "boolean")
- {
- zorba::String lValue;
- get_text_value(aElement, lValue);
- zorba::Item lNodeNameItem;
- aElement.getNodeName(lNodeNameItem);
- if(lNodeNameItem.getStringValue() == "pair")
- {
- aResultSs << "\"" << lName.c_str() << "\": ";
- }
- aResultSs << lValue.c_str();
- }
- else
- {
- aErrorLogSs << "Type '" << lType.c_str() << "' not recognized." << std::endl;
- return;
- }
-}
-
-void serialize_child(
- const zorba::Item& aElement,
- std::stringstream& aResultSs,
- std::stringstream& aErrorLogSs,
- const std::string& aParentType)
-{
- bool lFirst = true;
- zorba::Iterator_t lChildrenIt;
- zorba::Item lChild;
-
- lChildrenIt = aElement.getChildren();
- lChildrenIt->open();
- while (lChildrenIt->next(lChild))
- {
- if(lChild.getNodeKind() == store::StoreConsts::elementNode)
- {
- if(!lFirst)
- aResultSs << ", ";
-
- serialize_element(lChild, aResultSs, aErrorLogSs, aParentType);
- lFirst = false;
- }
- }
- lChildrenIt->close();
-}
-
-void JSON_serialize(
- const zorba::Item& aElement,
- std::stringstream& aResultSs,
- std::stringstream& aErrorLogSs)
-{
- if (aElement.isNull())
- {
- aErrorLogSs << "Passed a NULL element to the JSON serializer." << std::endl;
- return;
- }
-
- if(!(aElement.getNodeKind() == store::StoreConsts::documentNode ||
- aElement.getNodeKind() == store::StoreConsts::elementNode))
- {
- aErrorLogSs << "Passed an incorrect Item to the JSON serializer." << std::endl;
- return;
- }
-
- Item lNodeNameItem;
- aElement.getNodeName(lNodeNameItem);
-
- if(!lNodeNameItem.isNull() && lNodeNameItem.getStringValue() != "json")
- {
- aErrorLogSs << "This is not a JSON element." << std::endl;
- return;
- }
-
- if(aElement.getNodeKind() == store::StoreConsts::documentNode)
- {
- serialize_child(aElement, aResultSs, aErrorLogSs, "object");
- return;
- }
-
- zorba::Iterator_t lAttrIt;
- zorba::Item lAttr;
- zorba::String lType;
- lAttrIt = aElement.getAttributes();
- lAttrIt->open();
- while (lAttrIt->next(lAttr))
- {
- if(lAttr.getNodeKind() == store::StoreConsts::attributeNode)
- {
- Item lNodeNameItem;
- lAttr.getNodeName(lNodeNameItem);
- if(lNodeNameItem.getStringValue() == "type")
- lType = lAttr.getStringValue();
- else
- {
- aErrorLogSs << "Could not retrieve the type of the Json root." << std::endl;
- return;
- }
- }
- }
- lAttrIt->close();
-
-
- if(lType == "object")
- aResultSs << "{";
- else
- aResultSs << "[";
-
- serialize_child(aElement, aResultSs, aErrorLogSs, "object");
-
- if(lType == "object")
- aResultSs << "}";
- else
- aResultSs << "]";
-}
-
-static void parse_JSON_ML_value(
- const char *aKey,
- json_t *aValue,
- const char* aParentType,
- std::stringstream& aSs,
- std::stringstream& aErrorLogSs,
- bool aShouldClose = false)
-{
- if(!aValue)
- return;
-
- switch(json_typeof(aValue))
- {
- case JSON_OBJECT:
- {
- const char *lKey;
- json_t *lValue;
- std::string lTmp(aKey);
-
- void *lIter = json_object_iter(aValue);
- while(lIter)
- {
- lKey = json_object_iter_key(lIter);
- lValue = json_object_iter_value(lIter);
-
- parse_JSON_ML_value(lKey, lValue, "object", aSs, aErrorLogSs);
-
- lIter = json_object_iter_next(aValue, lIter);
- }
- aSs << ">";
- break;
- }
- case JSON_ARRAY:
- {
- json_t *lValue;
- zorba::String lName(""), lEmptyStr("");
- bool lShouldClose = true;
-
- std::string lParent(aParentType);
- if(lParent.compare("array") == 0)
- {
- for(size_t i = 0; i < json_array_size(aValue); i++)
- {
- lValue = json_array_get(aValue, i);
-
- if(json_is_object(lValue))
- lShouldClose = false;
- }
-
- aSs << "<";
- }
-
- std::string lTmp;
- for(size_t i = 0; i < json_array_size(aValue); i++)
- {
- lValue = json_array_get(aValue, i);
-
- parse_JSON_ML_value(lEmptyStr.c_str(), lValue, "array", aSs, aErrorLogSs, lShouldClose);
-
- if(lShouldClose)
- lShouldClose = false;
- }
-
- lValue = json_array_get(aValue, 0);
- if(json_is_string(lValue))
- lName = json_string_value(lValue);
-
- if(lParent.compare("array") == 0)
- aSs << "</" << lName << ">";
-
- break;
- }
- default:
- {
- std::string lType, lValue;
- if(json_is_string(aValue))
- {
- lType = "string";
- lValue = json_string_value(aValue);
- }
- else if(json_is_boolean(aValue))
- {
- lType = json_is_true(aValue)?"true":"false";
- lValue = lType;
- }
- else if(json_is_number(aValue))
- {
- lType = "number";
-
- //json_string_value works just for STRING items so we have to use
- //json_number_value that returns a double
- std::ostringstream lOss;
- lOss << json_number_value(aValue);
- lValue = lOss.str();
- }
- else if(json_is_null(aValue))
- {
- lType = lValue = "null";
- }
-
- zorba::String lName(aKey);
- std::string lParent(aParentType);
-
- if(lParent.compare("array") == 0)
- aSs << lValue;
- else if(lParent.compare("object") == 0)
- {
- aSs << " " << lName << "=";
- replace_special_chars(lValue);
- if(lType.compare("string") == 0)
- aSs << "\"" << lValue << "\"";
- else
- aSs << lValue;
- }
-
- if(aShouldClose)
- aSs << ">";
-
- break;
- }
- }
-}
-
-void JSON_ML_parse(
- const char* aJsonString,
- std::stringstream& aSs,
- std::stringstream& aErrorLogSs)
-{
- json_error_t lerror;
- json_t *ljson;
- zorba::String lEmptyStr("");
-
- #if JANSSON_MAJOR_VERSION < 2
- ljson = json_loads(aJsonString, &lerror);
- #else
- ljson = json_loads(aJsonString, 0, &lerror);
- #endif
- if(!ljson)
- {
- #if JANSSON_MAJOR_VERSION < 2
- aErrorLogSs << "Error at line: " << lerror.line << std::endl;
- aErrorLogSs << lerror.text << std::endl;
- #else
- aErrorLogSs << "Error at line: " << lerror.line << " column: " << lerror.column << " position: " << lerror.position << std::endl;
- aErrorLogSs << lerror.text << std::endl;
- #endif
- return;
- }
-
- if(!json_is_array(ljson))
- aErrorLogSs << "ARRAY is the only accepted root for the Json-ML mapping." << std::endl;
-
- parse_JSON_ML_value(lEmptyStr.c_str(), ljson, "array", aSs, aErrorLogSs);
-}
-
-void JSON_ML_serialize(
- const zorba::Item& aElement,
- std::stringstream& aResultSs,
- std::stringstream& aErrorLogSs)
-{
- if (aElement.isNull())
- {
- aErrorLogSs << "Passed a NULL element to the JSON serializer." << std::endl;
- return;
- }
-
- if(!(aElement.getNodeKind() == store::StoreConsts::documentNode ||
- aElement.getNodeKind() == store::StoreConsts::elementNode ||
- aElement.getNodeKind() == store::StoreConsts::textNode))
- {
- aErrorLogSs << "Passed an incorrect Item to the JSON serializer." << std::endl;
- return;
- }
-
- if(aElement.getNodeKind() == store::StoreConsts::textNode)
- {
- aResultSs << "\"" << aElement.getStringValue().c_str() << "\"";
- return;
- }
-
- Item lNodeNameItem;
- aElement.getNodeName(lNodeNameItem);
-
- aResultSs << "[\"" << lNodeNameItem.getStringValue().c_str() << "\"";
-
- zorba::Iterator_t lAttrIt;
- zorba::Item lAttr;
- zorba::String lType;
- bool lHasAttributes = false;
-
- lAttrIt = aElement.getAttributes();
- lAttrIt->open();
- while (lAttrIt->next(lAttr))
- {
- if(lAttr.getNodeKind() == store::StoreConsts::attributeNode)
- {
- lHasAttributes = true;
- break;
- }
- }
- lAttrIt->close();
-
- if(lHasAttributes)
- aResultSs << ",{";
-
- bool lFirst = true;
- lAttrIt = aElement.getAttributes();
- lAttrIt->open();
- while (lAttrIt->next(lAttr))
- {
- if(lAttr.getNodeKind() == store::StoreConsts::attributeNode)
- {
- Item lNodeNameItem;
- lAttr.getNodeName(lNodeNameItem);
- if(!lFirst)
- aResultSs << ",";
-
- aResultSs << "\"" << lNodeNameItem.getStringValue().c_str() << "\":";
- aResultSs << "\"" << lAttr.getStringValue().c_str() << "\"";
- lFirst = false;
- }
- }
- lAttrIt->close();
- if(lHasAttributes)
- aResultSs << "}";
-
- zorba::Iterator_t lChildrenIt;
- zorba::Item lChild;
-
- lChildrenIt = aElement.getChildren();
- lChildrenIt->open();
- while (lChildrenIt->next(lChild))
- {
- aResultSs << ",";
- if (lChild.getNodeKind() == store::StoreConsts::elementNode ||
- lChild.getNodeKind() == store::StoreConsts::textNode)
- JSON_ML_serialize(lChild, aResultSs, aErrorLogSs);
- }
- lChildrenIt->close();
-
- aResultSs << "]";
-}
-
- } /* namespace jsonmodule */
-} /* namespace zorba */
=== removed file 'src/com/zorba-xquery/www/modules/converters/json.xq.src/jansson_wrapper.h'
--- src/com/zorba-xquery/www/modules/converters/json.xq.src/jansson_wrapper.h 2011-10-06 07:40:17 +0000
+++ src/com/zorba-xquery/www/modules/converters/json.xq.src/jansson_wrapper.h 1970-01-01 00:00:00 +0000
@@ -1,56 +0,0 @@
-/*
- * Copyright 2006-2008 The FLWOR Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef ZORBA_JSONMODULE_JANSSON_WRAPPER_H
-#define ZORBA_JSONMODULE_JANSSON_WRAPPER_H
-
-#include <zorba/item_factory.h>
-#include <zorba/item.h>
-
-namespace zorba
-{
- namespace jsonmodule
- {
- //Json parse and serialize: http://www.json.org/
- //according to the mapping proposed by john snelson:
- //http://snelson.org.uk/archives/2008/02/parsing_json_in.php#more
- void JSON_parse(
- const char* aJsonString,
- std::stringstream& aSs,
- std::stringstream& aErrorLogSs);
-
- void JSON_serialize(
- const zorba::Item& aElement,
- std::stringstream& aResultSs,
- std::stringstream& aErrorLogSs);
-
-
- //Json ML parse and serialize: http://jsonml.org/
- void JSON_ML_parse(
- const char* aJsonString,
- std::stringstream& aSs,
- std::stringstream& aErrorLogSs);
-
-
- void JSON_ML_serialize(
- const zorba::Item& aElement,
- std::stringstream& aResultSs,
- std::stringstream& aErrorLogSs);
-
- } /* namespace jsonmodule */
-} /* namespace zorba */
-
-#endif //ZORBA_JSONMODULE_JANSSON_WRAPPER_H
\ No newline at end of file
=== removed file 'src/com/zorba-xquery/www/modules/converters/json.xq.src/json.cpp'
--- src/com/zorba-xquery/www/modules/converters/json.xq.src/json.cpp 2011-08-18 22:09:48 +0000
+++ src/com/zorba-xquery/www/modules/converters/json.xq.src/json.cpp 1970-01-01 00:00:00 +0000
@@ -1,317 +0,0 @@
-/*
- * Copyright 2006-2008 The FLWOR Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <sstream>
-#include <cassert>
-
-#include <zorba/empty_sequence.h>
-#include <zorba/singleton_item_sequence.h>
-#include <zorba/diagnostic_list.h>
-#include <zorba/user_exception.h>
-#include <zorba/item.h>
-#include <zorba/store_consts.h>
-
-#include "json.h"
-#include "jansson_wrapper.h"
-
-namespace zorba
-{
- namespace jsonmodule
- {
-zorba::String
-JsonFunction::getOptionValue(zorba::Item& aOptionsItem, const char* aOptionName) const
-{
- zorba::Iterator_t lChildrenIt, lAttrIt;
- zorba::Item lChild, lAttr, lNodeNameItem;
- bool lCorrectChild = false;
-
- lChildrenIt = aOptionsItem.getChildren();
- lChildrenIt->open();
- while (lChildrenIt->next(lChild))
- {
- if (lChild.getNodeKind() == store::StoreConsts::elementNode)
- {
- lAttrIt = lChild.getAttributes();
- lAttrIt->open();
- while (lAttrIt->next(lAttr))
- {
- if(lAttr.getNodeKind() == store::StoreConsts::attributeNode)
- {
- lAttr.getNodeName(lNodeNameItem);
- if(!lCorrectChild &&
- lNodeNameItem.getStringValue() == "name")
- lCorrectChild = lAttr.getStringValue() == "mapping";
- else if(lCorrectChild &&
- lNodeNameItem.getStringValue() == "value")
- return lAttr.getStringValue();
- }
- }
- }
- }
- lChildrenIt->close();
-
- return zorba::String("");
-}
-//*****************************************************************************
-//*****************************************************************************
-
-ParseFunction::ParseFunction(const JsonModule* aModule)
-: JsonFunction(aModule)
-{
-}
-
-ItemSequence_t
-ParseFunction::evaluate(
- const ExternalFunction::Arguments_t& aArgs,
- const StaticContext* aSctxCtx,
- const DynamicContext* aDynCtx) const
- {
- zorba::Item lStringItem, lOptionsItem, lResItem;
- zorba::String lBaseUri, lJsonMapping, lOptionName("mapping");
- std::stringstream lSs, lErrorLogSs;
-
- if (aArgs.size() >= 1)
- {
- Iterator_t lArg0Iter = aArgs[0]->getIterator();
- lArg0Iter->open();
- lArg0Iter->next(lStringItem);
- lArg0Iter->close();
- }
-
- lBaseUri = aSctxCtx->getBaseURI();
-
- if (aArgs.size() == 2)
- {
- Iterator_t lArg0Iter = aArgs[1]->getIterator();
- lArg0Iter->open();
- lArg0Iter->next(lOptionsItem);
- lArg0Iter->close();
- }
-
- lJsonMapping = getOptionValue(lOptionsItem, lOptionName.c_str());
-
- if(lJsonMapping == "simple-json")
- {
- JSON_parse(lStringItem.getStringValue().c_str(), lSs, lErrorLogSs);
- }
- else // if(lJsonMapping == "json-ml")
- {
- assert(lJsonMapping == "json-ml"); // the schema makes sure that this is the case
- JSON_ML_parse(lStringItem.getStringValue().c_str(), lSs, lErrorLogSs);
- }
-
- if(!lErrorLogSs.str().empty())
- {
- zorba::Item lError = theModule->getItemFactory()->createQName(theModule->getURI(), "ParseError");
- throw USER_EXCEPTION(lError, lErrorLogSs.str());
- }
-
- XmlDataManager* lDataManager = Zorba::getInstance(0)->getXmlDataManager();
- Item lItem = lDataManager->parseXML(lSs);
-
- return ItemSequence_t(new SingletonItemSequence(lItem));
- }
-
-//*****************************************************************************
-//*****************************************************************************
-SerializeFunction::StringStreamSequence::StringStreamSequence(ItemSequence* input)
- : input_iter(input->getIterator()),
- is(new std::istream(this))
-{
- line_index = 0;
- has_next = true;
- is_open = false;
- open_count = 0;
- input_iter->open();
-}
-
-void SerializeFunction::StringStreamSequence::open()
-{
- is_open = true;
- line_index = 1;
- if(open_count)
- {
- is->seekg(0);
- if(is->fail())
- throw USER_EXCEPTION(theFactory->createQName(
- "http://www.zorba-xquery.com/modules/converters/json",
- "InvalidStream"),
- "Cannot reset streamable string item");
- }
- open_count++;
-}
-
-void SerializeFunction::StringStreamSequence::close()
-{
- is_open = false;
-}
-
-bool SerializeFunction::StringStreamSequence::isOpen() const
-{
- return is_open;
-}
-
-bool SerializeFunction::StringStreamSequence::next( Item &result )
-{
- assert(is_open);
-
- if(!has_next)
- return false;
- result = streamable_item;
- has_next = false;
- return true;
-}
-
-bool SerializeFunction::StringStreamSequence::next(std::string &result_string)
-{
- if(!input_iter->next(node_item))
- return false;
-
- std::stringstream lSs, lErrorLogSs;
-
- if(theMapping == "simple-json")
- JSON_serialize(node_item, lSs, lErrorLogSs);
- else if(theMapping == "json-ml")
- JSON_ML_serialize(node_item, lSs, lErrorLogSs);
-
- if(!lErrorLogSs.str().empty())
- {
- throw USER_EXCEPTION(
- theFactory->createQName(
- "http://www.zorba-xquery.com/modules/converters/json",
- "InvalidXDM"),
- lErrorLogSs.str());
- }
-
- result_string = lSs.str();
- return true;
-}
-
-bool SerializeFunction::StringStreamSequence::reset()
-{
- input_iter->close();
- input_iter->open();
- return true;
-}
-
-
-SerializeFunction::SerializeFunction(const JsonModule* aModule)
-: JsonFunction(aModule)
-{
-}
-
-ItemSequence_t
-SerializeFunction::evaluate(
- const ExternalFunction::Arguments_t& aArgs,
- const StaticContext* aSctxCtx,
- const DynamicContext* aDynCtx) const
- {
- zorba::Item lOptionsItem, lResItem;
- zorba::String lBaseUri, lJsonMapping, lOptionName("mapping");
- std::stringstream lSs, lErrorLogSs;
-
- lBaseUri = aSctxCtx->getBaseURI();
-
- if (aArgs.size() == 2)
- {
- Iterator_t lArg0Iter = aArgs[1]->getIterator();
- lArg0Iter->open();
- lArg0Iter->next(lOptionsItem);
- lArg0Iter->close();
- }
-
- lJsonMapping = getOptionValue(lOptionsItem, lOptionName.c_str());
-
- if(lJsonMapping != "simple-json" &&
- lJsonMapping != "json-ml")
- {
- zorba::Item lError = theModule->getItemFactory()->createQName(theModule->getURI(), "WrongParam");
- lErrorLogSs << "Mapping type '" << lJsonMapping << "' not supported.\nPossible values are 'simple-json' or 'json-ml'.";
- throw USER_EXCEPTION(lError, lErrorLogSs.str());
- }
-
- StringStreamSequence *stream_sequence = new StringStreamSequence((ItemSequence*)aArgs[0]);
- stream_sequence->theMapping = lJsonMapping;
- stream_sequence->theFactory = theModule->getItemFactory();
- stream_sequence->streamable_item =
- theModule->getItemFactory()->createStreamableString(
- *(stream_sequence->is), &StringStreamSequence::releaseStream);
-
- return ItemSequence_t(stream_sequence);
-
- }
-
-//*****************************************************************************
-//*****************************************************************************
-
-ItemFactory* JsonModule::theFactory = 0;
-
-JsonModule::~JsonModule()
-{
- for ( FuncMap_t::const_iterator lIter = theFunctions.begin();
- lIter != theFunctions.end();
- ++lIter)
- {
- delete lIter->second;
- }
- theFunctions.clear();
-}
-
-ExternalFunction*
-JsonModule::getExternalFunction(const String& aLocalname)
-{
- ExternalFunction*& lFunc = theFunctions[aLocalname];
- if (!lFunc)
- {
- if (1 == 0)
- { }
- else if (aLocalname == "parse-internal")
- {
- lFunc = new ParseFunction(this);
- }
- else if (aLocalname == "serialize-internal")
- {
- lFunc = new SerializeFunction(this);
- }
- }
- return lFunc;
-}
-
-void
-JsonModule::destroy()
-{
- if (!dynamic_cast<JsonModule*>(this))
- {
- return;
- }
- delete this;
-}
-//*****************************************************************************
-//*****************************************************************************
-
- } /* namespace jsonmodule */
-} /* namespace zorba */
-
-#ifdef WIN32
-# define DLL_EXPORT __declspec(dllexport)
-#else
-# define DLL_EXPORT __attribute__ ((visibility("default")))
-#endif
-
-extern "C" DLL_EXPORT zorba::ExternalModule* createModule()
-{
- return new zorba::jsonmodule::JsonModule();
-}
=== removed file 'src/com/zorba-xquery/www/modules/converters/json.xq.src/json.h'
--- src/com/zorba-xquery/www/modules/converters/json.xq.src/json.h 2011-10-06 07:40:17 +0000
+++ src/com/zorba-xquery/www/modules/converters/json.xq.src/json.h 1970-01-01 00:00:00 +0000
@@ -1,167 +0,0 @@
-/*
- * Copyright 2006-2008 The FLWOR Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef ZORBA_JSONMODULE_JSON_H
-#define ZORBA_JSONMODULE_JSON_H
-
-#include <map>
-
-#include <zorba/zorba.h>
-#include <zorba/iterator.h>
-#include <zorba/function.h>
-#include <zorba/external_module.h>
-
-#include "stringiterator_streambuf.h"
-
-namespace zorba
-{
- namespace jsonmodule
- {
-//*****************************************************************************
-//*****************************************************************************
- class JsonModule : public ExternalModule
- {
- private:
- static ItemFactory* theFactory;
-
- protected:
- class ltstr
- {
- public:
- bool operator()(const String& s1, const String& s2) const
- {
- return s1.compare(s2) < 0;
- }
- };
-
- typedef std::map<String, ExternalFunction*, ltstr> FuncMap_t;
-
- FuncMap_t theFunctions;
-
- public:
- virtual ~JsonModule();
-
- virtual String
- getURI() const { return "http://www.zorba-xquery.com/modules/converters/json"; }
-
- virtual ExternalFunction*
- getExternalFunction(const String& aLocalname);
-
- virtual void
- destroy();
-
- static ItemFactory*
- getItemFactory()
- {
- if(!theFactory)
- {
- theFactory = Zorba::getInstance(0)->getItemFactory();
- }
- return theFactory;
- }
- };
-
-//*****************************************************************************
-//*****************************************************************************
- class JsonFunction : public ContextualExternalFunction
- {
- protected:
- const JsonModule* theModule;
- zorba::String getOptionValue(zorba::Item& aOptionsItem, const char* aOptionName) const;
- public:
- JsonFunction(const JsonModule* aModule)
- : theModule(aModule) {};
-
- ~JsonFunction() {};
-
- virtual String
- getURI() const { return theModule->getURI(); }
-
- };
-
-//*****************************************************************************
-//*****************************************************************************
- class ParseFunction : public JsonFunction
- {
- public:
- ParseFunction(const JsonModule* aModule);
-
- virtual String
- getLocalName() const { return "parse-internal"; }
-
- virtual ItemSequence_t
- evaluate(const ExternalFunction::Arguments_t& args,
- const StaticContext* aSctxCtx,
- const DynamicContext* aDynCtx) const;
- };
-
- class SerializeFunction : public JsonFunction
- {
- class StringStreamSequence : public ItemSequence, public Iterator, public StringIteratorStreamBuf
- {
- private:
- Iterator_t input_iter;
- std::vector<std::vector<String> > headers;
- int line_index;
- bool has_next;
- bool is_open;
- int open_count;
-
- std::vector<String> line;
- Item node_item;
- public:
- std::istream* is;
- String theMapping;
- ItemFactory* theFactory;
- Item streamable_item;
- public:
- StringStreamSequence(ItemSequence* input);
- virtual ~StringStreamSequence() {}
-
- //for Iterator
- virtual void open();
- virtual void close();
- virtual bool isOpen() const;
- virtual bool next( Item &result );
-
- //for ItemSequence
- Iterator_t getIterator() {return this;}
-
- //for StringIteratorStreamBuf
- virtual bool next(std::string &next_string);
- virtual bool reset();
-
- static void
- releaseStream(std::istream* stream) { delete stream; }
-
- };
- public:
- SerializeFunction(const JsonModule* aModule);
-
- virtual String
- getLocalName() const { return "serialize-internal"; }
-
- virtual ItemSequence_t
- evaluate(const ExternalFunction::Arguments_t& args,
- const StaticContext* aSctxCtx,
- const DynamicContext* aDynCtx) const;
- };
-
-
-
- } /* namespace jsonmodule */
-} /* namespace zorba */
-
-#endif /* ZORBA_JSONMODULE_JSON_H */
=== removed file 'src/com/zorba-xquery/www/modules/converters/json.xq.src/stringiterator_streambuf.cpp'
--- src/com/zorba-xquery/www/modules/converters/json.xq.src/stringiterator_streambuf.cpp 2011-07-13 01:57:10 +0000
+++ src/com/zorba-xquery/www/modules/converters/json.xq.src/stringiterator_streambuf.cpp 1970-01-01 00:00:00 +0000
@@ -1,153 +0,0 @@
-/*
- * Copyright 2006-2008 The FLWOR Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <zorba/diagnostic_list.h>
-
-#include "stringiterator_streambuf.h"
-
-using namespace std;
-namespace zorba{
-
-StringIteratorStreamBuf::StringIteratorStreamBuf()
-{
- current_buffer = 0;
- last_buffer = 0;
- begin_offset = 0;
- is_eof = false;
-}
-
-//get next buffer
-int StringIteratorStreamBuf::underflow()
-{
- if(is_eof)
- return EOF;
-
- begin_offset += buffer[current_buffer].length();
- current_buffer = 1 - current_buffer;
- if(last_buffer != current_buffer)
- {
- buffer[current_buffer].resize(0);
- last_buffer = current_buffer;
- if(!next(buffer[current_buffer]))
- {
- //current_buffer = 1 - current_buffer;
- buffer[current_buffer].resize(0);
- is_eof = true;
- return EOF;
- }
- }
-
- char *buffstr = (char*)buffer[current_buffer].c_str();
- setg(buffstr, buffstr, buffstr+buffer[current_buffer].length());
- return *buffstr;
-}
-
-//unget char, some special cases
-int StringIteratorStreamBuf::pbackfail ( int c )
-{
- if(eback() != gptr())
- {
- setg(eback(), gptr()-1, egptr());
- if(c != EOF)
- *gptr() = (char)c;
- return 1;
- }
-
- //else have to rewind to previous buffer
- if(last_buffer != current_buffer)
- return EOF;
- if(buffer[1-last_buffer].length() == 0)
- return EOF;
- current_buffer = 1 - current_buffer;
-
- begin_offset -= buffer[current_buffer].length();
- char *buffstr = (char*)buffer[current_buffer].c_str();
- setg(buffstr, buffstr+buffer[current_buffer].length()-1, buffstr+buffer[current_buffer].length());
- if(c != EOF)
- *gptr() = (char)c;
- return 1;
-}
-
-//set a new position
-//if going too much back, restart the iterator
-streampos StringIteratorStreamBuf::seekoff ( streamoff off, ios_base::seekdir way, ios_base::openmode which )
-{
- if(!(which & ios_base::in))
- return -1;
-
- streampos targetpos;
- if(way == ios_base::end)
- {
- if(off > 0)
- return -1;
- while(underflow() != EOF);
- streampos maxpos = begin_offset + (streamoff)buffer[current_buffer].length();
- targetpos = maxpos + off;
- }
- else if(way == ios_base::cur)
- {
- targetpos = begin_offset + (streamoff)(gptr() - eback()) + off;
- }
- else if(way == ios_base::beg)
- {
- if(off < 0)
- return -1;
- targetpos = off;
- }
- else
- return -1;
- return seekpos(targetpos, ios_base::in);
-}
-
-//set a new position
-//if going too much back, restart the iterator
-streampos StringIteratorStreamBuf::seekpos ( streampos sp, ios_base::openmode which )
-{
- if(!(which & ios_base::in))
- return -1;
-
- if(sp < begin_offset)
- {
- setg(eback(), eback(), egptr());
- pbackfail(EOF);
- if(sp < begin_offset)
- {
- //restart the iterator
- if(!reset())
- return -1;
- buffer[0].resize(0);
- buffer[1].resize(0);
- current_buffer = last_buffer = 0;
- begin_offset = 0;
- is_eof = false;
- setg(NULL, NULL, NULL);
- }
- }
- while(sp >= (begin_offset+(streamoff)buffer[current_buffer].length()))
- {
- if(underflow() == EOF)
- {
- if(sp == (begin_offset+(streamoff)buffer[current_buffer].length()))
- break;
- return -1;
- }
- }
-
- setg(eback(), eback() + (streamoff)(sp - begin_offset), egptr());
- return sp;
-}
-
-}
=== removed file 'src/com/zorba-xquery/www/modules/converters/json.xq.src/stringiterator_streambuf.h'
--- src/com/zorba-xquery/www/modules/converters/json.xq.src/stringiterator_streambuf.h 2011-10-06 07:40:17 +0000
+++ src/com/zorba-xquery/www/modules/converters/json.xq.src/stringiterator_streambuf.h 1970-01-01 00:00:00 +0000
@@ -1,49 +0,0 @@
-/*
- * Copyright 2006-2008 The FLWOR Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <stdio.h>
-#include <streambuf>
-#include <istream>
-
-#ifndef STRING_ITERATOR_TO_STREAMBUF_IMPL
-#define STRING_ITERATOR_TO_STREAMBUF_IMPL
-
-namespace zorba{
-
-class StringIteratorStreamBuf : public std::streambuf
-{
- std::string buffer[2];
- int current_buffer;
- int last_buffer;
- std::streampos begin_offset;
- bool is_eof;
-public:
- StringIteratorStreamBuf();
- virtual ~StringIteratorStreamBuf() {}
-
- virtual int underflow ( );
- virtual int pbackfail ( int c = EOF );
-
- virtual std::streampos seekoff ( std::streamoff off, std::ios_base::seekdir way, std::ios_base::openmode which = std::ios_base::in | std::ios_base::out );
- virtual std::streampos seekpos ( std::streampos sp, std::ios_base::openmode which = std::ios_base::in | std::ios_base::out );
-
-public:
- virtual bool next(std::string &next_string) = 0;
- virtual bool reset() = 0;
-};
-
-}
-#endif
=== removed directory 'test_json'
=== removed directory 'test_json/ExpQueryResults'
=== removed directory 'test_json/ExpQueryResults/converters'
=== removed directory 'test_json/ExpQueryResults/converters/jansson'
=== removed file 'test_json/ExpQueryResults/converters/jansson/parse_json_01.xml.res'
--- test_json/ExpQueryResults/converters/jansson/parse_json_01.xml.res 2011-05-31 15:21:09 +0000
+++ test_json/ExpQueryResults/converters/jansson/parse_json_01.xml.res 1970-01-01 00:00:00 +0000
@@ -1,1 +0,0 @@
-<json type="object"><pair name="phoneNumbers" type="array"><item type="string">212 732-1234</item><item type="string">646 123-4567</item></pair><pair name="firstName" type="string">John</pair><pair name="lastName" type="string">Smith</pair><pair name="address" type="object"><pair name="postalCode" type="number">10021</pair><pair name="city" type="string">New York</pair><pair name="streetAddress" type="string">21 2nd Street</pair><pair name="state" type="string">NY</pair></pair></json>
\ No newline at end of file
=== removed file 'test_json/ExpQueryResults/converters/jansson/parse_json_02.xml.res'
--- test_json/ExpQueryResults/converters/jansson/parse_json_02.xml.res 2011-05-31 15:21:09 +0000
+++ test_json/ExpQueryResults/converters/jansson/parse_json_02.xml.res 1970-01-01 00:00:00 +0000
@@ -1,1 +0,0 @@
-<json type="array"><pair type="object"><pair name="phoneNumbers" type="array"><item type="string">212 732-1234</item><item type="string">646 123-4567</item></pair><pair name="firstName" type="string">John</pair><pair name="lastName" type="string">Smith</pair><pair name="address" type="object"><pair name="postalCode" type="number">10021</pair><pair name="city" type="string">New York</pair><pair name="streetAddress" type="string">21 2nd Street</pair><pair name="state" type="string">NY</pair></pair></pair><pair type="object"><pair name="phoneNumbers" type="array"><item type="string">212 732-1234</item><item type="string">646 123-4567</item></pair><pair name="firstName" type="string">John</pair><pair name="lastName" type="string">Smith</pair><pair name="address" type="object"><pair name="postalCode" type="number">10021</pair><pair name="city" type="string">New York</pair><pair name="streetAddress" type="string">21 2nd Street</pair><pair name="state" type="string">NY</pair></pair></pair></json>
\ No newline at end of file
=== removed file 'test_json/ExpQueryResults/converters/jansson/parse_json_03.xml.res'
--- test_json/ExpQueryResults/converters/jansson/parse_json_03.xml.res 2011-05-31 15:21:09 +0000
+++ test_json/ExpQueryResults/converters/jansson/parse_json_03.xml.res 1970-01-01 00:00:00 +0000
@@ -1,1 +0,0 @@
-<json type="object"><pair name="mdash" type="string">–</pair></json>
\ No newline at end of file
=== removed file 'test_json/ExpQueryResults/converters/jansson/parse_json_06.xml.res'
--- test_json/ExpQueryResults/converters/jansson/parse_json_06.xml.res 2011-05-31 15:21:09 +0000
+++ test_json/ExpQueryResults/converters/jansson/parse_json_06.xml.res 1970-01-01 00:00:00 +0000
@@ -1,1 +0,0 @@
-<json type="object"><pair name="web-app" type="string">!_\\"-\\?*.$+</pair></json>
\ No newline at end of file
=== removed file 'test_json/ExpQueryResults/converters/jansson/parse_json_07.xml.res'
--- test_json/ExpQueryResults/converters/jansson/parse_json_07.xml.res 2011-05-31 15:21:09 +0000
+++ test_json/ExpQueryResults/converters/jansson/parse_json_07.xml.res 1970-01-01 00:00:00 +0000
@@ -1,1 +0,0 @@
-<json type="object"><pair name="special-numbers" type="object"><pair name="decimal" type="number">2.89</pair><pair name="e" type="number">2e+06</pair><pair name="negative" type="number">-1.89</pair></pair></json>
\ No newline at end of file
=== removed file 'test_json/ExpQueryResults/converters/jansson/parse_json_08.xml.res'
--- test_json/ExpQueryResults/converters/jansson/parse_json_08.xml.res 2011-05-31 15:21:09 +0000
+++ test_json/ExpQueryResults/converters/jansson/parse_json_08.xml.res 1970-01-01 00:00:00 +0000
@@ -1,1 +0,0 @@
-<json type="object"><pair name="web-app" type="null"/></json>
\ No newline at end of file
=== removed file 'test_json/ExpQueryResults/converters/jansson/parse_json_09.xml.res'
--- test_json/ExpQueryResults/converters/jansson/parse_json_09.xml.res 2011-05-31 15:21:09 +0000
+++ test_json/ExpQueryResults/converters/jansson/parse_json_09.xml.res 1970-01-01 00:00:00 +0000
@@ -1,1 +0,0 @@
-<json type="object"><pair name="bool" type="boolean">true</pair><pair name="numbers" type="array"><item type="number">1</item><item type="number">2</item><item type="number">3</item></pair><pair name="firstName" type="string">John</pair><pair name="state" type="null"/><pair name="address" type="object"><pair name="streetAddress" type="string">21 2nd Street</pair><pair name="delivery" type="object"><pair name="streetAddress" type="string">StreetName</pair><pair name="city" type="string">CityName</pair><pair name="state" type="string">StateName</pair></pair><pair name="state" type="null"/><pair name="postalCode" type="number">10021</pair><pair name="literals" type="array"><item type="boolean">true</item><item type="boolean">false</item><item type="null"/></pair></pair><pair name="strings" type="array"><item type="string">one</item><item type="string">two</item><item type="string">three</item><item type="string">four</item></pair></json>
\ No newline at end of file
=== removed file 'test_json/ExpQueryResults/converters/jansson/parse_json_10.xml.res'
--- test_json/ExpQueryResults/converters/jansson/parse_json_10.xml.res 2011-05-31 15:21:09 +0000
+++ test_json/ExpQueryResults/converters/jansson/parse_json_10.xml.res 1970-01-01 00:00:00 +0000
@@ -1,1 +0,0 @@
-<json type="array"><pair type="object"><pair name="lastName" type="string">Smith</pair><pair name="firstName" type="string">John</pair><pair name="address" type="object"><pair name="streetAddress" type="string">21 2nd Street</pair><pair name="city" type="string">New York</pair><pair name="state" type="string">NY</pair><pair name="postalCode" type="number">10021</pair></pair><pair name="phoneNumbers" type="array"><item type="string">212 732-1234</item><item type="string">646 123-4567</item></pair></pair><pair type="object"><pair name="bool" type="boolean">true</pair><pair name="numbers" type="array"><item type="number">1</item><item type="number">2</item><item type="number">3</item></pair><pair name="firstName" type="string">John</pair><pair name="state" type="null"/><pair name="address" type="object"><pair name="streetAddress" type="string">21 2nd Street</pair><pair name="delivery" type="object"><pair name="streetAddress" type="string">StreetName</pair><pair name="city" type="string">CityName</pair><pair name="state" type="string">StateName</pair></pair><pair name="state" type="null"/><pair name="postalCode" type="number">10021</pair><pair name="literals" type="array"><item type="boolean">true</item><item type="boolean">false</item><item type="null"/></pair></pair><pair name="strings" type="array"><item type="string">one</item><item type="string">two</item><item type="string">three</item><item type="string">four</item></pair></pair></json>
\ No newline at end of file
=== removed file 'test_json/ExpQueryResults/converters/jansson/parse_json_11.xml.res'
--- test_json/ExpQueryResults/converters/jansson/parse_json_11.xml.res 2011-05-31 15:21:09 +0000
+++ test_json/ExpQueryResults/converters/jansson/parse_json_11.xml.res 1970-01-01 00:00:00 +0000
@@ -1,1 +0,0 @@
-<json type="object"><pair name="phoneNumbers" type="array"><item type="string">212 732-1234</item><item type="string">646 123-4567</item></pair><pair name="firstName" type="string">John</pair><pair name="lastName" type="string">Smith</pair><pair name="address" type="object"><pair name="postalCode" type="number">10021</pair><pair name="city" type="string">New York</pair><pair name="streetAddress" type="string">21 2nd Street</pair><pair name="state" type="string">NY</pair></pair></json>
\ No newline at end of file
=== removed file 'test_json/ExpQueryResults/converters/jansson/parse_json_12.xml.res'
--- test_json/ExpQueryResults/converters/jansson/parse_json_12.xml.res 2011-12-06 14:20:24 +0000
+++ test_json/ExpQueryResults/converters/jansson/parse_json_12.xml.res 1970-01-01 00:00:00 +0000
@@ -1,1 +0,0 @@
-{"html": "<b>bold<\/b>"}
=== removed file 'test_json/ExpQueryResults/converters/jansson/parse_json_ml_01.xml.res'
--- test_json/ExpQueryResults/converters/jansson/parse_json_ml_01.xml.res 2011-05-31 15:21:09 +0000
+++ test_json/ExpQueryResults/converters/jansson/parse_json_ml_01.xml.res 1970-01-01 00:00:00 +0000
@@ -1,1 +0,0 @@
-<ul><li style="color:red">First Item</li><li title="Some hover text." style="color:green">Second Item</li><li><span class="code-example-third">Third</span> Item</li></ul>
\ No newline at end of file
=== removed file 'test_json/ExpQueryResults/converters/jansson/parse_json_ml_02.xml.res'
--- test_json/ExpQueryResults/converters/jansson/parse_json_ml_02.xml.res 2011-05-31 15:21:09 +0000
+++ test_json/ExpQueryResults/converters/jansson/parse_json_ml_02.xml.res 1970-01-01 00:00:00 +0000
@@ -1,1 +0,0 @@
-<table class="MyTable" style="background-color:yellow"><tr><td class="MyTD" style="border:1px solid black">#550758</td><td class="MyTD" style="background-color:red">Example text here</td></tr><tr><td class="MyTD" style="border:1px solid black">#993101</td><td class="MyTD" style="background-color:green">127624015</td></tr><tr><td class="MyTD" style="border:1px solid black">#E33D87</td><td class="MyTD" style="background-color:blue"> <span style="background-color:maroon">©</span> </td></tr></table>
\ No newline at end of file
=== removed file 'test_json/ExpQueryResults/converters/jansson/parse_json_ml_05.xml.res'
--- test_json/ExpQueryResults/converters/jansson/parse_json_ml_05.xml.res 2011-05-31 15:21:09 +0000
+++ test_json/ExpQueryResults/converters/jansson/parse_json_ml_05.xml.res 1970-01-01 00:00:00 +0000
@@ -1,1 +0,0 @@
-<ul><li style="color:red">First Item</li><li title="Some hover text." style="color:green">Second Item</li><li><span class="code-example-third">Third</span> Item</li></ul>
\ No newline at end of file
=== removed file 'test_json/ExpQueryResults/converters/jansson/parse_json_ml_06.xml.res'
--- test_json/ExpQueryResults/converters/jansson/parse_json_ml_06.xml.res 2011-12-06 14:20:24 +0000
+++ test_json/ExpQueryResults/converters/jansson/parse_json_ml_06.xml.res 1970-01-01 00:00:00 +0000
@@ -1,1 +0,0 @@
-<html><b>bold</b></html>
=== removed file 'test_json/ExpQueryResults/converters/jansson/serialize_json_01.xml.res'
--- test_json/ExpQueryResults/converters/jansson/serialize_json_01.xml.res 2011-12-07 18:44:46 +0000
+++ test_json/ExpQueryResults/converters/jansson/serialize_json_01.xml.res 1970-01-01 00:00:00 +0000
@@ -1,1 +0,0 @@
-{"phoneNumbers": ["212 732-1234", "646 123-4567"], "firstName": "John", "lastName": "Smith", "address": {"postalCode": 10021, "city": "New York", "streetAddress": "21 2nd Street", "state": "NY"}}
\ No newline at end of file
=== removed file 'test_json/ExpQueryResults/converters/jansson/serialize_json_02.xml.res'
--- test_json/ExpQueryResults/converters/jansson/serialize_json_02.xml.res 2011-12-07 18:44:46 +0000
+++ test_json/ExpQueryResults/converters/jansson/serialize_json_02.xml.res 1970-01-01 00:00:00 +0000
@@ -1,1 +0,0 @@
-[{"phoneNumbers": ["212 732-1234", "646 123-4567"], "firstName": "John", "lastName": "Smith", "address": {"postalCode": 10021, "city": "New York", "streetAddress": "21 2nd Street", "state": "NY"}}, {"phoneNumbers": ["212 732-1234", "646 123-4567"], "firstName": "John", "lastName": "Smith", "address": {"postalCode": 10021, "city": "New York", "streetAddress": "21 2nd Street", "state": "NY"}}]
\ No newline at end of file
=== removed file 'test_json/ExpQueryResults/converters/jansson/serialize_json_04.xml.res'
--- test_json/ExpQueryResults/converters/jansson/serialize_json_04.xml.res 2011-12-07 18:44:46 +0000
+++ test_json/ExpQueryResults/converters/jansson/serialize_json_04.xml.res 1970-01-01 00:00:00 +0000
@@ -1,1 +0,0 @@
-{"firstName": "\""}
\ No newline at end of file
=== removed file 'test_json/ExpQueryResults/converters/jansson/serialize_json_05.xml.res'
--- test_json/ExpQueryResults/converters/jansson/serialize_json_05.xml.res 2011-12-07 18:44:46 +0000
+++ test_json/ExpQueryResults/converters/jansson/serialize_json_05.xml.res 1970-01-01 00:00:00 +0000
@@ -1,1 +0,0 @@
-{"name": "\"\\\/\b\f\n\r\t"}
\ No newline at end of file
=== removed file 'test_json/ExpQueryResults/converters/jansson/serialize_json_09.xml.res'
--- test_json/ExpQueryResults/converters/jansson/serialize_json_09.xml.res 2011-12-07 18:44:46 +0000
+++ test_json/ExpQueryResults/converters/jansson/serialize_json_09.xml.res 1970-01-01 00:00:00 +0000
@@ -1,1 +0,0 @@
-{"servlet": [["value1"], "value2"]}
\ No newline at end of file
=== removed file 'test_json/ExpQueryResults/converters/jansson/serialize_json_10.xml.res'
--- test_json/ExpQueryResults/converters/jansson/serialize_json_10.xml.res 2011-05-31 15:21:09 +0000
+++ test_json/ExpQueryResults/converters/jansson/serialize_json_10.xml.res 1970-01-01 00:00:00 +0000
@@ -1,1 +0,0 @@
-{"servlet": [{"name": "value1"}, "value2"]
\ No newline at end of file
=== removed file 'test_json/ExpQueryResults/converters/jansson/serialize_json_13.xml.res'
--- test_json/ExpQueryResults/converters/jansson/serialize_json_13.xml.res 2011-12-07 18:44:46 +0000
+++ test_json/ExpQueryResults/converters/jansson/serialize_json_13.xml.res 1970-01-01 00:00:00 +0000
@@ -1,1 +0,0 @@
-{"servlet": ["value"]}
\ No newline at end of file
=== removed file 'test_json/ExpQueryResults/converters/jansson/serialize_json_14.xml.res'
--- test_json/ExpQueryResults/converters/jansson/serialize_json_14.xml.res 2011-12-07 18:44:46 +0000
+++ test_json/ExpQueryResults/converters/jansson/serialize_json_14.xml.res 1970-01-01 00:00:00 +0000
@@ -1,1 +0,0 @@
-{"servlet": {"name": "value"}}
\ No newline at end of file
=== removed file 'test_json/ExpQueryResults/converters/jansson/serialize_json_15.xml.res'
--- test_json/ExpQueryResults/converters/jansson/serialize_json_15.xml.res 2011-12-07 18:44:46 +0000
+++ test_json/ExpQueryResults/converters/jansson/serialize_json_15.xml.res 1970-01-01 00:00:00 +0000
@@ -1,1 +0,0 @@
-{"servlet": [{}]}
\ No newline at end of file
=== removed file 'test_json/ExpQueryResults/converters/jansson/serialize_json_16.xml.res'
--- test_json/ExpQueryResults/converters/jansson/serialize_json_16.xml.res 2011-12-07 18:44:46 +0000
+++ test_json/ExpQueryResults/converters/jansson/serialize_json_16.xml.res 1970-01-01 00:00:00 +0000
@@ -1,1 +0,0 @@
-{"servlet": [["212 732-1234"]]}
\ No newline at end of file
=== removed file 'test_json/ExpQueryResults/converters/jansson/serialize_json_17.xml.res'
--- test_json/ExpQueryResults/converters/jansson/serialize_json_17.xml.res 2011-05-31 15:21:09 +0000
+++ test_json/ExpQueryResults/converters/jansson/serialize_json_17.xml.res 1970-01-01 00:00:00 +0000
@@ -1,1 +0,0 @@
-{"special-chars": {"backslash": "\\", "formfeed": "\f", "quote": "\\"", "horizontal tab": "\t", "carriage return": "\r", "backspace": "\b", "newline": "\n", "solidus": "\/"}}
\ No newline at end of file
=== removed file 'test_json/ExpQueryResults/converters/jansson/serialize_json_18.xml.res'
--- test_json/ExpQueryResults/converters/jansson/serialize_json_18.xml.res 2011-12-05 20:05:44 +0000
+++ test_json/ExpQueryResults/converters/jansson/serialize_json_18.xml.res 1970-01-01 00:00:00 +0000
@@ -1,1 +0,0 @@
-{"phoneNumbers": ["212 732-1234", "646 123-4567"], "firstName": "John", "lastName": "Smith", "address": {"postalCode": 10021, "city": "New York", "streetAddress": "21 2nd Street", "state": "NY"}}
=== removed file 'test_json/ExpQueryResults/converters/jansson/serialize_json_ml_01.xml.res'
--- test_json/ExpQueryResults/converters/jansson/serialize_json_ml_01.xml.res 2011-05-31 15:21:09 +0000
+++ test_json/ExpQueryResults/converters/jansson/serialize_json_ml_01.xml.res 1970-01-01 00:00:00 +0000
@@ -1,1 +0,0 @@
-["ul",["li",{"style":"color:red"},"First Item"],["li",{"title":"Some hover text.","style":"color:green"},"Second Item"],["li",["span",{"class":"code-example-third"},"Third"],"Item"]]
\ No newline at end of file
=== removed file 'test_json/ExpQueryResults/converters/jansson/serialize_json_ml_02.xml.res'
--- test_json/ExpQueryResults/converters/jansson/serialize_json_ml_02.xml.res 2011-05-31 15:21:09 +0000
+++ test_json/ExpQueryResults/converters/jansson/serialize_json_ml_02.xml.res 1970-01-01 00:00:00 +0000
@@ -1,1 +0,0 @@
-["table",{"class":"MyTable","style":"background-color:yellow"},["tr",["td",{"class":"MyTD","style":"border:1px solid black"},"#5D28D1"],["td",{"class":"MyTD","style":"background-color:red"},"Example text here"]],["tr",["td",{"class":"MyTD","style":"border:1px solid black"},"#AF44EF"],["td",{"class":"MyTD","style":"background-color:green"},"127310656"]],["tr",["td",{"class":"MyTD","style":"border:1px solid black"},"#AAD034"],["td",{"class":"MyTD","style":"background-color:blue"},"\u00A0",["span",{"style":"background-color:maroon"},"\u00A9"],"\u00A0"]]]
\ No newline at end of file
=== removed file 'test_json/ExpQueryResults/converters/jansson/serialize_json_ml_04.xml.res'
--- test_json/ExpQueryResults/converters/jansson/serialize_json_ml_04.xml.res 2011-05-31 15:21:09 +0000
+++ test_json/ExpQueryResults/converters/jansson/serialize_json_ml_04.xml.res 1970-01-01 00:00:00 +0000
@@ -1,1 +0,0 @@
-["ul",["li",{"style":"color:red"},"First Item"],["li",{"title":"Some hover text.","style":"color:green"},"Second Item"],["li",["span",{"class":"code-example-third"},"Third"],"Item"]]
\ No newline at end of file
=== removed directory 'test_json/Queries'
=== removed directory 'test_json/Queries/converters'
=== removed directory 'test_json/Queries/converters/jansson'
=== removed file 'test_json/Queries/converters/jansson/parse_json_01.spec'
--- test_json/Queries/converters/jansson/parse_json_01.spec 2011-05-31 15:21:09 +0000
+++ test_json/Queries/converters/jansson/parse_json_01.spec 1970-01-01 00:00:00 +0000
@@ -1,1 +0,0 @@
-Comparison: Ignore
\ No newline at end of file
=== removed file 'test_json/Queries/converters/jansson/parse_json_01.xq'
--- test_json/Queries/converters/jansson/parse_json_01.xq 2011-08-07 21:55:48 +0000
+++ test_json/Queries/converters/jansson/parse_json_01.xq 1970-01-01 00:00:00 +0000
@@ -1,22 +0,0 @@
-(: the comparison method for this test is set to Ignore because the order in which the children
-are returned in jansson 1.2, 1.3, 2.0 is different:)
-
-import module namespace json = "http://www.zorba-xquery.com/modules/converters/json";
-import schema namespace html-options="http://www.zorba-xquery.com/modules/converters/json-options";
-
-json:parse(('{
- "firstName": "John",
- "lastName": "Smith",
- "address": {
- "streetAddress": "21 2nd Street",
- "city": "New York",
- "state": "NY",
- "postalCode": 10021
- },
- "phoneNumbers": [
- "212 732-1234",
- "646 123-4567"
- ]
- }'),<options xmlns="http://www.zorba-xquery.com/modules/converters/json-options" >
- <json-param name="mapping" value="simple-json" />
- </options>)
=== removed file 'test_json/Queries/converters/jansson/parse_json_02.spec'
--- test_json/Queries/converters/jansson/parse_json_02.spec 2011-05-31 15:21:09 +0000
+++ test_json/Queries/converters/jansson/parse_json_02.spec 1970-01-01 00:00:00 +0000
@@ -1,1 +0,0 @@
-Comparison: Ignore
\ No newline at end of file
=== removed file 'test_json/Queries/converters/jansson/parse_json_02.xq'
--- test_json/Queries/converters/jansson/parse_json_02.xq 2011-08-07 21:55:48 +0000
+++ test_json/Queries/converters/jansson/parse_json_02.xq 1970-01-01 00:00:00 +0000
@@ -1,37 +0,0 @@
-(: the comparison method for this test is set to Ignore because the order in which the children
-are returned in jansson 1.2, 1.3, 2.0 is different:)
-
-import module namespace json = "http://www.zorba-xquery.com/modules/converters/json";
-import schema namespace html-options="http://www.zorba-xquery.com/modules/converters/json-options";
-
-json:parse(('[
-{
- "firstName": "John",
- "lastName": "Smith",
- "address": {
- "streetAddress": "21 2nd Street",
- "city": "New York",
- "state": "NY",
- "postalCode": 10021
- },
- "phoneNumbers": [
- "212 732-1234",
- "646 123-4567"
- ]
-},
-{
- "firstName": "John",
- "lastName": "Smith",
- "address": {
- "streetAddress": "21 2nd Street",
- "city": "New York",
- "state": "NY",
- "postalCode": 10021
- },
- "phoneNumbers": [
- "212 732-1234",
- "646 123-4567"
- ]
- }]'),<options xmlns="http://www.zorba-xquery.com/modules/converters/json-options" >
- <json-param name="mapping" value="simple-json" />
- </options>)
=== removed file 'test_json/Queries/converters/jansson/parse_json_03.xq'
--- test_json/Queries/converters/jansson/parse_json_03.xq 2011-08-07 21:55:48 +0000
+++ test_json/Queries/converters/jansson/parse_json_03.xq 1970-01-01 00:00:00 +0000
@@ -1,8 +0,0 @@
-(: try parsing a Unicode UTF-8 value :)
-
-import module namespace json = "http://www.zorba-xquery.com/modules/converters/json";
-import schema namespace html-options="http://www.zorba-xquery.com/modules/converters/json-options";
-
-json:parse(('{"mdash": "–"}'),<options xmlns="http://www.zorba-xquery.com/modules/converters/json-options" >
- <json-param name="mapping" value="simple-json" />
- </options>)
\ No newline at end of file
=== removed file 'test_json/Queries/converters/jansson/parse_json_04.spec'
--- test_json/Queries/converters/jansson/parse_json_04.spec 2011-08-18 22:09:48 +0000
+++ test_json/Queries/converters/jansson/parse_json_04.spec 1970-01-01 00:00:00 +0000
@@ -1,1 +0,0 @@
-Error: http://www.zorba-xquery.com/modules/converters/json:ParseError
=== removed file 'test_json/Queries/converters/jansson/parse_json_04.xq'
--- test_json/Queries/converters/jansson/parse_json_04.xq 2011-08-07 21:55:48 +0000
+++ test_json/Queries/converters/jansson/parse_json_04.xq 1970-01-01 00:00:00 +0000
@@ -1,8 +0,0 @@
-(: try parsing an empty value :)
-
-import module namespace json = "http://www.zorba-xquery.com/modules/converters/json";
-import schema namespace html-options="http://www.zorba-xquery.com/modules/converters/json-options";
-
-json:parse((<a/>),<options xmlns="http://www.zorba-xquery.com/modules/converters/json-options" >
- <json-param name="mapping" value="simple-json" />
- </options>)
\ No newline at end of file
=== removed file 'test_json/Queries/converters/jansson/parse_json_05.spec'
--- test_json/Queries/converters/jansson/parse_json_05.spec 2011-08-18 22:09:48 +0000
+++ test_json/Queries/converters/jansson/parse_json_05.spec 1970-01-01 00:00:00 +0000
@@ -1,1 +0,0 @@
-Error: http://www.zorba-xquery.com/modules/converters/json:ParseError
=== removed file 'test_json/Queries/converters/jansson/parse_json_05.xq'
--- test_json/Queries/converters/jansson/parse_json_05.xq 2011-08-07 21:55:48 +0000
+++ test_json/Queries/converters/jansson/parse_json_05.xq 1970-01-01 00:00:00 +0000
@@ -1,14 +0,0 @@
-import module namespace json = "http://www.zorba-xquery.com/modules/converters/json";
-import schema namespace html-options="http://www.zorba-xquery.com/modules/converters/json-options";
-
-json:parse(('[ "ul",
- [ "li",
- true],
- [ "li",
- {"href":"driving.html", "title":"Driving"},
- "Second item"],
- [ "li", null],
- [ "li", -14e12]
-'),<options xmlns="http://www.zorba-xquery.com/modules/converters/json-options" >
- <json-param name="mapping" value="simple-json" />
- </options>)
=== removed file 'test_json/Queries/converters/jansson/parse_json_06.xq'
--- test_json/Queries/converters/jansson/parse_json_06.xq 2011-08-07 21:55:48 +0000
+++ test_json/Queries/converters/jansson/parse_json_06.xq 1970-01-01 00:00:00 +0000
@@ -1,8 +0,0 @@
-(: json:parse with uncommon characters :)
-
-import module namespace json = "http://www.zorba-xquery.com/modules/converters/json";
-import schema namespace html-options="http://www.zorba-xquery.com/modules/converters/json-options";
-
-json:parse('{ "web-app": "!_\"-\\?*.$+" }',<options xmlns="http://www.zorba-xquery.com/modules/converters/json-options" >
- <json-param name="mapping" value="simple-json" />
- </options>)
=== removed file 'test_json/Queries/converters/jansson/parse_json_07.spec'
--- test_json/Queries/converters/jansson/parse_json_07.spec 2011-05-31 15:21:09 +0000
+++ test_json/Queries/converters/jansson/parse_json_07.spec 1970-01-01 00:00:00 +0000
@@ -1,1 +0,0 @@
-Comparison: Ignore
\ No newline at end of file
=== removed file 'test_json/Queries/converters/jansson/parse_json_07.xq'
--- test_json/Queries/converters/jansson/parse_json_07.xq 2011-08-07 21:55:48 +0000
+++ test_json/Queries/converters/jansson/parse_json_07.xq 1970-01-01 00:00:00 +0000
@@ -1,13 +0,0 @@
-(: json:parse testing numbers and decimals :)
-
-import module namespace json = "http://www.zorba-xquery.com/modules/converters/json";
-import schema namespace html-options="http://www.zorba-xquery.com/modules/converters/json-options";
-
-json:parse('{ "special-numbers": {
- "decimal": 2.89,
- "e": 2E+6,
- "negative": -1.89
- }
- }',<options xmlns="http://www.zorba-xquery.com/modules/converters/json-options" >
- <json-param name="mapping" value="simple-json" />
- </options>)
=== removed file 'test_json/Queries/converters/jansson/parse_json_08.xq'
--- test_json/Queries/converters/jansson/parse_json_08.xq 2011-08-07 21:55:48 +0000
+++ test_json/Queries/converters/jansson/parse_json_08.xq 1970-01-01 00:00:00 +0000
@@ -1,8 +0,0 @@
-(: json:parse testing null handling :)
-
-import module namespace json = "http://www.zorba-xquery.com/modules/converters/json";
-import schema namespace html-options="http://www.zorba-xquery.com/modules/converters/json-options";
-
-json:parse('{ "web-app": null }',<options xmlns="http://www.zorba-xquery.com/modules/converters/json-options" >
- <json-param name="mapping" value="simple-json" />
- </options>)
=== removed file 'test_json/Queries/converters/jansson/parse_json_09.spec'
--- test_json/Queries/converters/jansson/parse_json_09.spec 2011-05-31 15:21:09 +0000
+++ test_json/Queries/converters/jansson/parse_json_09.spec 1970-01-01 00:00:00 +0000
@@ -1,1 +0,0 @@
-Comparison: Ignore
\ No newline at end of file
=== removed file 'test_json/Queries/converters/jansson/parse_json_09.xq'
--- test_json/Queries/converters/jansson/parse_json_09.xq 2011-08-07 21:55:48 +0000
+++ test_json/Queries/converters/jansson/parse_json_09.xq 1970-01-01 00:00:00 +0000
@@ -1,26 +0,0 @@
-import module namespace json = "http://www.zorba-xquery.com/modules/converters/json";
-import schema namespace html-options="http://www.zorba-xquery.com/modules/converters/json-options";
-
-json:parse('{
- "firstName": "John",
- "state": null,
- "bool": true ,
- "numbers": [1,2,3] ,
- "address": {
- "streetAddress": "21 2nd Street",
- "state": null,
- "postalCode": 10021 ,
- "literals": [true,false,null],
- "delivery": {
- "streetAddress": "StreetName",
- "city": "CityName",
- "state": "StateName"
- }} ,
- "strings": [
- "one",
- "two",
- "three",
- "four" ]
-}',<options xmlns="http://www.zorba-xquery.com/modules/converters/json-options" >
- <json-param name="mapping" value="simple-json" />
- </options>)
=== removed file 'test_json/Queries/converters/jansson/parse_json_10.spec'
--- test_json/Queries/converters/jansson/parse_json_10.spec 2011-05-31 15:21:09 +0000
+++ test_json/Queries/converters/jansson/parse_json_10.spec 1970-01-01 00:00:00 +0000
@@ -1,1 +0,0 @@
-Comparison: Ignore
\ No newline at end of file
=== removed file 'test_json/Queries/converters/jansson/parse_json_10.xq'
--- test_json/Queries/converters/jansson/parse_json_10.xq 2011-08-07 21:55:48 +0000
+++ test_json/Queries/converters/jansson/parse_json_10.xq 1970-01-01 00:00:00 +0000
@@ -1,40 +0,0 @@
-import module namespace json = "http://www.zorba-xquery.com/modules/converters/json";
-import schema namespace html-options="http://www.zorba-xquery.com/modules/converters/json-options";
-
-json:parse('[{
- "firstName": "John",
- "lastName": "Smith",
- "address": {
- "streetAddress": "21 2nd Street",
- "city": "New York",
- "state": "NY",
- "postalCode": 10021
- },
- "phoneNumbers": [
- "212 732-1234",
- "646 123-4567"
- ]
- },
-{
- "firstName": "John",
- "state": null,
- "bool": true ,
- "numbers": [1,2,3] ,
- "address": {
- "streetAddress": "21 2nd Street",
- "state": null,
- "postalCode": 10021 ,
- "literals": [true,false,null],
- "delivery": {
- "streetAddress": "StreetName",
- "city": "CityName",
- "state": "StateName"
- }} ,
- "strings": [
- "one",
- "two",
- "three",
- "four" ]
-}]',<options xmlns="http://www.zorba-xquery.com/modules/converters/json-options" >
- <json-param name="mapping" value="simple-json" />
- </options>)
=== removed file 'test_json/Queries/converters/jansson/parse_json_11.spec'
--- test_json/Queries/converters/jansson/parse_json_11.spec 2011-05-31 15:21:09 +0000
+++ test_json/Queries/converters/jansson/parse_json_11.spec 1970-01-01 00:00:00 +0000
@@ -1,1 +0,0 @@
-Comparison: Ignore
\ No newline at end of file
=== removed file 'test_json/Queries/converters/jansson/parse_json_11.xq'
--- test_json/Queries/converters/jansson/parse_json_11.xq 2011-10-06 07:40:17 +0000
+++ test_json/Queries/converters/jansson/parse_json_11.xq 1970-01-01 00:00:00 +0000
@@ -1,20 +0,0 @@
-(: the comparison method for this test is set to Ignore because the order in which the children
-are returned in jansson 1.2, 1.3, 2.0 is different:)
-
-import module namespace json = "http://www.zorba-xquery.com/modules/converters/json";
-import schema namespace html-options="http://www.zorba-xquery.com/modules/converters/json-options";
-
-json:parse(('{
- "firstName": "John",
- "lastName": "Smith",
- "address": {
- "streetAddress": "21 2nd Street",
- "city": "New York",
- "state": "NY",
- "postalCode": 10021
- },
- "phoneNumbers": [
- "212 732-1234",
- "646 123-4567"
- ]
- }'))
=== removed file 'test_json/Queries/converters/jansson/parse_json_12.xq'
--- test_json/Queries/converters/jansson/parse_json_12.xq 2011-12-06 14:20:24 +0000
+++ test_json/Queries/converters/jansson/parse_json_12.xq 1970-01-01 00:00:00 +0000
@@ -1,4 +0,0 @@
-import module namespace json="http://www.zorba-xquery.com/modules/converters/json";
-declare variable $json-value := '{"html":"<b>bold</b>"}';
-
-json:serialize(json:parse($json-value))
=== removed file 'test_json/Queries/converters/jansson/parse_json_ml_01.xq'
--- test_json/Queries/converters/jansson/parse_json_ml_01.xq 2011-08-11 20:09:07 +0000
+++ test_json/Queries/converters/jansson/parse_json_ml_01.xq 1970-01-01 00:00:00 +0000
@@ -1,27 +0,0 @@
-import module namespace json = "http://www.zorba-xquery.com/modules/converters/json";
-import schema namespace html-options="http://www.zorba-xquery.com/modules/converters/json-options";
-
-json:parse(('
-["ul",
- ["li",
- { "style" : "color:red" },
- "First Item"
- ],
- ["li",
- {
- "title" : "Some hover text.",
- "style" : "color:green"
- },
- "Second Item"
- ],
- ["li",
- ["span",
- { "class" : "code-example-third" },
- "Third"
- ],
- " Item"
- ]
-]'),<options xmlns="http://www.zorba-xquery.com/modules/converters/json-options"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <json-param name="mapping" value="json-ml" type="array"/>
- </options>)
\ No newline at end of file
=== removed file 'test_json/Queries/converters/jansson/parse_json_ml_02.xq'
--- test_json/Queries/converters/jansson/parse_json_ml_02.xq 2011-08-11 20:09:07 +0000
+++ test_json/Queries/converters/jansson/parse_json_ml_02.xq 1970-01-01 00:00:00 +0000
@@ -1,65 +0,0 @@
-import module namespace json = "http://www.zorba-xquery.com/modules/converters/json";
-import schema namespace html-options="http://www.zorba-xquery.com/modules/converters/json-options";
-
-json:parse(('
-["table",
-{
-"class" : "MyTable",
-"style" : "background-color:yellow"
-},
-["tr",
-["td",
-{
-"class" : "MyTD",
-"style" : "border:1px solid black"
-},
-"#550758"
-],
-["td",
-{
-"class" : "MyTD",
-"style" : "background-color:red"
-},
-"Example text here"
-]
-],
-["tr",
-["td",
-{
-"class" : "MyTD",
-"style" : "border:1px solid black"
-},
-"#993101"
-],
-["td",
-{
-"class" : "MyTD",
-"style" : "background-color:green"
-},
-"127624015"
-]
-],
-["tr",
-["td",
-{
-"class" : "MyTD",
-"style" : "border:1px solid black"
-},
-"#E33D87"
-],
-["td",
-{
-"class" : "MyTD",
-"style" : "background-color:blue"
-},
-"\u00A0",
-["span",
-{ "style" : "background-color:maroon" },
-"\u00A9"
-],
-"\u00A0"
-]
-]
-]'),<options xmlns="http://www.zorba-xquery.com/modules/converters/json-options" >
- <json-param name="mapping" value="json-ml" type="array"/>
- </options>)
=== removed file 'test_json/Queries/converters/jansson/parse_json_ml_03.spec'
--- test_json/Queries/converters/jansson/parse_json_ml_03.spec 2011-08-18 22:09:48 +0000
+++ test_json/Queries/converters/jansson/parse_json_ml_03.spec 1970-01-01 00:00:00 +0000
@@ -1,1 +0,0 @@
-Error: http://www.zorba-xquery.com/modules/converters/json:ParseError
=== removed file 'test_json/Queries/converters/jansson/parse_json_ml_03.xq'
--- test_json/Queries/converters/jansson/parse_json_ml_03.xq 2011-08-11 20:09:07 +0000
+++ test_json/Queries/converters/jansson/parse_json_ml_03.xq 1970-01-01 00:00:00 +0000
@@ -1,8 +0,0 @@
-(: jsonml:parse with empty parameter :)
-
-import module namespace json = "http://www.zorba-xquery.com/modules/converters/json";
-import schema namespace html-options="http://www.zorba-xquery.com/modules/converters/json-options";
-
-json:parse(<a/>,<options xmlns="http://www.zorba-xquery.com/modules/converters/json-options" >
- <json-param name="mapping" value="json-ml" type="array"/>
- </options>)
=== removed file 'test_json/Queries/converters/jansson/parse_json_ml_04.spec'
--- test_json/Queries/converters/jansson/parse_json_ml_04.spec 2011-08-18 22:09:48 +0000
+++ test_json/Queries/converters/jansson/parse_json_ml_04.spec 1970-01-01 00:00:00 +0000
@@ -1,1 +0,0 @@
-Error: http://www.zorba-xquery.com/modules/converters/json:ParseError
=== removed file 'test_json/Queries/converters/jansson/parse_json_ml_04.xq'
--- test_json/Queries/converters/jansson/parse_json_ml_04.xq 2011-08-11 20:09:07 +0000
+++ test_json/Queries/converters/jansson/parse_json_ml_04.xq 1970-01-01 00:00:00 +0000
@@ -1,16 +0,0 @@
-(: jsonml:parse with invalid parameter :)
-
-import module namespace json = "http://www.zorba-xquery.com/modules/converters/json";
-import schema namespace html-options="http://www.zorba-xquery.com/modules/converters/json-options";
-
-json:parse(('{
- "firstName": "John",
- "lastName": "Smith",
- "address": {
- "streetAddress": "21 2nd Street",
- "city": "New York",
- "state": "NY",
- "postalCode": 10021
- }'),<options xmlns="http://www.zorba-xquery.com/modules/converters/json-options" >
- <json-param name="mapping" value="json-ml" type="array"/>
- </options>)
=== removed file 'test_json/Queries/converters/jansson/parse_json_ml_05.xq'
--- test_json/Queries/converters/jansson/parse_json_ml_05.xq 2011-10-06 07:40:17 +0000
+++ test_json/Queries/converters/jansson/parse_json_ml_05.xq 1970-01-01 00:00:00 +0000
@@ -1,24 +0,0 @@
-import module namespace json = "http://www.zorba-xquery.com/modules/converters/json";
-import schema namespace html-options="http://www.zorba-xquery.com/modules/converters/json-options";
-
-json:parse-ml(('
-["ul",
- ["li",
- { "style" : "color:red" },
- "First Item"
- ],
- ["li",
- {
- "title" : "Some hover text.",
- "style" : "color:green"
- },
- "Second Item"
- ],
- ["li",
- ["span",
- { "class" : "code-example-third" },
- "Third"
- ],
- " Item"
- ]
-]'))
\ No newline at end of file
=== removed file 'test_json/Queries/converters/jansson/parse_json_ml_06.xq'
--- test_json/Queries/converters/jansson/parse_json_ml_06.xq 2011-12-06 14:20:24 +0000
+++ test_json/Queries/converters/jansson/parse_json_ml_06.xq 1970-01-01 00:00:00 +0000
@@ -1,7 +0,0 @@
-import module namespace json = "http://www.zorba-xquery.com/modules/converters/json";
-import schema namespace html-options="http://www.zorba-xquery.com/modules/converters/json-options";
-
-json:parse('["html" ,"<b>bold</b>"]',<options xmlns="http://www.zorba-xquery.com/modules/converters/json-options"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <json-param name="mapping" value="json-ml" type="array"/>
- </options>)
=== removed file 'test_json/Queries/converters/jansson/serialize_json_01.xq'
--- test_json/Queries/converters/jansson/serialize_json_01.xq 2011-08-11 20:09:07 +0000
+++ test_json/Queries/converters/jansson/serialize_json_01.xq 1970-01-01 00:00:00 +0000
@@ -1,9 +0,0 @@
-import module namespace json = "http://www.zorba-xquery.com/modules/converters/json";
-import schema namespace html-options="http://www.zorba-xquery.com/modules/converters/json-options";
-
-
-declare variable $tmp := <json type="object"><pair name="phoneNumbers" type="array"><item type="string">212 732-1234</item><item type="string">646 123-4567</item></pair><pair name="firstName" type="string">John</pair><pair name="lastName" type="string">Smith</pair><pair name="address" type="object"><pair name="postalCode" type="number">10021</pair><pair name="city" type="string">New York</pair><pair name="streetAddress" type="string">21 2nd Street</pair><pair name="state" type="string">NY</pair></pair></json>;
-
-json:serialize($tmp,<options xmlns="http://www.zorba-xquery.com/modules/converters/json-options" >
- <json-param name="mapping" value="simple-json" type="array"/>
- </options>)
\ No newline at end of file
=== removed file 'test_json/Queries/converters/jansson/serialize_json_02.xq'
--- test_json/Queries/converters/jansson/serialize_json_02.xq 2011-08-11 20:09:07 +0000
+++ test_json/Queries/converters/jansson/serialize_json_02.xq 1970-01-01 00:00:00 +0000
@@ -1,8 +0,0 @@
-import module namespace json = "http://www.zorba-xquery.com/modules/converters/json";
-import schema namespace html-options="http://www.zorba-xquery.com/modules/converters/json-options";
-
-declare variable $tmp := <json type="array"><pair type="object"><pair name="phoneNumbers" type="array"><item type="string">212 732-1234</item><item type="string">646 123-4567</item></pair><pair name="firstName" type="string">John</pair><pair name="lastName" type="string">Smith</pair><pair name="address" type="object"><pair name="postalCode" type="number">10021</pair><pair name="city" type="string">New York</pair><pair name="streetAddress" type="string">21 2nd Street</pair><pair name="state" type="string">NY</pair></pair></pair><pair type="object"><pair name="phoneNumbers" type="array"><item type="string">212 732-1234</item><item type="string">646 123-4567</item></pair><pair name="firstName" type="string">John</pair><pair name="lastName" type="string">Smith</pair><pair name="address" type="object"><pair name="postalCode" type="number">10021</pair><pair name="city" type="string">New York</pair><pair name="streetAddress" type="string">21 2nd Street</pair><pair name="state" type="string">NY</pair></pair></pair></json>;
-
-json:serialize($tmp,<options xmlns="http://www.zorba-xquery.com/modules/converters/json-options" >
- <json-param name="mapping" value="simple-json" type="array"/>
- </options>)
\ No newline at end of file
=== removed file 'test_json/Queries/converters/jansson/serialize_json_03.spec'
--- test_json/Queries/converters/jansson/serialize_json_03.spec 2011-08-18 22:09:48 +0000
+++ test_json/Queries/converters/jansson/serialize_json_03.spec 1970-01-01 00:00:00 +0000
@@ -1,1 +0,0 @@
-Error: http://www.zorba-xquery.com/modules/converters/json:InvalidXDM
=== removed file 'test_json/Queries/converters/jansson/serialize_json_03.xq'
--- test_json/Queries/converters/jansson/serialize_json_03.xq 2011-08-11 20:09:07 +0000
+++ test_json/Queries/converters/jansson/serialize_json_03.xq 1970-01-01 00:00:00 +0000
@@ -1,8 +0,0 @@
-(: json:serialize called with wrong parameter: comment node:)
-
-import module namespace json = "http://www.zorba-xquery.com/modules/converters/json";
-import schema namespace html-options="http://www.zorba-xquery.com/modules/converters/json-options";
-
-json:serialize((<!--comment-->),<options xmlns="http://www.zorba-xquery.com/modules/converters/json-options" >
- <json-param name="mapping" value="simple-json" type="array"/>
- </options>)
=== removed file 'test_json/Queries/converters/jansson/serialize_json_04.xq'
--- test_json/Queries/converters/jansson/serialize_json_04.xq 2011-08-07 21:55:48 +0000
+++ test_json/Queries/converters/jansson/serialize_json_04.xq 1970-01-01 00:00:00 +0000
@@ -1,10 +0,0 @@
-(: json:serialize test escaping of double quotes :)
-
-import module namespace json = "http://www.zorba-xquery.com/modules/converters/json";
-import schema namespace html-options="http://www.zorba-xquery.com/modules/converters/json-options";
-
-json:serialize((<json type="object">
- <pair name="firstName" type="string">\"</pair>
- </json>),<options xmlns="http://www.zorba-xquery.com/modules/converters/json-options" >
- <json-param name="mapping" value="simple-json" />
- </options>)
=== removed file 'test_json/Queries/converters/jansson/serialize_json_05.xq'
--- test_json/Queries/converters/jansson/serialize_json_05.xq 2011-08-07 21:55:48 +0000
+++ test_json/Queries/converters/jansson/serialize_json_05.xq 1970-01-01 00:00:00 +0000
@@ -1,10 +0,0 @@
-(: json:serialize some pitfall characters :)
-
-import module namespace json = "http://www.zorba-xquery.com/modules/converters/json";
-import schema namespace html-options="http://www.zorba-xquery.com/modules/converters/json-options";
-
-json:serialize((<json type="object">
- <pair name="name" type="string">\"\\\/\b\f\n\r\t</pair>
- </json>),<options xmlns="http://www.zorba-xquery.com/modules/converters/json-options" >
- <json-param name="mapping" value="simple-json" />
- </options>)
=== removed file 'test_json/Queries/converters/jansson/serialize_json_06.spec'
--- test_json/Queries/converters/jansson/serialize_json_06.spec 2011-08-18 22:09:48 +0000
+++ test_json/Queries/converters/jansson/serialize_json_06.spec 1970-01-01 00:00:00 +0000
@@ -1,1 +0,0 @@
-Error: http://www.zorba-xquery.com/modules/converters/json:InvalidXDM
=== removed file 'test_json/Queries/converters/jansson/serialize_json_06.xq'
--- test_json/Queries/converters/jansson/serialize_json_06.xq 2011-08-07 21:55:48 +0000
+++ test_json/Queries/converters/jansson/serialize_json_06.xq 1970-01-01 00:00:00 +0000
@@ -1,10 +0,0 @@
-(: type value missing :)
-
-import module namespace json = "http://www.zorba-xquery.com/modules/converters/json";
-import schema namespace html-options="http://www.zorba-xquery.com/modules/converters/json-options";
-
-json:serialize((<json type="object">
- <pair name="name" type="">value</pair>
- </json>),<options xmlns="http://www.zorba-xquery.com/modules/converters/json-options" >
- <json-param name="mapping" value="simple-json" />
- </options>)
=== removed file 'test_json/Queries/converters/jansson/serialize_json_07.spec'
--- test_json/Queries/converters/jansson/serialize_json_07.spec 2011-08-18 22:09:48 +0000
+++ test_json/Queries/converters/jansson/serialize_json_07.spec 1970-01-01 00:00:00 +0000
@@ -1,1 +0,0 @@
-Error: http://www.zorba-xquery.com/modules/converters/json:InvalidXDM
=== removed file 'test_json/Queries/converters/jansson/serialize_json_07.xq'
--- test_json/Queries/converters/jansson/serialize_json_07.xq 2011-08-07 21:55:48 +0000
+++ test_json/Queries/converters/jansson/serialize_json_07.xq 1970-01-01 00:00:00 +0000
@@ -1,10 +0,0 @@
-(: type value wrong :)
-
-import module namespace json = "http://www.zorba-xquery.com/modules/converters/json";
-import schema namespace html-options="http://www.zorba-xquery.com/modules/converters/json-options";
-
-json:serialize((<json type="object">
- <pair name="name" type="huhu">value</pair>
- </json>),<options xmlns="http://www.zorba-xquery.com/modules/converters/json-options" >
- <json-param name="mapping" value="simple-json" />
- </options>)
=== removed file 'test_json/Queries/converters/jansson/serialize_json_08.spec'
--- test_json/Queries/converters/jansson/serialize_json_08.spec 2011-08-18 22:09:48 +0000
+++ test_json/Queries/converters/jansson/serialize_json_08.spec 1970-01-01 00:00:00 +0000
@@ -1,1 +0,0 @@
-Error: http://www.zorba-xquery.com/modules/converters/json:InvalidXDM
=== removed file 'test_json/Queries/converters/jansson/serialize_json_08.xq'
--- test_json/Queries/converters/jansson/serialize_json_08.xq 2011-08-07 21:55:48 +0000
+++ test_json/Queries/converters/jansson/serialize_json_08.xq 1970-01-01 00:00:00 +0000
@@ -1,12 +0,0 @@
-(: wrong value for array :)
-
-import module namespace json = "http://www.zorba-xquery.com/modules/converters/json";
-import schema namespace html-options="http://www.zorba-xquery.com/modules/converters/json-options";
-
-json:serialize((<json type="object">
- <pair name="name" type="array">
- <pair name="wrong" type="string">value</pair>
- </pair>
- </json>),<options xmlns="http://www.zorba-xquery.com/modules/converters/json-options" >
- <json-param name="mapping" value="simple-json" />
- </options>)
=== removed file 'test_json/Queries/converters/jansson/serialize_json_09.xq'
--- test_json/Queries/converters/jansson/serialize_json_09.xq 2011-08-07 21:55:48 +0000
+++ test_json/Queries/converters/jansson/serialize_json_09.xq 1970-01-01 00:00:00 +0000
@@ -1,15 +0,0 @@
-(: valid json generation: array in an array :)
-
-import module namespace json = "http://www.zorba-xquery.com/modules/converters/json";
-import schema namespace html-options="http://www.zorba-xquery.com/modules/converters/json-options";
-
-json:serialize((<json type="object">
- <pair name="servlet" type="array">
- <item type="array">
- <item type="string">value1</item>
- </item>
- <item type="string">value2</item>
- </pair>
- </json>),<options xmlns="http://www.zorba-xquery.com/modules/converters/json-options" >
- <json-param name="mapping" value="simple-json" />
- </options>)
=== removed file 'test_json/Queries/converters/jansson/serialize_json_10.spec'
--- test_json/Queries/converters/jansson/serialize_json_10.spec 2011-05-31 15:21:09 +0000
+++ test_json/Queries/converters/jansson/serialize_json_10.spec 1970-01-01 00:00:00 +0000
@@ -1,1 +0,0 @@
-Comparison: Ignore
\ No newline at end of file
=== removed file 'test_json/Queries/converters/jansson/serialize_json_10.xq'
--- test_json/Queries/converters/jansson/serialize_json_10.xq 2011-08-07 21:55:48 +0000
+++ test_json/Queries/converters/jansson/serialize_json_10.xq 1970-01-01 00:00:00 +0000
@@ -1,15 +0,0 @@
-(: object contained in an array is allowed :)
-
-import module namespace json = "http://www.zorba-xquery.com/modules/converters/json";
-import schema namespace html-options="http://www.zorba-xquery.com/modules/converters/json-options";
-
-json:serialize((<json type="object">
- <pair name="servlet" type="array">
- <item type="object">
- <pair name="name" type="string">value1</pair>
- </item>
- <item type="string">value2</item>
- </pair>
- </json>),<options xmlns="http://www.zorba-xquery.com/modules/converters/json-options" >
- <json-param name="mapping" value="simple-json" />
- </options>)
=== removed file 'test_json/Queries/converters/jansson/serialize_json_11.spec'
--- test_json/Queries/converters/jansson/serialize_json_11.spec 2011-08-18 22:09:48 +0000
+++ test_json/Queries/converters/jansson/serialize_json_11.spec 1970-01-01 00:00:00 +0000
@@ -1,1 +0,0 @@
-Error: http://www.zorba-xquery.com/modules/converters/json:InvalidXDM
=== removed file 'test_json/Queries/converters/jansson/serialize_json_11.xq'
--- test_json/Queries/converters/jansson/serialize_json_11.xq 2011-08-07 21:55:48 +0000
+++ test_json/Queries/converters/jansson/serialize_json_11.xq 1970-01-01 00:00:00 +0000
@@ -1,10 +0,0 @@
-(: type attribute missing :)
-
-import module namespace json = "http://www.zorba-xquery.com/modules/converters/json";
-import schema namespace html-options="http://www.zorba-xquery.com/modules/converters/json-options";
-
-json:serialize((<json type="object">
- <pair name="name">value</pair>
- </json>),<options xmlns="http://www.zorba-xquery.com/modules/converters/json-options" >
- <json-param name="mapping" value="simple-json" />
- </options>)
=== removed file 'test_json/Queries/converters/jansson/serialize_json_12.spec'
--- test_json/Queries/converters/jansson/serialize_json_12.spec 2011-08-18 22:09:48 +0000
+++ test_json/Queries/converters/jansson/serialize_json_12.spec 1970-01-01 00:00:00 +0000
@@ -1,1 +0,0 @@
-Error: http://www.zorba-xquery.com/modules/converters/json:InvalidXDM
=== removed file 'test_json/Queries/converters/jansson/serialize_json_12.xq'
--- test_json/Queries/converters/jansson/serialize_json_12.xq 2011-08-07 21:55:48 +0000
+++ test_json/Queries/converters/jansson/serialize_json_12.xq 1970-01-01 00:00:00 +0000
@@ -1,10 +0,0 @@
-(: name attribute missing :)
-
-import module namespace json = "http://www.zorba-xquery.com/modules/converters/json";
-import schema namespace html-options="http://www.zorba-xquery.com/modules/converters/json-options";
-
-json:serialize((<json type="object">
- <pair type="string">value</pair>
- </json>),<options xmlns="http://www.zorba-xquery.com/modules/converters/json-options" >
- <json-param name="mapping" value="simple-json" />
- </options>)
=== removed file 'test_json/Queries/converters/jansson/serialize_json_13.xq'
--- test_json/Queries/converters/jansson/serialize_json_13.xq 2011-08-07 21:55:48 +0000
+++ test_json/Queries/converters/jansson/serialize_json_13.xq 1970-01-01 00:00:00 +0000
@@ -1,16 +0,0 @@
-(: valid json generation: comments should be ignored :)
-
-import module namespace json = "http://www.zorba-xquery.com/modules/converters/json";
-import schema namespace html-options="http://www.zorba-xquery.com/modules/converters/json-options";
-
-declare variable $local:json :=
- <json type="object">
- <pair name="servlet" type="array">
- <!--comment-->
- <item type="string">value</item>
- </pair>
- </json>;
-
-json:serialize($local:json,<options xmlns="http://www.zorba-xquery.com/modules/converters/json-options" >
- <json-param name="mapping" value="simple-json" />
- </options>)
=== removed file 'test_json/Queries/converters/jansson/serialize_json_14.xq'
--- test_json/Queries/converters/jansson/serialize_json_14.xq 2011-08-07 21:55:48 +0000
+++ test_json/Queries/converters/jansson/serialize_json_14.xq 1970-01-01 00:00:00 +0000
@@ -1,16 +0,0 @@
-(: valid json generation: comments should be ignored :)
-
-import module namespace json = "http://www.zorba-xquery.com/modules/converters/json";
-import schema namespace html-options="http://www.zorba-xquery.com/modules/converters/json-options";
-
-declare variable $local:json :=
- <json type="object">
- <pair name="servlet" type="object">
- <!--comment-->
- <pair name="name" type="string">value</pair>
- </pair>
- </json>;
-
-json:serialize($local:json,<options xmlns="http://www.zorba-xquery.com/modules/converters/json-options" >
- <json-param name="mapping" value="simple-json" />
- </options>)
=== removed file 'test_json/Queries/converters/jansson/serialize_json_15.xq'
--- test_json/Queries/converters/jansson/serialize_json_15.xq 2011-08-07 21:55:48 +0000
+++ test_json/Queries/converters/jansson/serialize_json_15.xq 1970-01-01 00:00:00 +0000
@@ -1,13 +0,0 @@
-import module namespace json = "http://www.zorba-xquery.com/modules/converters/json";
-import schema namespace html-options="http://www.zorba-xquery.com/modules/converters/json-options";
-
-declare variable $local:json :=<json type="object">
- <pair name="servlet" type="array">
- <item type="object">
- </item>
- </pair>
-</json>;
-
-json:serialize($local:json,<options xmlns="http://www.zorba-xquery.com/modules/converters/json-options" >
- <json-param name="mapping" value="simple-json" />
- </options>)
=== removed file 'test_json/Queries/converters/jansson/serialize_json_16.xq'
--- test_json/Queries/converters/jansson/serialize_json_16.xq 2011-08-07 21:55:48 +0000
+++ test_json/Queries/converters/jansson/serialize_json_16.xq 1970-01-01 00:00:00 +0000
@@ -1,14 +0,0 @@
-import module namespace json = "http://www.zorba-xquery.com/modules/converters/json";
-import schema namespace html-options="http://www.zorba-xquery.com/modules/converters/json-options";
-
-declare variable $local:json :=<json type="object">
- <pair name="servlet" type="array">
- <item type="array">
- <item type='string'>212 732-1234</item>
- </item>
- </pair>
-</json>;
-
-json:serialize($local:json,<options xmlns="http://www.zorba-xquery.com/modules/converters/json-options" >
- <json-param name="mapping" value="simple-json" />
- </options>)
=== removed file 'test_json/Queries/converters/jansson/serialize_json_17.spec'
--- test_json/Queries/converters/jansson/serialize_json_17.spec 2011-05-31 15:21:09 +0000
+++ test_json/Queries/converters/jansson/serialize_json_17.spec 1970-01-01 00:00:00 +0000
@@ -1,1 +0,0 @@
-Comparison: Ignore
\ No newline at end of file
=== removed file 'test_json/Queries/converters/jansson/serialize_json_17.xq'
--- test_json/Queries/converters/jansson/serialize_json_17.xq 2011-08-07 21:55:48 +0000
+++ test_json/Queries/converters/jansson/serialize_json_17.xq 1970-01-01 00:00:00 +0000
@@ -1,23 +0,0 @@
-import module namespace json = "http://www.zorba-xquery.com/modules/converters/json";
-import schema namespace html-options="http://www.zorba-xquery.com/modules/converters/json-options";
-
-
-declare variable $local:json :=
- '{ "special-chars": {
- "quote": "\"",
- "backslash": "\\",
- "backspace": "\b",
- "formfeed": "\f",
- "newline": "\n",
- "carriage return": "\r",
- "horizontal tab": "\t",
- "solidus": "\/"
- }
- }';
-
-json:serialize((json:parse(($local:json),<options xmlns="http://www.zorba-xquery.com/modules/converters/json-options" >
- <json-param name="mapping" value="simple-json" />
- </options>)),<options xmlns="http://www.zorba-xquery.com/modules/converters/json-options" >
- <json-param name="mapping" value="simple-json" />
- </options>)
-
=== removed file 'test_json/Queries/converters/jansson/serialize_json_18.xq'
--- test_json/Queries/converters/jansson/serialize_json_18.xq 2011-10-06 07:40:17 +0000
+++ test_json/Queries/converters/jansson/serialize_json_18.xq 1970-01-01 00:00:00 +0000
@@ -1,7 +0,0 @@
-import module namespace json = "http://www.zorba-xquery.com/modules/converters/json";
-import schema namespace html-options="http://www.zorba-xquery.com/modules/converters/json-options";
-
-
-declare variable $tmp := <json type="object"><pair name="phoneNumbers" type="array"><item type="string">212 732-1234</item><item type="string">646 123-4567</item></pair><pair name="firstName" type="string">John</pair><pair name="lastName" type="string">Smith</pair><pair name="address" type="object"><pair name="postalCode" type="number">10021</pair><pair name="city" type="string">New York</pair><pair name="streetAddress" type="string">21 2nd Street</pair><pair name="state" type="string">NY</pair></pair></json>;
-
-json:serialize($tmp)
\ No newline at end of file
=== removed file 'test_json/Queries/converters/jansson/serialize_json_ml_01.xq'
--- test_json/Queries/converters/jansson/serialize_json_ml_01.xq 2011-08-11 20:09:07 +0000
+++ test_json/Queries/converters/jansson/serialize_json_ml_01.xq 1970-01-01 00:00:00 +0000
@@ -1,12 +0,0 @@
-import module namespace json = "http://www.zorba-xquery.com/modules/converters/json";
-import schema namespace html-options="http://www.zorba-xquery.com/modules/converters/json-options";
-
-declare variable $tmp :=<ul>
- <li style="color:red">First Item</li>
- <li title="Some hover text." style="color:green">Second Item</li>
- <li><span class="code-example-third">Third</span>Item</li>
-</ul>;
-
-json:serialize($tmp,<options xmlns="http://www.zorba-xquery.com/modules/converters/json-options" >
- <json-param name="mapping" value="json-ml" type="array"/>
- </options>)
\ No newline at end of file
=== removed file 'test_json/Queries/converters/jansson/serialize_json_ml_02.xq'
--- test_json/Queries/converters/jansson/serialize_json_ml_02.xq 2011-08-11 20:09:07 +0000
+++ test_json/Queries/converters/jansson/serialize_json_ml_02.xq 1970-01-01 00:00:00 +0000
@@ -1,21 +0,0 @@
-import module namespace json = "http://www.zorba-xquery.com/modules/converters/json";
-import schema namespace html-options="http://www.zorba-xquery.com/modules/converters/json-options";
-
-declare variable $tmp :=<table class="MyTable" style="background-color:yellow">
-<tr>
-<td class="MyTD" style="border:1px solid black">#5D28D1</td>
-<td class="MyTD" style="background-color:red">Example text here</td>
-</tr>
-<tr>
-<td class="MyTD" style="border:1px solid black">#AF44EF</td>
-<td class="MyTD" style="background-color:green">127310656</td>
-</tr>
-<tr>
-<td class="MyTD" style="border:1px solid black">#AAD034</td>
-<td class="MyTD" style="background-color:blue">\u00A0<span style="background-color:maroon">\u00A9</span>\u00A0</td>
-</tr>
-</table>;
-
-json:serialize($tmp,<options xmlns="http://www.zorba-xquery.com/modules/converters/json-options" >
- <json-param name="mapping" value="json-ml" type="array"/>
- </options>)
\ No newline at end of file
=== removed file 'test_json/Queries/converters/jansson/serialize_json_ml_03.spec'
--- test_json/Queries/converters/jansson/serialize_json_ml_03.spec 2011-08-18 22:09:48 +0000
+++ test_json/Queries/converters/jansson/serialize_json_ml_03.spec 1970-01-01 00:00:00 +0000
@@ -1,1 +0,0 @@
-Error: http://www.zorba-xquery.com/modules/converters/json:InvalidXDM
=== removed file 'test_json/Queries/converters/jansson/serialize_json_ml_03.xq'
--- test_json/Queries/converters/jansson/serialize_json_ml_03.xq 2011-08-11 20:09:07 +0000
+++ test_json/Queries/converters/jansson/serialize_json_ml_03.xq 1970-01-01 00:00:00 +0000
@@ -1,8 +0,0 @@
-import module namespace json = "http://www.zorba-xquery.com/modules/converters/json";
-import schema namespace html-options="http://www.zorba-xquery.com/modules/converters/json-options";
-
-declare variable $tmp :=<!--comment-->;
-
-json:serialize($tmp,<options xmlns="http://www.zorba-xquery.com/modules/converters/json-options" >
- <json-param name="mapping" value="json-ml" type="array"/>
- </options>)
\ No newline at end of file
=== removed file 'test_json/Queries/converters/jansson/serialize_json_ml_04.xq'
--- test_json/Queries/converters/jansson/serialize_json_ml_04.xq 2011-10-06 07:40:17 +0000
+++ test_json/Queries/converters/jansson/serialize_json_ml_04.xq 1970-01-01 00:00:00 +0000
@@ -1,10 +0,0 @@
-import module namespace json = "http://www.zorba-xquery.com/modules/converters/json";
-import schema namespace html-options="http://www.zorba-xquery.com/modules/converters/json-options";
-
-declare variable $tmp :=<ul>
- <li style="color:red">First Item</li>
- <li title="Some hover text." style="color:green">Second Item</li>
- <li><span class="code-example-third">Third</span>Item</li>
-</ul>;
-
-json:serialize-ml($tmp)
\ No newline at end of file
Follow ups
-
[Merge] lp:~zorba-coders/zorba/remove_old_json into lp:zorba/data-converters-module
From: noreply, 2012-01-24
-
[Merge] lp:~zorba-coders/zorba/remove_old_json into lp:zorba/data-converters-module
From: Zorba Build Bot, 2012-01-24
-
[Merge] lp:~zorba-coders/zorba/remove_old_json into lp:zorba/data-converters-module
From: Zorba Build Bot, 2012-01-24
-
[Merge] lp:~zorba-coders/zorba/remove_old_json into lp:zorba/data-converters-module
From: Chris Hillery, 2012-01-24
-
[Merge] lp:~zorba-coders/zorba/remove_old_json into lp:zorba/data-converters-module
From: Zorba Build Bot, 2012-01-23
-
Re: [Merge] lp:~zorba-coders/zorba/remove_old_json into lp:zorba/data-converters-module
From: Zorba Build Bot, 2012-01-23
-
[Merge] lp:~zorba-coders/zorba/remove_old_json into lp:zorba/data-converters-module
From: Zorba Build Bot, 2012-01-23
-
[Merge] lp:~zorba-coders/zorba/remove_old_json into lp:zorba/data-converters-module
From: Matthias Brantner, 2012-01-23
-
Re: [Merge] lp:~zorba-coders/zorba/remove_old_json into lp:zorba/data-converters-module
From: Matthias Brantner, 2012-01-23
-
Re: [Merge] lp:~zorba-coders/zorba/remove_old_json into lp:zorba/data-converters-module
From: Paul J. Lucas, 2012-01-23