web stats
E4X Syntax - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 08-27-2014, 06:01 AM
dcomp dcomp is offline
Mirth Newb
 
Join Date: Sep 2013
Location: Westfield, IN
Posts: 15
dcomp is on a distinguished road
Cool E4X Syntax

I have seen this used in a post:

var tagX=response..*::['tagX'].toString();

Can someone tell me what the double colon signifies (with the bracketed value behind it)?

Is there some E4X documentation that specifically explains that?
Reply With Quote
  #2  
Old 08-27-2014, 06:51 AM
narupley's Avatar
narupley narupley is online now
Mirth Employee
 
Join Date: Oct 2010
Posts: 7,119
narupley is on a distinguished road
Default

Quote:
Originally Posted by dcomp View Post
I have seen this used in a post:

var tagX=response..*::['tagX'].toString();

Can someone tell me what the double colon signifies (with the bracketed value behind it)?

Is there some E4X documentation that specifically explains that?
Yes: http://wso2.com/project/mashup/0.2/d...uickstart.html
__________________
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 08-27-2014, 07:25 AM
dcomp dcomp is offline
Mirth Newb
 
Join Date: Sep 2013
Location: Westfield, IN
Posts: 15
dcomp is on a distinguished road
Unhappy E4X Syntax

Thanks Nick:

But the document doesn't clarify it for me.

RE:
var foo = new Namespace(...);
element.foo::bar
Meaning: Select the foo:bar child of element where foo is the prefix of a declared namespace.

The namespace part has me confused.

How does this:

var respVal = responseMap.get('Mirth Web Service').getMessage();
resp = new XML(respVal);
var tagX = resp..*::['return'].toString();


drill down to get the HL7 ack message in this?
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header/>
<S:Body>
<ns2:acceptMessageResponse xmlns:ns2="http://ws.connectors.connect.mirth.com/">
<return>MSH|^~\&amp;|OSC|Host|X|X|20140827084502|| ACK|594|P|2.3||||||
MSA|AA|594
</return>
</ns2:acceptMessageResponse>
</S:Body>
</S:Envelope>


resp..* gets all the descendants of the parent - right?
Then there is the '::' with the element name 'return' in the [].

Can you put it in to newb terms for me?
Reply With Quote
  #4  
Old 08-27-2014, 07:30 AM
narupley's Avatar
narupley narupley is online now
Mirth Employee
 
Join Date: Oct 2010
Posts: 7,119
narupley is on a distinguished road
Default

The ".." gets all descendant nodes (children, or children's children, or children's children's children...). The "*::" means "with any namespace". If you were to define a Namespace object with "var ns = new Namespace('blahblah');" and use "ns::" instead, then it would only be using that namespace. So in your case, you could do this instead:

Code:
var respVal = responseMap.get('Mirth Web Service').getMessage();
resp = new XML(respVal);
var S = new Namespace('http://schemas.xmlsoap.org/soap/envelope/');
var ns2 = new Namespace('http://ws.connectors.connect.mirth.com/');
var tagX = resp.S::Body.ns2::acceptMessageResponse['return'].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.
Reply With Quote
  #5  
Old 08-27-2014, 07:43 AM
dcomp dcomp is offline
Mirth Newb
 
Join Date: Sep 2013
Location: Westfield, IN
Posts: 15
dcomp is on a distinguished road
Smile E4X Syntax

I appreciate your explanation.

Thanks
Reply With Quote
Reply

Tags
e4x, 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:50 AM.


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