Skip to content

Commit 4b4748e

Browse files
authored
Merge pull request #99476 from ecfan/patch-2
Remove unnecessary backslashes for quotation marks
2 parents 1a5bbc3 + 85815d7 commit 4b4748e

File tree

1 file changed

+24
-21
lines changed

1 file changed

+24
-21
lines changed

articles/logic-apps/workflow-definition-language-functions-reference.md

Lines changed: 24 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4838,10 +4838,7 @@ And returns this result XML:
48384838

48394839
### xpath
48404840

4841-
Check XML for nodes or values that match an XPath (XML Path Language) expression,
4842-
and return the matching nodes or values. An XPath expression, or just "XPath",
4843-
helps you navigate an XML document structure so that you can select nodes
4844-
or compute values in the XML content.
4841+
Check XML for nodes or values that match an XPath (XML Path Language) expression, and return the matching nodes or values. An XPath expression, or just "XPath", helps you navigate an XML document structure so that you can select nodes or compute values in the XML content.
48454842

48464843
```
48474844
xpath('<xml>', '<xpath>')
@@ -4862,8 +4859,7 @@ xpath('<xml>', '<xpath>')
48624859

48634860
*Example 1*
48644861

4865-
This example finds nodes that match the `<name></name>` node
4866-
in the specified arguments, and returns an array with those node values:
4862+
This example finds nodes that match the `<name></name>` node in the specified arguments, and returns an array with those node values:
48674863

48684864
`xpath(xml(parameters('items')), '/produce/item/name')`
48694865

@@ -4873,8 +4869,7 @@ Here are the arguments:
48734869

48744870
`"<?xml version="1.0"?> <produce> <item> <name>Gala</name> <type>apple</type> <count>20</count> </item> <item> <name>Honeycrisp</name> <type>apple</type> <count>10</count> </item> </produce>"`
48754871

4876-
The example uses the [parameters()](#parameters) function to get
4877-
the XML string from the "items" argument, but must also convert
4872+
The example uses the [parameters()](#parameters) function to get the XML string from the "items" argument, but must also convert
48784873
the string to XML format by using the [xml()](#xml) function.
48794874

48804875
* This XPath expression, which is passed as a string:
@@ -4887,27 +4882,36 @@ Here is the result array with the nodes that match `<name></name`:
48874882

48884883
*Example 2*
48894884

4890-
Following on Example 1, this example finds nodes that match the
4891-
`<count></count>` node and adds those node values with the `sum()` function:
4885+
Following on Example 1, this example finds nodes that match the `<count></count>` node and adds those node values with the `sum()` function:
48924886

48934887
`xpath(xml(parameters('items')), 'sum(/produce/item/count)')`
48944888

48954889
And returns this result: `30`
48964890

48974891
*Example 3*
48984892

4899-
For this example, both expressions find nodes that match the
4900-
`<location></location>` node, in the specified arguments,
4901-
which include XML with a namespace. The expressions use the backslash
4902-
character (\\) as an escape character for the double quotation mark (").
4893+
For this example, both expressions find nodes that match the `<location></location>` node, in the specified arguments, which include XML with a namespace.
4894+
4895+
> [!NOTE]
4896+
>
4897+
> If you're working in code view, escape the double quotation mark (") by using the backslash character (\\).
4898+
> For example, you need to use escape characters when you serialize an expression as a JSON string.
4899+
> However, if you're working in the Logic App Designer or expression editor, you don't need to escape the
4900+
> double quotation mark because the backslash character is added automatically to the underlying definition, for example:
4901+
>
4902+
> * Code view: `xpath(xml(body('Http')), '/*[name()=\"file\"]/*[name()=\"location\"]')`
4903+
>
4904+
> * Expression editor: `xpath(xml(body('Http')), '/*[name()="file"]/*[name()="location"]')`
4905+
>
4906+
> The following examples apply to expressions that you enter in the expression editor.
49034907
49044908
* *Expression 1*
49054909

4906-
`xpath(xml(body('Http')), '/*[name()=\"file\"]/*[name()=\"location\"]')`
4910+
`xpath(xml(body('Http')), '/*[name()="file"]/*[name()="location"]')`
49074911

49084912
* *Expression 2*
49094913

4910-
`xpath(xml(body('Http')), '/*[local-name()=\"file\" and namespace-uri()=\"http://contoso.com\"]/*[local-name()=\"location\"]')`
4914+
`xpath(xml(body('Http')), '/*[local-name()="file" and namespace-uri()="http://contoso.com"]/*[local-name()="location"]')`
49114915

49124916
Here are the arguments:
49134917

@@ -4919,9 +4923,9 @@ Here are the arguments:
49194923

49204924
* Either XPath expression here:
49214925

4922-
* `/*[name()=\"file\"]/*[name()=\"location\"]`
4926+
* `/*[name()="file"]/*[name()="location"]`
49234927

4924-
* `/*[local-name()=\"file\" and namespace-uri()=\"http://contoso.com\"]/*[local-name()=\"location\"]`
4928+
* `/*[local-name()="file" and namespace-uri()="http://contoso.com"]/*[local-name()="location"]`
49254929

49264930
Here is the result node that matches the `<location></location>` node:
49274931

@@ -4931,10 +4935,9 @@ Here is the result node that matches the `<location></location>` node:
49314935

49324936
*Example 4*
49334937

4934-
Following on Example 3, this example finds the value in the
4935-
`<location></location>` node:
4938+
Following on Example 3, this example finds the value in the `<location></location>` node:
49364939

4937-
`xpath(xml(body('Http')), 'string(/*[name()=\"file\"]/*[name()=\"location\"])')`
4940+
`xpath(xml(body('Http')), 'string(/*[name()="file"]/*[name()="location"])')`
49384941

49394942
And returns this result: `"Paris"`
49404943

0 commit comments

Comments
 (0)