importing data from powershell
Wednesday, 18 November 2020 · 2 messages
N
Nicholas18 Nov 2020 02:47 #
for some simple data as:
PS /home/nicholas>
Quoted text · 4 lines
PS /home/nicholas> $data = @{ >> customer = 'something' >> name = 'whatever' >> }
PS /home/nicholas>
PS /home/nicholas> ($data | ConvertTo-Xml).OuterXml
<?xml version="1.0" encoding="utf-8"?><Objects><Object
Type="System.Collections.Hashtable"><Property Name="Key"
Type="System.String">name</Property><Property Name="Value"
Type="System.String">whatever</Property><Property Name="Key"
Type="System.String">customer</Property><Property Name="Value"
Type="System.String">something</Property></Object></Objects>
PS /home/nicholas>what would be some different ways of importing this data into BaseX? Certainly, the above XML can simply be written to a file, but what might something, from within powershell, a bit more automated?
thanks,
Nick
MH
Martin Honnen18 Nov 2020 08:42 #
Quoted text · Nicholas · 25 lines
On 18.11.2020 01:47, Nicholas wrote: > for some simple data as: > > > PS /home/nicholas> > PS /home/nicholas> $data = @{ > >> customer = 'something' > >> name = 'whatever' > >> } > PS /home/nicholas> > PS /home/nicholas> ($data | ConvertTo-Xml).OuterXml > <?xml version="1.0" encoding="utf-8"?><Objects><Object > Type="System.Collections.Hashtable"><Property Name="Key" > Type="System.String">name</Property><Property Name="Value" > Type="System.String">whatever</Property><Property Name="Key" > Type="System.String">customer</Property><Property Name="Value" > Type="System.String">something</Property></Object></Objects> > PS /home/nicholas> > > > what would be some different ways of importing this data into BaseX? > Certainly, the above XML can simply be written to a file, but what > might something, from within powershell, a bit more automated? > >
Well, Powershell is .NET based so the BaseX .NET/C# client
https://github.com/BaseXdb/basex/blob/master/basex-api/src/main/c%23/BaseXClient.cs could be used.
Written for BaseX 9.4. BaseX may have changed since: please check the current documentation.
⚡Generated with XQuery