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. XQuery problem
Forum Updated to NodeBB v4.3 + New Features

XQuery problem

Scheduled Pinned Locked Moved General and Desktop
2 Posts 1 Posters 805 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.
  • N Offline
    N Offline
    nicky j
    wrote on last edited by
    #1

    Hey there,

    I am finally beginning to understand how to integrate XQuery and Qt, but I am still struggling a bit.
    I ran my application and it runs, but one of the features does not appear to be working.
    The console at the bottom gives me:
    @Error XPST0003 in file:sidebarQuery.xq, at line 1, column 1: syntax error, unexpected end of file@
    Is this a problem with my c++ code, XQuery code, or XML. I believe it is in the XQuery, but I am not sure what is wrong/where its wrong.
    Here is my code:

    C++:
    @void sideBar::initializeSideBar()
    {
    QFile xqueryFile("sidebarQuery.xq");
    xqueryFile.open(QIODevice::ReadWrite);

    QXmlQuery query;
    query.setQuery(&xqueryFile, QUrl::fromLocalFile(xqueryFile.fileName()));
    
    QString result;
    query.evaluateTo(&result);
    

    }
    @

    XQuery:
    @
    doc("sidebarApps.xml")/sidebarapps/app[pos = 1]/name
    @

    XML:
    @<?xml version="1.0" encoding="UTF-8"?>

    <sidebarapps>
    <app>
    <name></name>
    <url></url>
    <pos></pos>
    </app>

    <app>
    <name>"Google Drive"</name>
    <url></url>
    <pos>1</pos>
    </app>

    <app>
    <name>"Gmail"</name>
    <url></url>
    <pos>2</pos>
    </app>

    <app>
    <name>"Google Docs"</name>
    <url></url>
    <pos>3</pos>
    </app>

    <app>
    <name>"Google Calendar"</name>
    <url></url>
    <pos>4</pos>
    </app>

    <app>
    <name>"Facebook"</name>
    <url></url>
    <pos>5</pos>
    </app>

    <app>
    <name>"Twitter"</name>
    <url></url>
    <pos>6</pos>
    </app>
    </sidebarapps>
    @
    I don't think the problem lies in the C++ or the XML, but I thought I would just make sure by asking.

    Thanks for your time!

    1 Reply Last reply
    0
    • N Offline
      N Offline
      nicky j
      wrote on last edited by
      #2

      any ideas what I'm doing wrong?

      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