View Full Version : Can i actually do this with JSON?

04-01-2009, 05:29 PM
Quick one.. (i hope).

Can i actually go from :

<?xml version="1.0" encoding="UTF-8"?>
<customermodel:Customer xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:customermodel="http://customermodel" xmlns:personal="http://customermodel/personal" id="1" age="1" name="Joe">
<bankAccounts xsi:type="customermodel:BankAccount" accountNo="10" bankName="HSBC" testBoolean="true" testDate="2006-10-23" testDateTime="2006-10-23T22:15:01+08:00" testDecimal="20.2" testTime="22:15:01+08:00">
<bankAddressLine>31 florence</bankAddressLine>

to Json (using json-lib) to preserve what are attributes/elements.

Then convert back again to exactly the same (xsd validation) XML? or is this just not possible without writing my own parser?

I would have thought this would be simple to do.. but I cannot find a method.