web stats
Add Namespace XML - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 11-04-2019, 09:18 AM
mberges mberges is offline
OBX.1 Kenobi
 
Join Date: Jan 2018
Posts: 44
mberges is on a distinguished road
Default Add Namespace XML

How can I add this namespace in the message header?

<ORM_O01 xmlns="urn:hl7-org:v2xml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

Greetings and thank you
Reply With Quote
  #2  
Old 11-04-2019, 12:52 PM
agermano agermano is offline
Mirth Guru
 
Join Date: Apr 2017
Location: Indiana, USA
Posts: 1,106
agermano is on a distinguished road
Default

What are you starting with? If it's pipe delimited that you are converting with the strict parser, make sure strip namespaces is not checked. That will create your message with the xmlns="urn:hl7-org:v2xml" namespace already applied.

If you only have the xml without any namespaces you can add it, but you'll have to recursively add it to every node.

Code:
// explicity set empty prefix or e4x will create one for you
var hl7-ns = new Namespace('', "urn:hl7-org:v2xml");
var xsi = new Namespace('xsi', "http://www.w3.org/2001/XMLSchema-instance");

msg.setNamespace(hl7-ns);
for each(var node in msg.descendants()) node.setNamespace(hl7-ns);
// only the root node needs this
msg.addNamespace(xsi);
Reply With Quote
  #3  
Old 11-05-2019, 01:19 AM
mberges mberges is offline
OBX.1 Kenobi
 
Join Date: Jan 2018
Posts: 44
mberges is on a distinguished road
Default

I tried, but it happens to me that it puts xmlns in all the tags. I just want to put it in the header ORM

<ORM_O01 xmlns="urn:hl7-org:v2xml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<MSH xmlns="">
<MSH.1>|</MSH.1>
<MSH.2>^~\&amp;</MSH.2>
<MSH.3>
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 03:05 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2020, vBulletin Solutions, Inc.
Mirth Corporation