简体   繁体   English

请帮我理解一行代码

[英]Please help me understand one line of code

I've inherited a series of mirth channels that I need to modify but don't understand everything that has been done.我继承了一系列我需要修改但不了解所做的一切的欢乐频道。

Yes, I could rewrite them 'my way' but time is short so, if anyone can explain what some of the code does that might be a real life saver.是的,我可以用“我的方式”重写它们,但时间很短,如果有人能解释其中一些代码的作用,那可能是一个真正的救星。

The code I have inherited makes extensive use of '*::' (see example below).我继承的代码广泛使用了 '*::' (参见下面的示例)。

tmp.*::['Body'].*::['SavePathologyResults'].*::['request'].*::['PathologyResults'].*::['SavePathologyResultRequest'][index] = newWCFNode;

While I get a general feel from this, what exactly does '*::' mean/do?虽然我从中得到了一般的感觉,但 '*::' 到底是什么意思/做什么?

Thanks in anticipation...谢谢期待...

(For context, 'tmp' is an XML SOAP envelope) (对于上下文,'tmp' 是一个 XML SOAP 信封)

In E4X (ECMAScript for XML) , :: is the syntax for qualified identifiers (11.1.2).E4X (ECMAScript for XML)中, ::是限定标识符 (11.1.2) 的语法。 *::['Body'] (or the equivalent *::Body ) is the Body identifier in any namespace (11.1.3). *::['Body'] (或等效的*::Body )是任何命名空间 (11.1.3) 中的Body标识符。 Accessing it as the property of an XML or XMLList object means getting a new XMLList of all children with that identifier as a node name (11.2.1).将其作为 XML 或 XMLList 对象的属性进行访问意味着获取具有该标识符作为节点名称 (11.2.1) 的所有子节点的新 XMLList。

So, that statement gets <Body> elements in tmp , then <SavePathologyResults> elements in those <Body> elements, then …, then <SavePathologyResultRequest> elements in those <PathologyResults> elements, and replaces the index th <SavePathologyResultRequest> with newWCFNode (11.6.2) – where all of the aforementioned (and aforeunmentioned) elements could belong to any namespace.因此,该语句获取tmp中的<Body> Body> 元素,然后是那些<Body>元素中的<SavePathologyResults>元素,然后......,然后是那些<PathologyResults>元素中的<SavePathologyResultRequest>元素,并将index th <SavePathologyResultRequest>替换为newWCFNode ( 11.6.2) – 所有上述(和前面提到的)元素都可以属于任何命名空间。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM