How can I get the curl result of 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:~$
and why does the above XML have an XD tag, and to what end?
The help file states:
DESCRIPTION
The
Export-Clixmlcmdlet creates a Common Language Infrastructure (CLI) XML-based representation of an object or objects and stores it in a file. You can then use theImport-Clixmlcmdlet to recreate the saved object based on the contents of that file. For more information about CLI, see Language independence (/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.
invoking
OuterXmlworks:but how do you check that it's
XMLat all? or, even well-formed?