tags:

views:

204

answers:

0

I have a ‘workitem’ (cut down xml) which contains the following:

          <dataModel>
                 <outputs name="CustomerId" type="string" value=""/>                        
                 <outputs name="City_and_State" type="string" value=""/>                           
                 <outputs name="CustomerName" type="string" value=""/>                      
                 <outputs name="Zip_Code" type="string" value=""/>                          
                 <outputs name="Street_and_Address" type="string" value=""/>                              
                 <inouts name="ClaimType" type="complex" value"<xmlString>”/>
          </dataModel>

Which can be easily converted to json.

The issue is that I need to have a xml string inside the ClaimType /complex type. For example (that I will need in json too) This would be in the above:

<?xml version="1.0" encoding="ASCII"?>
<Dealer xmlns="http://www.test.com/showroom" name="joes Cars" manager="Joe" open="true">
       <car name="Civic" doors="4" type="C" available="true">
              <engine size="v8" valves="20"/>
              <gearbox gears="5" paddles="true"/>
              <wheels alloys="true" size="17" width="5"/>
       </car>
       <car name="Accord" doors="4" type="B" available="true">
              <engine size="v8" valves="20"/>
              <gearbox gears="5" paddles="true"/>
              <wheels alloys="true" size="17" width="5"/>
              </car>
</Dealer>

Now, what I have done at the moment is:

1) The xml string comes to me as encoded xml. 2) I parse the dataModel xml, rip out the complex value, decode, convert to json, encode again, and push back into the xml doc. 3) I can then parse the whole xml (datamodel) to json and send to the client.

The issue is that I am parsing the doc twice, once with the doc parser, and then again with json. I will also (I know, I know) need to convert the xmlns to a correct namespace format, which would be a third parse (prob just before I convert the xml (the complex) to json.

So basically, what im asking is can Json handle internal xml (in a xml)?