0

based on the known xml2json conversion rules :

1 - An XML element without text node

<a></a> --> {"a":""}

2 - An empty XML element1

<a/> --> {"a":null}

I expect to have different conversion from the Worklight xml parser.

Instead it seems that both scenarios are converted to empty string, never using the null value (or the empty square brackets at least).

Is this a work-as-designed approach, a limitation or a configurable behaviour?

Wakkko
  • 11
  • 6

1 Answers1

1

The behavior is configurable. You did not mention it, but I assume you are talking about XML-to-JSON conversion in Worklight adapters. When you generate a Worklight adapter, a filtered.xsl file is generated. You can and should use that .xsl file to affect the conversion.

See Overview of IBM Worklight adapters documentation and this SO question.

Community
  • 1
  • 1
mikerott
  • 423
  • 2
  • 10
  • my fault: I was effectively referencing to Worklight parser involved in the adapter transaction.
    I ignored the power of xsl transformation about testing xml.
    – Wakkko Jun 11 '14 at 09:35