Hi Luca,

Sedna updates language is described here:

http://modis.ispras.ru/sedna/progguide/ProgGuidesu6.html#x12-440002.3

<http://modis.ispras.ru/sedna/progguide/ProgGuidesu6.html#x12-440002.3>in
your case you need something like:

update insert <Host><Name>test1</Name><FreeSpace>32</FreeSpace></Host> into
collection('Hosts')//Host

BTW, are you sure you want to insert Host into all other Host nodes?
collection('Hosts')//Host will return *all* Hosts. Also, why do you need
collection there? Probably, there should be something like:

update insert <Host><Name>test1</Name><FreeSpace>32</FreeSpace></Host> into
doc('Hosts')/Hosts

Ivan Shcheklein,
Sedna Team


Thank you for the pointers, I started again using the XQJ API. I still have
> some troubles inserting data into the Collection, however.
>
> Here is a code excerpt, followed by the error I get:
>
>   public boolean addHost(Host h) {
>     try
>     {
>       XStream xs = new XStream();
>       xs.alias("Host", h.getClass());
>       String xml = xs.toXML(h);
>       String query = "insert node " + xml + "  into
> collection('Hosts')//Host";
>       System.out.println(query);
>
>       XQExpression exp = xqconn.createExpression();
>       XQResultSequence rs = exp.executeQuery(query);
>       while(rs.next())
>         System.out.println("RSItem : " + rs.getItemAsString(null));
>
>       return true;
>
>     } catch (XQException e) {
>
>       System.err.println("Error adding Host entry into the database: " +
> e.getMessage());
>       return false;
>     }
>   }
>
> The full query looks like this :
> insert node <Host>
>   <Name>test1</Name>
>   <FreeSpace>32</FreeSpace>
> </Host>  into collection('Hosts')//Host
>
> And the error is :
> Invalid XQuery syntax, syntax does not pass static validation.
>
> Best Regards,
>
> Luca
>
------------------------------------------------------------------------------
Benefiting from Server Virtualization: Beyond Initial Workload 
Consolidation -- Increasing the use of server virtualization is a top
priority.Virtualization can reduce costs, simplify management, and improve 
application availability and disaster protection. Learn more about boosting 
the value of server virtualization. http://p.sf.net/sfu/vmware-sfdev2dev
_______________________________________________
Sedna-discussion mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sedna-discussion

Reply via email to