highsource / jsonix

Powerful XML<->JSON JavaScript mapping library.
BSD 2-Clause "Simplified" License
356 stars 75 forks source link

Missing properties in json after unmarshalling #270

Open barczykartur7 opened 11 months ago

barczykartur7 commented 11 months ago

Hello, I came across a problem with unmarshalling process. I am attaching my xsd files and my xml file that marshalling was done upon. I am also attaching jsonschema and generated mappings. I would be grateful if you could help me, because I don't understand why unmarshalled json is (in my opinion) missing some props. XSD file that was given for jsonix to do mappings was extPL_r3.xsd. In my xml a root element is <ClinicalDocument>. I am having a problem with its three child props. I will start from the less deep problem.

Problem 1: The ClinicalDocument has the <title> child tag. And the problem with this child is that in original xml it looks like this: <title>Skierowanie do szpitala</title> And the unmarshalled equivalent in json file is:

  "title": {
        "TYPE_NAME": "referral.ST"
  },

And marshalled version: </title> In my opinion there should be value. I tried to pass it as string, in object etc. And nothing helped. I did find an solution by changing xsd type from "ST" to "xs:string", but I would like to avoid such an editing. Am I missing some files or something? I tried to look at referenced type of "ST" in json schema but I couldn't get a proper result.

Problem 2: The ClinicalDocument has the <code> child tag. That tag should have a child tag: . But it does not appear in unmarshalled version. Original xml tag looks like this:

...
<code code="57832-8" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC" displayName="Prescription for diagnostic or specialist care Document">
    <translation code="02.10" displayName="Skierowanie na badanie lub leczenie" codeSystem="2.16.840.1.113883.3.4424.11.1.32" codeSystemName="KLAS_DOK_P1"/>
</code>

Genarated json looks like this:

...
"code": {
      "TYPE_NAME": "referral.CE",
      "code": "57832-8",
      "codeSystem": "2.16.840.1.113883.6.1",
      "codeSystemName": "LOINC",
      "displayName": "Prescription for diagnostic or specialist care Document"
    },

There is no within. Marshalled xml looks like this:

<code code="57832-8" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC" displayName="Prescription for diagnostic or specialist care Document"/>

I think that the cause can be recursive type. But I am not sure. I tried to edit json and mapping and I didn't get proper form. Have you got any idea on that?

Problem 3: My last problem relates to <reference> tag This tag is placed deeply in <component> tag in <ClinicalDocument>. Tag should be placed in <text> The original xml looks like this:

<text>
  <reference value="#PROC_1"/>
</text>

Unmarshalled (generated) Json looks like this:

"text": {
  "TYPE_NAME": "referral.ED"
}

There is no trace of <reference> tag. It took me some hours to try to solve above problems. I am asking for your help. If there will be a need for more information I will pass it to you ASAP.

files: attachments.zip

Thank you