Search Results

Search found 108 results on 5 pages for 'xquery'.

Page 2/5 | < Previous Page | 1 2 3 4 5  | Next Page >

  • How to get node without children in xQuery?

    - by mbrevoort
    So I have two nodes of elements that I'm essentially trying to join. I want the top level node to stay the same but the child nodes to be replaced by those cross referenced. Given: <stuff> <item foo="foo" boo="1"/> <item foo="bar" boo="2" /> <item foo="baz" boo="3"/> <item foo="blah boo="4""/> </stuff> <list a="1" b="2"> <foo>bar</foo> <foo>baz</foo> </list> I want to loop through "list" and cross reference elements in "stuff" for this result: <list a="1" b="2"> <item foo="bar" boo="2" /> <item foo="baz" boo="3"/> </list> I want to do this without having to know about what attributes might be on "list". In other words I don't want to have to explicitly call them out like attribute a { $list/@a }, attribute b { $list/@b }

    Read the article

  • xpath for xquery in SQL

    - by Haroldis
    Hi all, I have a xml filed in sql table the xml have the structure like these <root> <element> <sub name="1"> <date>the date <date> </sub> <sub name="2"> <date>the date <date> </sub> <sub name="3"> <date>the date <date> </sub> ..... <element> </root> how i can get the date of the element with the name 1? I have prove : /root/element/sub[Name = "1"]/date/text() but nothing hapen. any ideas?

    Read the article

  • Qt XQuery into a QStringList

    - by Stewart
    Hi, I'm trying to use QtXmlQuery to extract some data from XML. I'd like to put this into a QStringList. I try the following: QByteArray in = "this is where my xml lives"; QBuffer received; received.setData(in); received.open(QIODevice::ReadOnly); QXmlQuery query; query.bindVariable("data", &received); query.setQuery(NAMESPACE //contains definition of the t namespace "doc($data)//t:service/t:serviceID/text()"); QBuffer outb; outb.open(QIODevice::ReadWrite); QXmlSerializer s(query, &outb); query.evaluateTo(&s); qDebug() << "buffer" << outb.data(); //This works perfectly! QStringList * queryResult = new QStringList(); query.evaluateTo(queryResult); qDebug() << "string list" << *queryResult; //This gives me no output! As you can see, everything works fine when I send the output into a QBuffer via a QXmlSerializer... but I get nothing when I try to use a QStringList.

    Read the article

  • How to indicate 'missing' tags in XQuery?

    - by Stewart
    I have an XML file: $xml := <xml> <element> <text>blahblah</text> </element> <element> </element> <element> <text>blahblah</text> </element> </xml> I can use the query for $x in $xml/xml/element/text return string($x) This gives me a list blahblah blahblah with no indication that there is an element which has no element. What I'd like to do is use a query which, if there is no such element, returns, say "missing". How do I do this?

    Read the article

  • How to get tag parameter value with XQuery

    - by uni
    For example i have this xml. I need to get value of parameter val of tag foo with id="two" <top> <sub id="one"> <foo id="two" val="bar" /> sometext </sub> </top> Whis this query (using Qt QXmlQuery): doc('test.xml')/top/sub[@id='one']/foo[@id='two']/<p>{@val}</p> I receive <p val="bar"/>, but I need only text "bar" without any tags. I tried to remove <p> and </p> and receive syntax error, unexpected { How can i get parameter value without any tags?

    Read the article

  • Is there an XML XQuery interface to existing XML files?

    - by xsaero00
    My company is in education industry and we use XML to store course content. We also store some course related information (mostly metainfo) in relational database. Right now we are in the process of switching from our proprietary XML Schema to DocBook 5. Along with the switch we want to move course related information from database to XML files. The reason for this is to have all course data in one place and to put it under Subversion. However, we would like to keep flexibility of the relational database and be able to easily extract specific information about a course from an XML document. XQuery seems to be up to the task so I was researching databases that supports it but so far could not find what I needed. What I basically want, is to have my XML files in a certain directory structure and then on top of this I would like to have a system that would index my files and let me select anything out of any file using XQuery. This way I can have "my cake and eat it too": I will have XQuery interface and still keep my files in plain text and versioned. Is there anything out there at least remotely resembling to what I want? If you think that what I an asking for is nonsense please make an alternative suggestion. On the related note: What XML Databases (preferably native and open source) do you have experience with and what would you recommend?

    Read the article

  • How do you convert a string to a node in XQuery?

    - by Sixty4Bit
    I would like to convert a string into a node. I have a method that is defined to take a node, but the value I have is a string (it is hard coded). How do I turn that string into a node? So, given an XQuery method: define function foo($bar as node()*) as node() { (: unimportant details :) } I have a string that I want to pass to the foo method. How do I convert the string to a node so that the method will accept the string.

    Read the article

  • Finding the XPath with the node name

    - by julien.schneider(at)oracle.com
    A function that i find missing is to get the Xpath expression of a node. For example, suppose i only know the node name <theNode>, i'd like to get its complete path /Where/is/theNode.   Using this rather simple Xquery you can easily get the path to your node. declare namespace orcl = "http://www.oracle.com/weblogic_soa_and_more"; declare function orcl:findXpath($path as element()*) as xs:string { if(local-name($path/..)='') then local-name($path) else concat(orcl:findXpath($path/..),'/',local-name($path)) }; declare function orcl:PathFinder($inputRecord as element(), $path as element()) as element(*) { { for $index in $inputRecord//*[local-name()=$path/text()] return orcl:findXpath($index) } }; declare variable $inputRecord as element() external; declare variable $path as element() external; orcl:PathFinder($inputRecord, $path)   With a path         <myNode>nodeName</myNode>  and a message         <node1><node2><nodeName>test</nodeName></node2></node1>  the result will be         node1/node2/nodeName   This is particularly useful when you use the Validate action of OSB because Validate only returns the xml node which is in error and not the full location itself. The following OSB project reuses this Xquery to reformat the result of the Validate Action. Just send an invalid xml like <myElem http://blogs.oracle.com/weblogic_soa_and_more"http://blogs.oracle.com/weblogic_soa_and_more">      <mySubElem>      </mySubElem></myElem>   you'll get as nice <MessageIsNotValid> <ErrorDetail  nbr="1"> <dataElementhPath>Body/myElem/mySubElem</dataElementhPath> <message> Expected element 'Subelem1@http://blogs.oracle.com/weblogic_soa_and_more' before the end of the content in element mySubElem@http://blogs.oracle.com/weblogic_soa_and_more </message> </ErrorDetail> </MessageIsNotValid>   Download the OSB project : sbconfig_xpath.jar   Enjoy.            

    Read the article

  • How do I use QXmlQuery properly? (Qt XQuery/XPath)

    - by Steven Jackson
    I'm using the following code to load in an XML file (actually an NZB): QXmlQuery query; query.bindVariable("path", QVariant(path)); query.setQuery("doc($path)/nzb/file/segments/segment/string()"); if(!query.isValid()) throw QString("Invalid query."); QStringList segments; if(!query.evaluateTo(&segments)) throw QString("Unable to evaluate..."); QString string; foreach(string, segments) qDebug() << "String: " << string; With the following input, it works as expected: <?xml version="1.0" encoding="iso-8859-1" ?> <!DOCTYPE nzb PUBLIC "-//newzBin//DTD NZB 1.0//EN" "http://www.newzbin.com/DTD/nzb/nzb-1.0.dtd"> <nzb> <file> <groups> <group>alt.binaries.cd.image</group> </groups> <segments> <segment>[email protected]</segment> </segments> </file> </nzb> However, with the following input no results are returned. This is how the input should be formatted, with attributes: <?xml version="1.0" encoding="iso-8859-1" ?> <!DOCTYPE nzb PUBLIC "-//newzBin//DTD NZB 1.0//EN" "http://www.newzbin.com/DTD/nzb/nzb-1.0.dtd"> <nzb xmlns="http://www.newzbin.com/DTD/2003/nzb"> <file poster="[email protected]" date="1225385180" subject="ubuntu-8.10-desktop-i386 - ubuntu-8.10-desktop-i386.par2 (1/1)"> <groups> <group>alt.binaries.cd.image</group> </groups> <segments> <segment bytes="66196" number="1">[email protected]</segment> <segment bytes="661967" number="1">[email protected]</segment> </segments> </file> </nzb> Please can someone tell me what I'm doing wrong?

    Read the article

  • XQuery performance in SQL Server

    - by Carl Hörberg
    Why does this quite simple xquery takes 10min to execute in sql server (the 2mb xml document stored in one column) compared to 14 seconds when using oxygen/file based querying? SELECT model.query('declare default element namespace "http://www.sbml.org/sbml/level2"; for $all_species in //species, $all_reactions in //reaction where data($all_species/@compartment)="plasma_membrane" and $all_reactions/listOfReactants/speciesReference/@species=$all_species/@id return <result>{data($all_species/@id)}</result>') from sbml;

    Read the article

  • XML XQUERY Problem with NTEXT data type

    - by johnfa
    Hello I want to use XQuery on a column of data type NTEXT (I have no choice!). I have tried converting the column to XML using CONVERT but it gives the error: Incorrect syntax near the keyword 'CONVERT'. Here's the query SELECT y.item.value('@UserID', 'varchar(50)') AS UnitID, y.item.value('@ListingID', 'varchar(100)') AS @ListingID FROM dbo.KB_XMod_Modules CROSS APPLY CONVERT(xml, instancedata).nodes('//instance') AS y(item) (instancedata is my column) Can anyone think of a work around for this ? Thanks

    Read the article

  • Xpath or xquery and test the order

    - by mada
    Hi, Using SoapUI (great tool for WS by the way), I have the following xml result : <code>c</code> <code>b</code> <code>a</code> For this sample above, i would like to test the code value are order asc. Of course, for this sample the test will fail like excepted. Any solution with xquery or xpath (i can use groovy inside the test if necessary) Thanks in advance.

    Read the article

  • Getting XQuery [modify()]: Top-level attribute nodes are not supported error while modifying xml

    - by sam
    DECLARE @mycur CURSOR DECLARE @id int DECLARE @ParentNodeName varchar(max) DECLARE @NodeName varchar(max) DECLARE @NodeText varchar(max) SET @mycur = CURSOR FOR SELECT * FROM @temp OPEN @mycur FETCH NEXT FROM @mycur INTO @id,@ParentNodeName,@NodeName,@NodeText WHILE @@FETCH_STATUS = 0 BEGIN PRINT @id -- sample statements PRINT @ParentNodeName PRINT @NodeName SET @x.modify (' insert attribute status {sql:variable("@status")} as first into (/@ParentNodeName/@NodeName/child::*[position()=sql:variable("@status")])[1] ') FETCH NEXT FROM @mycur INTO @id,@ParentNodeName,@NodeName,@NodeText END DEALLOCATE @mycur Any idea why I am getting this error as query works fine if I manually insert path

    Read the article

  • updating multiple nodes in xml with xquery and xdmp:node-replace

    - by morja
    Hi all, I wnat to update an XML document in my xml database (Marklogic). I have xml as input and want to replace each node that exists in the target xml. If a node does not exist it would be great if it gets added, but thats maybe another task. My XML in the database: <user> <username>username</username> <firstname>firstname</firstname> <lastname>lastname</lastname> <email>[email protected]</email> <comment>comment</comment> </user> The value of $user_xml: <user> <firstname>new firstname</firstname> <lastname>new lastname</lastname> </user> My function so far: declare function update-user ( $username as xs:string, $user_xml as node()) as empty-sequence() { let $uri := user-uri($username) return for $node in $user_xml/user return xdmp:node-replace(fn:doc($uri)/user/fn:node-name($node), $node) }; First of all I cannot iterate over $user_xml/user. If I try to iterate over $user_xml I get "arg1 is not of type node()" exception. But maybe its the wrong approach anyway? Does anybody maybe have sample code how to do this?

    Read the article

  • SOAPUI Extract data from SOAP Response and use in REST request

    - by Adrian
    I have been looking at the answer to this question: Pulling details from response to new request SoapUI which is similar to what I am looking for but I can't get it to work. I have a small SOAPUI testsuite and I need to extract a value from the response of a SOAP request and then use this value in a subsequent REST request. The response to my SOAP request is: <ns0:session xmlns:ns0="http://www.someurl.com/la/la/v1_0"> <token>AQIC5wM2xAAIwMg==#</token> </ns0:session> so I need the token to use in my REST request. I know it involves using Property Transfer and some XPath / XQuery but I just can't get it right. At the moment my property transfer window points to Source: SOAP test Property: Response and has data(/session/token/text()) in the text box. In target it has Target: REST testcase Property: newProp and I have Use XQuery checked. Any help greatly appreciated. Thanks, Adrian

    Read the article

  • svg data visualizations

    - by garymlewis
    I'd like to experiment with SVG as a way of displaying data-driven graphs, charts, etc. The data exists as xml, and I'll use XQuery to produce the xml. What options (eg, graphics libraries) should I consider for creating the SVG from the xml? Many thanks.

    Read the article

  • Création du forum XQUERY et base de données XML, dédié aux utilisations de XML comme base de données ou avec des SGBD relationnels

    Création d'un forum XQUERY et base de donnée XML dédié aux utilisation de XML en tant que base de donnée ou avec des SGBD relationnels Le développement du format XML, en particulier dans un contexte d'utilisation documentaire (Ooo, word...) mais aussi d'échange de donnée, dut à la complexification de ces mêmes données, a amené à une interaction accrue entre les fichiers XML et les SGBD. Différentes types de solutions ont vues le jour :ensemble de fichier XML intégration dans des SGBD relationnels SGBD XML natif ... Et différents langages d'extraction/constitution pour utiliser ces même données , en fonction de l'environnement...

    Read the article

  • Indexing XMLType columns

    - by Chris
    Hello, I am working with a XMLType and currently experiencing significant performance issues and would like to incorporate indexing to the column type. Currently I am taking the approach of using the XMLTable() and XQuery functions to create a virtual table. I would like to use this Virtual Table to create a function based index on the table containing the XMLType, but I am receiving this error: Error report: SQL Error: ORA-00907: missing right parenthesis 00907. 00000 - "missing right parenthesis" *Cause: *Action: This is the index.. any assistance would be greatly appreciated. CREATE INDEX indx_medicinalproduct ON d.ProductName XMLTable('for $i at $a in /safetyreport/patient//drug for $j in $i/medicinalproduct return element r { $i/medicinalproduct }' PASSING s.safetyreport COLUMNS ProductName varchar2(70) PATH 'medicinalproduct') d;

    Read the article

< Previous Page | 1 2 3 4 5  | Next Page >