如何使用&符号构建动态URL

时间:2015-08-13 17:46:59

标签: xquery urlencode

我必须在XQuery中构建一个动态URL。我有一个硬编码的网址。部分网址应该从变量构建。我如何建立该网址?我无法在XQuery中使用concat,因为url的前半部分有特殊字符(&符号)。

以下网址中的值ceiatlpaqer055.coxinc.com是动态的,应该从其他变量填充。如何在XQuery中构建此URL?

网址如下:

http://axiomweb604.testinc.com:8080/arsys/forms/axiom_7_6_4/SHR%3ALandingConsole/Default+Administrator+View/?mode=search&F304255500=AST:ComputerSystem&F1000000076=FormOpenNoAppList&F303647600=SearchTicketWithQual&F304255610=%27Name%27%3D%22ceiatlpaqer055.coxinc.com%22

1 个答案:

答案 0 :(得分:1)

&是一个特殊角色,所以你必须逃脱它。使用XML实体语法,可以用&替换它。所以你实际上可以连接这个字符串,例如通过做

"http://axiomweb604.testinc.com:8080/arsys/forms/axiom_7_6_4/SHR%3ALandingConsole/Default+Administrator+View/?mode=search&F304255500=AST:ComputerSystem&F1000000076=FormOpenNoAppList&F303647600=SearchTicketWithQual&F304255610=%27Name%27%3D%22"  || "ceiatlpaqer055.coxinc.com" || "%22"

concat("http://axiomweb604.testinc.com:8080/arsys/forms/axiom_7_6_4/SHR%3ALandingConsole/Default+Administrator+View/?mode=search&F304255500=AST:ComputerSystem&F1000000076=FormOpenNoAppList&F303647600=SearchTicketWithQual&F304255610=%27Name%27%3D%22", "ceiatlpaqer055.coxinc.com", "%22")