XQuery problem



  • 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!



  • any ideas what I'm doing wrong?


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.