我怎样才能得到curl
just <notes/>
, from eXist
, with的结果PowerShell
?
PS /home/nicholas>
PS /home/nicholas> $url='http://localhost:8080/exist/rest/db/scripts/notes.xq'
PS /home/nicholas>
PS /home/nicholas> $url
http://localhost:8080/exist/rest/db/scripts/notes.xq
PS /home/nicholas>
PS /home/nicholas> $result=Invoke-RestMethod -Method Get -Uri $url -Headers @{"Content-Type" = "text/xml"}
PS /home/nicholas>
PS /home/nicholas> $result
notes
-----
PS /home/nicholas>
PS /home/nicholas> $result | Export-Clixml ./result.xml
PS /home/nicholas>
PS /home/nicholas> Get-Content ./result.xml
<Objs Version="1.1.0.1" xmlns="http://schemas.microsoft.com/powershell/2004/04">
<Obj RefId="0">
<XD><notes /></XD>
</Obj>
</Objs>
PS /home/nicholas>
PS /home/nicholas> exit
nicholas@mordor:~$
nicholas@mordor:~$ curl http://localhost:8080/exist/rest/db/scripts/notes.xq
<notes/>nicholas@mordor:~$
nicholas@mordor:~$
为什么上面XML
有XD
标签,目的是什么?
帮助文件指出:
描述
该
Export-Clixml
cmdlet 创建一个或多个对象的基于公共语言基础结构 (CLI) XML 的表示并将其存储在文件中。然后,您可以使用Import-Clixml
cmdlet 根据该文件的内容重新创建保存的对象。有关 CLI 的详细信息,请参阅语言独立性 (/dotnet/standard/language-independence)。This cmdlet is similar to `ConvertTo-Xml`, except that `Export-Clixml` stores the resulting XML in a file. `ConvertTo-XML` returns the XML, so you can continue to process it in PowerShell. A valuable use of `Export-Clixml` on Windows computers is to export credentials and secure strings securely as XML. For an example, see Example 3.