Posted: Wed Oct 05, 2016 3:03 am Post subject: Getting input namespace in Output Message Structure
Newbie
Joined: 05 Oct 2016 Posts: 4
We have scenario copying input message to the output.
We have two DFDL libraries with different name spaces
DFDL 1 hl7 with 'hl7Namespace'
DFDL 2 ns1 with 'normalnamespace'
We are mapping ns1 to hl7. input message having ns1 name space and in the output we are mapping to hl7 namespace.
SET OutputRoot.DFDL.hl7:HL7.hl7:"PID.1.SetIDPID" = InputRoot.ns1:PID.ns1:"PID.1.SetIDPID";
This line working correctly it is having only single field
When we are mapping result set to the output tree structure we are getting DFDL serializing exception.
for example PID.2 is having 22 fields so we are taking as result set and directly mapping to the output in that case we are seeing ns1 namespace in the sub fields instead of hl7 namespace.
SET OutputRoot.DFDL.hl7:PID.hl7:"PID.2.PatientID" = newSegment.ns1:PID.ns1:"PID.2.PatientID";
Exception Message
Text:CHARACTER:An error occurred whilst serializing with DFDL
Insert
Type:INTEGER:5
Text:CHARACTER:CTDU4004E: The DFDL serializer cannot output element 'CX.1' because it does not match an element declaration at the current position in the DFDL schema model.
Insert
Type:INTEGER:5
Text:CHARACTER:/DFDL/{urn:hl7-org:v2xml}:HL7/{urn:hl7-org:v2xml}:anyHL7Segment/{urn:hl7-org:v2xml}:PID/{urn:hl7-org:v2xml}:PID.2.PatientID/{urn:hl7-canonical-org:v2xml}:CX.1
Note : there is no dfdl serializing error when we are mapping each and every sub-field.
I'm afraid this is 'working as designed'. You need to set the namespace on each and every field.
In an XSD, the normal style is for global element declarations to have a namespace and local definitions to have an empty namespace. If that was followed by XSD designers then this would not be such a problem. But in practice most XSDs make almost everything global.
If you really don't want to explicitly copy each and every field then you have a couple of options:
a) do all of the copying, then use a recursive tree walk to set the namespace to hl7 on every element in OutputRoot.XMLNSC. Only works if literally *every* tag and attribute in the output XML must have the same namespace.
b) Consider using the Mapping node. Because it's schema-driven it will automatically assign the namespaces for you. But you'll still need to draw a little line for each and every field mapping ( unless 'map by name' happens to be useful for your scenario ).
An HL7 message has a very regular structure. It may be possible to write yourself a post-processing algorithm that walks through OutputRoot.XMLNSC and sets up the namespace (or not) based on the nesting level of the element.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum