web stats
Getting rid of xmlns="" in XML message - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 12-21-2012, 05:48 AM
Bostad Bostad is offline
Level 85 Channel Wizard
 
Join Date: Mar 2009
Location: Stratford Ontario
Posts: 712
Bostad is an unknown quantity at this point
Default Getting rid of xmlns="" in XML message

Hi All;

Bit of a perplexing problem.

I'm getting

Code:
<OCANv2FullSubmissionRecord xmlns=""  ...
In my outbound XML message. It fails on the xmln being present.

If I strip namespaces I get errors, and have tried it with and without default namespace = '';

Can anyone tell me how to get rid of this?

I am contemplating dropping another destination below the one that creates the message and stripping it out using string replace but that seems a bit much.
__________________
I can be reached through gmail and Google Talk using davidrothbauer at gmail dot com
http://www.linkedin.com/pub/david-rothbauer/5/923/518
codeismydrug.wordpress.com
hl7coders.wordpress.com

Test all my code suggestions prior to implementation
Reply With Quote
  #2  
Old 12-21-2012, 06:32 AM
narupley's Avatar
narupley narupley is online now
Mirth Employee
 
Join Date: Oct 2010
Posts: 7,123
narupley is on a distinguished road
Default

Hmm, not sure without looking at the overall channel; can you post it here? Also, do you have a sample (scrubbed) inbound message you can post?
__________________
Step 1: JAVA CACHE...DID YOU CLEAR ...wait, ding dong the witch is dead?

Nicholas Rupley
Work: 949-237-6069
Always include what Mirth Connect version you're working with. Also include (if applicable) the code you're using and full stacktraces for errors (use CODE tags). Posting your entire channel is helpful as well; make sure to scrub any PHI/passwords first.


- How do I foo?
- You just bar.
Reply With Quote
  #3  
Old 12-21-2012, 06:39 AM
Bostad Bostad is offline
Level 85 Channel Wizard
 
Join Date: Mar 2009
Location: Stratford Ontario
Posts: 712
Bostad is an unknown quantity at this point
Default

I'm building it from a database. The source db reader checks one table for new records to transmit.

The records are in 3rd normal so it queries multiple tables in the destination transformer.

I can't export the whole channel as there are some destinations with connection info I can't risk spreading but here's the transformer.

The mapped variables coming in are from a database reader.

Thanks
Attached Files
File Type: xml db to xml transformer.xml (26.1 KB, 19 views)
__________________
I can be reached through gmail and Google Talk using davidrothbauer at gmail dot com
http://www.linkedin.com/pub/david-rothbauer/5/923/518
codeismydrug.wordpress.com
hl7coders.wordpress.com

Test all my code suggestions prior to implementation
Reply With Quote
  #4  
Old 12-21-2012, 06:54 AM
narupley's Avatar
narupley narupley is online now
Mirth Employee
 
Join Date: Oct 2010
Posts: 7,123
narupley is on a distinguished road
Default

Ah, I think I see what you mean now. So here's sort of how it works. The default E4X namespace is set based on the inbound message, so if your outbound message should use a different namespace, then you have two options. Either reset the default namespace, or declare namespaces as variables and use them with the E4X "::" directive in assignment statements. Here's an example of the former:

Code:
default xml namespace = 'http://www.ehealthontario.ca/CCIM';
Note that in that case since your inbound message doesn't have any namespaces defined, you'll have to use a blank one to extract data:

Code:
var ns = new Namespace('');
logger.info(msg.ns::type.toString());
__________________
Step 1: JAVA CACHE...DID YOU CLEAR ...wait, ding dong the witch is dead?

Nicholas Rupley
Work: 949-237-6069
Always include what Mirth Connect version you're working with. Also include (if applicable) the code you're using and full stacktraces for errors (use CODE tags). Posting your entire channel is helpful as well; make sure to scrub any PHI/passwords first.


- How do I foo?
- You just bar.

Last edited by narupley; 12-21-2012 at 06:56 AM.
Reply With Quote
  #5  
Old 12-24-2012, 05:02 AM
Bostad Bostad is offline
Level 85 Channel Wizard
 
Join Date: Mar 2009
Location: Stratford Ontario
Posts: 712
Bostad is an unknown quantity at this point
Default

tried that to no avail.

I'm thinking of moving the XML message creation to the source transformer and stripping everything out on the way through. Not sure if that will work though.
__________________
I can be reached through gmail and Google Talk using davidrothbauer at gmail dot com
http://www.linkedin.com/pub/david-rothbauer/5/923/518
codeismydrug.wordpress.com
hl7coders.wordpress.com

Test all my code suggestions prior to implementation
Reply With Quote
  #6  
Old 12-24-2012, 06:29 AM
narupley's Avatar
narupley narupley is online now
Mirth Employee
 
Join Date: Oct 2010
Posts: 7,123
narupley is on a distinguished road
Default

Quote:
Originally Posted by Bostad View Post
tried that to no avail.

I'm thinking of moving the XML message creation to the source transformer and stripping everything out on the way through. Not sure if that will work though.
What code are you using? I've attached my modified transformer; it works great for me! *shrugs*
Attached Files
File Type: xml db to xml transformer v2.xml (26.3 KB, 89 views)
__________________
Step 1: JAVA CACHE...DID YOU CLEAR ...wait, ding dong the witch is dead?

Nicholas Rupley
Work: 949-237-6069
Always include what Mirth Connect version you're working with. Also include (if applicable) the code you're using and full stacktraces for errors (use CODE tags). Posting your entire channel is helpful as well; make sure to scrub any PHI/passwords first.


- How do I foo?
- You just bar.
Reply With Quote
  #7  
Old 12-24-2012, 07:31 AM
Bostad Bostad is offline
Level 85 Channel Wizard
 
Join Date: Mar 2009
Location: Stratford Ontario
Posts: 712
Bostad is an unknown quantity at this point
Default

Bit of weirdness, but its working.

I put it at the top where you had it and suddenly my first sql statement stopped working.

I put it below the first few lines but higher than I had it initially and it appeared to work!

Thanks!
__________________
I can be reached through gmail and Google Talk using davidrothbauer at gmail dot com
http://www.linkedin.com/pub/david-rothbauer/5/923/518
codeismydrug.wordpress.com
hl7coders.wordpress.com

Test all my code suggestions prior to implementation
Reply With Quote
  #8  
Old 06-07-2013, 04:44 AM
Breme Breme is offline
OBX.1 Kenobi
 
Join Date: Mar 2012
Posts: 48
Breme is on a distinguished road
Default

hi!
i try to download the xml but there is an error when load it into mirth.
This is the error:
Code:
Invalid channel file.  : input contained no data
com.thoughtworks.xstream.io.xml.XppReader.pullNextEvent(XppReader.java:80)
com.thoughtworks.xstream.io.xml.AbstractPullReader.readRealEvent(AbstractPullReader.java:137)
com.thoughtworks.xstream.io.xml.AbstractPullReader.readEvent(AbstractPullReader.java:130)
com.thoughtworks.xstream.io.xml.AbstractPullReader.move(AbstractPullReader.java:109)
com.thoughtworks.xstream.io.xml.AbstractPullReader.moveDown(AbstractPullReader.java:94)
com.thoughtworks.xstream.io.xml.XppReader.<init>(XppReader.java:48)
com.thoughtworks.xstream.io.xml.XppDriver.createReader(XppDriver.java:44)
com.thoughtworks.xstream.XStream.fromXML(XStream.java:861)
com.thoughtworks.xstream.XStream.fromXML(XStream.java:853)
com.mirth.connect.model.converters.ObjectXMLSerializer.fromXML(ObjectXMLSerializer.java:123)
com.mirth.connect.client.ui.Frame.importChannel(Frame.java:2840)
com.mirth.connect.client.ui.Frame.doImport(Frame.java:2820)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
java.lang.reflect.Method.invoke(Unknown Source)
sun.reflect.misc.Trampoline.invoke(Unknown Source)
sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
java.lang.reflect.Method.invoke(Unknown Source)
sun.reflect.misc.MethodUtil.invoke(Unknown Source)
java.beans.EventHandler.invokeInternal(Unknown Source)
java.beans.EventHandler.access$000(Unknown Source)
java.beans.EventHandler$1.run(Unknown Source)
java.security.AccessController.doPrivileged(Native Method)
java.beans.EventHandler.invoke(Unknown Source)
$Proxy7.actionPerformed(Unknown Source)
org.jdesktop.swingx.action.BoundAction.actionPerformed(BoundAction.java:231)
javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
org.jdesktop.swingx.JXHyperlink.fireActionPerformed(JXHyperlink.java:266)
javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
javax.swing.DefaultButtonModel.setPressed(Unknown Source)
javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
java.awt.AWTEventMulticaster.mouseReleased(Unknown Source)
java.awt.Component.processMouseEvent(Unknown Source)
javax.swing.JComponent.processMouseEvent(Unknown Source)
java.awt.Component.processEvent(Unknown Source)
java.awt.Container.processEvent(Unknown Source)
java.awt.Component.dispatchEventImpl(Unknown Source)
java.awt.Container.dispatchEventImpl(Unknown Source)
java.awt.Component.dispatchEvent(Unknown Source)
java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
java.awt.Container.dispatchEventImpl(Unknown Source)
java.awt.Window.dispatchEventImpl(Unknown Source)
java.awt.Component.dispatchEvent(Unknown Source)
java.awt.EventQueue.dispatchEventImpl(Unknown Source)
java.awt.EventQueue.access$000(Unknown Source)
java.awt.EventQueue$1.run(Unknown Source)
java.awt.EventQueue$1.run(Unknown Source)
java.security.AccessController.doPrivileged(Native Method)
java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
java.awt.EventQueue$2.run(Unknown Source)
java.awt.EventQueue$2.run(Unknown Source)
java.security.AccessController.doPrivileged(Native Method)
java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
java.awt.EventQueue.dispatchEvent(Unknown Source)
java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
java.awt.EventDispatchThread.pumpEvents(Unknown Source)
java.awt.EventDispatchThread.pumpEvents(Unknown Source)
java.awt.EventDispatchThread.run(Unknown Source)
narupley, can you upload it?
many thanks!
Reply With Quote
Reply

Tags
namespace, xml

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 01:12 AM.


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