Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Inserting and removing data with QXmlQuery

Inserting and removing data with QXmlQuery

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 2.6k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    piemur2000
    wrote on last edited by
    #1

    Hello,

    I would like to know if it is possible to insert/modify/remove data with an XQuery using QXmlQuery?

    I found an "exemple":http://www.xmlmind.com/tutorials/XQueryUpdate/index.html of XQuery updating some data with the following query but I am not able to run it:
    @for $idattr in doc("data.xml")//ITEM/@Id (: selection :)
    return (
    delete node $idattr, (: update 1 :)
    insert node <NID>{string($idattr)}</NID> (: update 2 :)
    as first into $idattr/..
    )@
    I have the following error :
    syntax error, unexpected node, expecting )

    If it is not possible to use insert or delete how I am suppose to modify the content of a document?

    Thanks

    1 Reply Last reply
    0
    • A Offline
      A Offline
      AshkanV
      wrote on last edited by
      #2

      Hello
      I had the same problem. It is looks like that Qt currently only supports "Minimal Conformance" and yet does not support optional XQuery features as it is described here:

      QXMLQuery Features and Conformance:

      XQuery 1.0
      
      Qt XML Patterns aims at being a conformant XQuery processor. It adheres to Minimal Conformance and supports the Serialization Feature and the Full Axis Feature. Qt XML Patterns currently passes 97% of the tests in the XML Query Test Suite. Areas where conformance may be questionable and where behavior may be changed in future releases include:
      
      Some corner cases involving namespaces and element constructors are incorrect.
      XPath is a subset of XQuery and the implementation of Qt XML Patterns uses XPath 2.0 with XQuery 1.0.
      
      The specifications discusses conformance further: XQuery 1.0: An XML Query Language. W3C's XQuery testing effort can be of interest as well, XML Query Test Suite.
      
      Currently fn:collection() does not access any data set, and there is no API for providing data through the collection. As a result, evaluating fn:collection() returns the empty sequence. We intend to provide functionality for this in a future release of Qt.
      
      Only queries encoded in UTF-8 are supported.
      

      And here is the relation of XQuery update with "Minimal Conformance"

      So I guess this feature is not included in the current version of QXMLQuery

      Instead it is possible to use QDomDocument.

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved