|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
XMLNSC Question - Namespace Aware vs Non Namespace Aware |
« View previous topic :: View next topic » |
Author |
Message
|
wraymore |
Posted: Thu May 15, 2008 5:28 am Post subject: XMLNSC Question - Namespace Aware vs Non Namespace Aware |
|
|
Centurion
Joined: 16 Aug 2005 Posts: 114 Location: Burlington, NC USA
|
I have a XML string non namespace aware that has to be embedded within a XMLNSC domain message. This XML string is built from a HL7 element.
Steps currently in place:
CREATE LASTCHILD OF Environment DOMAIN 'XML' NAME 'HL7Data';
SET Environment.HL7Data.HL7 = InTriadPayld.triadNS:Payload[N];
ESQL code to build the XML string from the HL7Data.HL7 as HL7Data.HL7Work.
DECLARE triadMsgNS NAMESPACE 'http://www.labcorp.com/02/11/2008/V1/TriadMessage.xsd';
DECLARE triadNS NAMESPACE 'http://www.labcorp.com/02/11/2008/V1/TriadCommon.xsd';
DECLARE dt NAMESPACE 'urn:schemas-microsoft-com:datatypes';
SET Environment.HL7Data.HL7Work.(XML.XmlDecl)*.(XML.Attribute)Version = '1.0';
SET Environment.HL7Data.HL7Work.REPORT.(XML.Attribute)file_version = '1';
SET Environment.HL7Data.HL7Work.REPORT.REPORT_INFO.(XML.Attribute)Report_Type = '01';
SET Environment.HL7Data.HL7Work.REPORT.REPORT_INFO.XML_VERSION = '1.00';
Build AckSegment
SET Environment.HL7Data.HL7Work.REPORT.REPORT_INFO.ACK_SEGMENT.(XML.CDataSection) = CAST(AckSegment AS CHARACTER);
Build FsfSegment
SET Environment.HL7Data.HL7Work.REPORT.REPORT_INFO.FSF_SEGMENT.(XML.CDataSection) = CAST(FsfSegment AS CHARACTER);
Build MshSegment
SET Environment.HL7Data.HL7Work.REPORT.REPORT_INFO.SPECIMENS.(XML.Attribute).Specimen = specNbr;
SET Environment.HL7Data.HL7Work.REPORT.REPORT_INFO.SPECIMENS.MSH_SEGMENT.(XML.Attribute).Specimen = specNbr;
SET Environment.HL7Data.HL7Work.REPORT.REPORT_INFO.SPECIMENS.MSH_SEGMENT.(XML.CDataSection) = CAST(MshSegment AS CHARACTER);
Setup Specimen Data and Segments within Specimen Data
SET Environment.HL7Data.HL7Work.REPORT.REPORT_INFO.SPECIMENS.SPECIMEN_DATA.(XML.Attribute).Specimen = specNbr;
SET Environment.HL7Data.HL7Work.REPORT.REPORT_INFO.SPECIMENS.SPECIMEN_DATA.(XML.CDataSection) = WorkData;
Build the SpecimenImage Segment
SET Environment.HL7Data.HL7Work.REPORT.REPORT_INFO.SPECIMENS.SPECIMEN_IMAGE.(XML.Attribute)Segment = 'ZMG';
SET Environment.HL7Data.HL7Work.REPORT.REPORT_INFO.SPECIMENS.SPECIMEN_IMAGE.(XML.Attribute)Specimen = specNbr;
SET Environment.HL7Data.HL7Work.REPORT.REPORT_INFO.SPECIMENS.SPECIMEN_IMAGE.(XML.Attribute)Test = TESTNBR;
SET Environment.HL7Data.HL7Work.REPORT.REPORT_INFO.SPECIMENS.SPECIMEN_IMAGE.(XML.Attribute)Sequence = SEQUENCENBR;
SET Environment.HL7Data.HL7Work.REPORT.REPORT_INFO.SPECIMENS.SPECIMEN_IMAGE.(XML.Attribute)Image = SEQUENCENBR;
SET Environment.HL7Data.HL7Work.REPORT.REPORT_INFO.SPECIMENS.SPECIMEN_IMAGE.(XML.Attribute)href = Obx6_5;
SET Environment.HL7Data.HL7Work.REPORT.REPORT_INFO.SPECIMENS.SPECIMEN_IMAGE.(XML.NamespaceDecl)xmlns:dt= 'urn:schemas-microsoft-com:datatypes';
SET Environment.HL7Data.HL7Work.REPORT.REPORT_INFO.SPECIMENS.SPECIMEN_IMAGE.(XML.Attribute)dt:dt = BASE64STR;
SET Environment.HL7Data.HL7Work.REPORT.REPORT_INFO.SPECIMENS.SPECIMEN_IMAGE.(XML.Attribute)protocol = PROTOCOLSTR;
SET PDFString = InTriadPayld.triadNS:Payload[N];
SET Environment.HL7Data.HL7Work.REPORT.REPORT_INFO.SPECIMENS.SPECIMEN_IMAGE.(XML.CDataSection) = PDFString;
I then insert the HL7Data.HL7Work into the Payload Element within the XMLNSC message:
SET OutputRoot.XMLNSC.triadMsgNS:TriadMessage.triadMsgNS:TriadPayload.triadNS:Payload = Environment.HL7Data.HL7Work;
When writing the message to the out queue I get the following:
ParserException BIP5010E: XML Writing Errors have occurred.
Errors have occurred during writing of XML.
Review further error messages for an indication to
the cause of the errors.
ParserException BIP5014E: Element must have a namespace specified if there is
a default namespace in scope.
Whilst writing the XMLNS message, element 'REPORT'
was found to be in scope of a default namespace, but
this element does not have a namespace defined.
This error can occur if the NamespaceDecl correlation
name has been used to create a default namespace for
a parent element, and a child element has been created
that does not have a namespace. If you have defined a
default namespace in your output message tree, then
all elements that are in scope of this default
namespace must be defined to be in a namespace.
Modify the output message tree so that element
'REPORT' is defined to be in a namespace.
If element 'REPORT' belongs to the default namespace,
then this element needs to be created in the
default namespace.
Is there a way to accomplish this without extending the namespace to the data string within the Payload element? |
|
Back to top |
|
 |
kimbert |
Posted: Thu May 15, 2008 2:03 pm Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Quote: |
CREATE LASTCHILD OF Environment DOMAIN 'XML' NAME 'HL7Data'; |
Er, why the XML domain? Please tell me that this is a typo!
Quote: |
Is there a way to accomplish this without extending the namespace to the data string within the Payload element? |
First of all, let's talk about the problem accurately: The Payload element does not contain a string. It contains an entire subtree of elements. One of those elements ( REPORT ) does not have a namespace.
The error message could not be clearer. Your output message is using a default namespace ( xmlns="someURI" ). I don't know where you created that element in your output message tree, but it must be there somewhere.Within the scope of that default namespace, all elements must have a non-empty namespace. REPORT has an empty namespace.
Solutions
a) In the output message tree, declare a namespace prefix instead of using a default namespace
b) Remove the namespace declaration from the output mesage tree and let the parser assign namespace prefixes for you |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
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
|
|
|
|