Announcement

Collapse
No announcement yet.

Add Namespace XML

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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

  • #2
    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);

    Comment


    • #3
      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>

      Comment

      Working...
      X