Removing node using xquery?

You are declaring $feed as xs:anyAtomicType, but you are setting it and using it as a node.

You are declaring $feed as xs:anyAtomicType, but you are setting it and using it as a node. I'm actually suprised the query compiles. Try removing the xs:anyAtomicType or replacing it with element().

Also you only want @src to select your child node, not @libx:src. So declare namespace libx='libx.org/xml/libx2'; declare namespace atom='w3.org/2005/Atom'; declare variable $child_id as xs:string external; declare variable $parent_id as xs:string external; declare variable $doc_name as xs:string external; declare variable $feed := doc($doc_name)/atom:feed; let $parent_entry := $feed/atom:entryatom:id=$parent_id return delete node $parent_entry//libx:entry@src=$child_id.

I don't see any problem with the feed. I changed my xquery to "let $parent_entry := $feed/atom:entryatom:id=$parent_id return $parent_entry" after the declaration statements. When I run this query it returns the expected result.

But, when I change the query to let $parent_entry := $feed/atom:entryatom:id=$parent_id//libx:entry@src=$child_id return $parent_entry , the query returns nothing – sony Sep 24 '10 at 20:31 The result of returning $parent_entry := $feed/atom:entryatom:id=$parent_id is as follows:; 33 Process COinS 2009-02-19T01:05:31Z Builder The problem is with "//libx:entry@src=$child_id". But, unsure how to fix it – sony Sep 24 '10 at 20:32 Note: Parent_id in this case is 33 and child_id is 34 – sony Sep 24 '10 at 21:29.

Not knowing what the output or error is, I would guess that $parent_node isn't being set properly; that is, the query $feed/atom:entryatom:id=$parent_id isn't returning anything. I would try $feed/entryid=$parent_id for fun. Also, make sure $feed is getting set correctly as well, and also try removing the "atom:" from the declare variable $feed statement.As for a print statement (presumably to debug), that is probably specific to the vendor of database you are using.

If you are still using BaseX, run this query from the command line and add "-v" for output. Now that I look at that code again, I wonder why I used let $parent_entry... instead of declare variable $parent_entry.... xquery is a pain, isn't it? -tjw.

Didn't expect to catch you on stackoverflow hehe :D I am debugging the xqueries from the command line. Thanks! I tried returning $feed and $parent_entry and both return expected results.

Although when I try to set $parent_entry to $feed/atom:entryatom:id=$parent_id//libx:entry@src=$child_id it returns nothing . I still think the problem is with xpath expression or namespaces – sony Sep 24 '10 at 20:27.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions