staxon icon indicating copy to clipboard operation
staxon copied to clipboard

Adding xsi:nil support to JsonXMLConfigBuilder

Open iuj opened this issue 10 years ago • 2 comments

1.Adds support to process xsi:nil (defined in http://www.w3.org/TR/xmlschema-1/#xsi_nil) to be produced as a null value in XML->JSON transformation. Example: If readXmlNil(true) is set, <test xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true" ></test> will produce {"test":null} <test></test> will produce {"test":""}

2.Adds support to process null fields as xsi:nil elements during JSON->XML transformation. Example: if writeXmlNil(true) is set, {"test":null} will produce <test xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true" ></test> {"test":""} will produce <test></test>

iuj avatar Apr 02 '15 09:04 iuj

Hi,

thanks for your contribution!

From a first quick look I"m asking myself why JsonXMLStreamReader uses writeXmlNil and JsonXMLStreamWriter uses readXmlNil. I would have expected it the other way round...

Anyway, I will have to investigate this a little further, I think. For now, thanks!

beckchr avatar Apr 02 '15 10:04 beckchr

I agree.. :) We can modify the method names. imagine writeXmlNil as 'readJsonNullToWriteAsXmlNil' and readXmlNil as 'writeJsonNullFromPreviouslyReadXmlNil'

On Thu, Apr 2, 2015 at 3:35 PM, Christoph Beck [email protected] wrote:

Hi,

thanks for your contribution!

From a first quick look I"m asking myself why JsonXMLStreamReader uses writeXmlNil and JsonXMLStreamWriter uses readXmlNil. I would have expected it the other way round...

Anyway, I will investigate this al little further, I think. For now, thanks!

Reply to this email directly or view it on GitHub https://github.com/beckchr/staxon/pull/27#issuecomment-88855483.

Ishan Jayawardena Senior Software Engineer

iuj avatar Apr 02 '15 10:04 iuj