Hi,
I am creating an XML file from a Sequential file using XML Output Stage. In the XML file I have a requirement to repeat an element. Here is my requirement from a sample file :
<structures:Instruction>
- <structures:DoseAdministration>
- <structures:DoseDeliveryMethod>
<datatypes:Text>UNSPECIFIED</datatypes:Text>
<datatypes:Qualifier>SNOMED</datatypes:Qualifier>
<datatypes:Code>10003008</datatypes:Code>
</structures:DoseDeliveryMethod>
- <structures:DoseAmount>
<datatypes:Text>UNSPECIFIED</datatypes:Text>
<datatypes:Qualifier>SNOMED</datatypes:Qualifier>
<datatypes:Code>10003008</datatypes:Code>
</structures:DoseAmount> <structures:DoseClarifyingFreeText>NA</structures:DoseClarifyingFreeText>
- <structures:DoseForm>
<datatypes:Text>UNSPECIFIED</datatypes:Text>
<datatypes:Qualifier>FMTDOSEFORM</datatypes:Qualifier>
<datatypes:Code>C38046</datatypes:Code>
</structures:DoseForm>
- <structures:RouteOfAdministration>
<datatypes:Text>ORAL</datatypes:Text>
<datatypes:Qualifier>SNOMED</datatypes:Qualifier>
<datatypes:Code>1</datatypes:Code>
</structures:RouteOfAdministration>
</structures:DoseAdministration>
- <structures:TimingAndDuration>
- <structures:Frequency>
<structures:FrequencyNumericValue>5</structures:FrequencyNumericValue>
- <structures:FrequencyUnits>
<datatypes:Text>UNSPECIFIED</datatypes:Text>
<datatypes:Qualifier>SNOMED</datatypes:Qualifier>
<datatypes:Code>10003008</datatypes:Code>
</structures:FrequencyUnits>
</structures:Frequency>
<structures:TimingClarifyingFreeText>NONE</structures:TimingClarifyingFreeText>
</structures:TimingAndDuration>
<structures:MultipleTimingModifier>AND</structures:MultipleTimingModifier>
- <structures:TimingAndDuration>
- <structures:Duration>
<structures:DurationNumericValue>0</structures:DurationNumericValue>
- <structures:DurationText>
<datatypes:Text>Day</datatypes:Text>
<datatypes:Qualifier>SNOMED</datatypes:Qualifier>
<datatypes:Code>2</datatypes:Code>
</structures:DurationText>
</structures:Duration>
</structures:TimingAndDuration>
</structures:Instruction>
In the above structure I need to close the element <structures:TimingAndDuration> and reopen the same element.
</structures:TimingAndDuration>
<structures:MultipleTimingModifier>AND</structures:MultipleTimingModifier>
<structures:TimingAndDuration>
In the XML Output Stage I have defined the columns as below :
TimingClarifyingFreeText
MultipleTimingModifier
DurationNumericValue
But I am getting the output as below :
<structures:Instruction>
- <structures:DoseAdministration>
- <structures:DoseDeliveryMethod>
<datatypes:Text>Unspecified</datatypes:Text>
<datatypes:Qualifier>SNOMED</datatypes:Qualifier>
<datatypes:Code>10003008</datatypes:Code>
</structures:DoseDeliveryMethod>
- <structures:DoseAmount>
<datatypes:Text>Unspecified</datatypes:Text>
<datatypes:Qualifier>SNOMED</datatypes:Qualifier>
<datatypes:Code>10003008</datatypes:Code>
</structures:DoseAmount>
<structures:DoseClarifyingFreeText>NA</structures:DoseClarifyingFreeText>
- <structures:DoseForm>
<datatypes:Text>Unspecified</datatypes:Text>
<datatypes:Qualifier>FMTDOSEFORM</datatypes:Qualifier>
<datatypes:Code>NA</datatypes:Code>
</structures:DoseForm>
- <structures:RouteOfAdministration>
<datatypes:Text>135</datatypes:Text>
<datatypes:Qualifier>SNOMED</datatypes:Qualifier>
<datatypes:Code>1003008</datatypes:Code>
</structures:RouteOfAdministration>
- <structures:SiteOfAdministration>
<datatypes:Text>11</datatypes:Text>
<datatypes:Qualifier>SNOMED</datatypes:Qualifier>
<datatypes:Code>1003008</datatypes:Code>
</structures:SiteOfAdministration>
</structures:DoseAdministration>
- <structures:TimingAndDuration>
- <structures:Frequency>
<structures:FrequencyNumericValue>0</structures:FrequencyNumericValue>
- <structures:FrequencyUnits>
<datatypes:Text>Unspecified</datatypes:Text>
<datatypes:Qualifier>SNOMED</datatypes:Qualifier>
<datatypes:Code>10003008</datatypes:Code>
</structures:FrequencyUnits>
</structures:Frequency>
<structures:TimingClarifyingFreeText>None</structures:TimingClarifyingFreeText>
- <structures:Duration>
<structures:DurationNumericValue>0</structures:DurationNumericValue>
- <structures:DurationText>
<datatypes:Text>Unspecified</datatypes:Text>
<datatypes:Qualifier>SNOMED</datatypes:Qualifier>
<datatypes:Code>1003008</datatypes:Code>
</structures:DurationText>
</structures:Duration>
</structures:TimingAndDuration>
<structures:MultipleTimingModifier>AND</structures:MultipleTimingModifier>
</structures:Instruction>
I am highlighting the error :
<structures:TimingAndDuration>
- <structures:Frequency>
<structures:FrequencyNumericValue>0</structures:FrequencyNumericValue>
- <structures:FrequencyUnits>
<datatypes:Text>Unspecified</datatypes:Text>
<datatypes:Qualifier>SNOMED</datatypes:Qualifier>
<datatypes:Code>10003008</datatypes:Code>
</structures:FrequencyUnits>
</structures:Frequency>
<structures:TimingClarifyingFreeText>None</structures:TimingClarifyingFreeText>
- <structures:Duration>
<structures:DurationNumericValue>0</structures:DurationNumericValue>
- <structures:DurationText>
<datatypes:Text>Unspecified</datatypes:Text>
<datatypes:Qualifier>SNOMED</datatypes:Qualifier>
<datatypes:Code>1003008</datatypes:Code>
</structures:DurationText>
</structures:Duration>
</structures:TimingAndDuration>
<structures:MultipleTimingModifier>AND</structures:MultipleTimingModifier>
"TimingAndDuration" should be closed and "MultipleTimingModifier" should come before "structures:Duration".
Please help me how to define xpath for these columns.
Thanks!
XML Output Stage
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 13
- Joined: Thu May 28, 2015 3:59 am
- Location: Pune
There are quite a few XSD generation tools available on the net... Freeformatter XSD/XML Schema Generator,
https://msdn.microsoft.com/en-us/librar ... S.80).aspx
https://msdn.microsoft.com/en-us/librar ... S.80).aspx
Never mind the fact that whomever that XML file is destined for should have provided one. Generating one from XML can be a little... hit and miss. And understand that I'm not saying it is a requirement to solve your problem, it was just a simple question as it can help with getting the proper metadata / XPath Expressions into the stage.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
Ok.... we're using the xmlOutput Stage here, so xsd's aren't employed, so we can take that one off the table for now. We might want to revisit that, if it turns out that the "xml" stage is better suited for the Job, but for the moment, let's look at this directly from an xmlOutput Stage perspective, where xsd's are not necessary.
It is very difficult for me to tell what you are exactly looking for, but if you want elements to be nested "beneath" TimingAndDuration, then one of the columns for those elements needs to be the "repeating element" (marked as a key) and you need to have TimingAndDuration as a higher level node in your xpath (I am leaving out the namespace prefixes here as they just confuse the issue)...
.../TimingAndDuration/MultipleTimingModifier/text()
...and if you have other "different" repeating units at the same level as TimingAndDuration, it gets more difficult, as you can only generate one deeply nested path for each output link.
When debugging something like this, it usually helps to only focus on the critical columns that you are dealing with initially (the ones at the "bottom" of the desired full path)...and then get the structure the way that you want...then include other columns at the same level or above, as desired.
Ernie
It is very difficult for me to tell what you are exactly looking for, but if you want elements to be nested "beneath" TimingAndDuration, then one of the columns for those elements needs to be the "repeating element" (marked as a key) and you need to have TimingAndDuration as a higher level node in your xpath (I am leaving out the namespace prefixes here as they just confuse the issue)...
.../TimingAndDuration/MultipleTimingModifier/text()
...and if you have other "different" repeating units at the same level as TimingAndDuration, it gets more difficult, as you can only generate one deeply nested path for each output link.
When debugging something like this, it usually helps to only focus on the critical columns that you are dealing with initially (the ones at the "bottom" of the desired full path)...and then get the structure the way that you want...then include other columns at the same level or above, as desired.
Ernie
Ernie Ostic
blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
I realize they're out of a job directly in the stage itself but you could use the xsd to generate / save the output metadata and then import those XPath Expressions into the stage... yes? Or have I spent too much time away from the family farm?eostic wrote:Ok.... we're using the xmlOutput Stage here, so xsd's aren't employed, so we can take that one off the table for now.
![Sad :(](./images/smilies/icon_sad.gif)
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
haha. Good one.
No...you haven't been away for "too" long....the old xml metadata importer can read "some" xsd's....but it can't handle any that are complex or large --- so as a best practice, when using the xmlInput and xmlOutput Stages, just import a complete xml instance document (or piece of it) that you need to construct.
Ernie
No...you haven't been away for "too" long....the old xml metadata importer can read "some" xsd's....but it can't handle any that are complex or large --- so as a best practice, when using the xmlInput and xmlOutput Stages, just import a complete xml instance document (or piece of it) that you need to construct.
Ernie
Ernie Ostic
blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>