Urgent Problem: how to xquery this dependent schema.

Hi,
I don’t know how to access to any branch which uses other imported schema.
I mean, when I try to access for example to the branch of this schema “rp210Elements:FrameworkTitle” It return an error.
Can anybody help me?

This is a small fragment of my schema:


rp210Elements:FrameworkCodeEnglish </rp210Elements:FrameworkCode>
rp210Elements:FrameworkTitleNijinski Production version1</rp210Elements:FrameworkTitle>
rp210Elements:PrimaryExtEnglish</rp210Elements:PrimaryExt>

I have tested these two possibilities and they don’t work:

    for $b in input()//rp210Elements:FrameworkTitle
    return $b

    for $b in input()//rp210Elements:FrameworkTitle
    return $b

I will be very grateful if someone knows that because I’m stopped in my task.
Regards,
Diego

A little more information might help us answer your question. What did you expect to get? What do you mean by “don’t work”—did you get a result different from what you expected, or an error? If it was an error, what was the error message?

Also, I expect this was a copy/paste error, but your “two possibilities” look identical to me.

One other thing—in general, you should avoid ‘//’ in path expressions for performance reasons.

This is my involved schemas and the xml file test.
To remember the question I want to access to any branch which uses
other imported schema.
So when I try to access for example to the branch of this schema
“rp210Elements:FrameworkTitle” to get the element=“Nijinski Production
version1” I can’t do it.

This is a small fragment of my schema:


rp210Elements:FrameworkCodeEnglish </rp210Elements:FrameworkCode>
rp210Elements:FrameworkTitleNijinski Production
version1</rp210Elements:FrameworkTitle>
rp210Elements:PrimaryExtEnglish</rp210Elements:PrimaryExt>

I have tested these two possibilities and they don’t work:

   for $b in input()//rp210Elements:FrameworkTitle
   return $b

–>Do not return anything

   for $b in input()//FrameworkTitle
   return $b

–>It return the error: “namespace prefix undefined”, “code: INOXQE6354”

I also attached the xml file thet I try to query.
NOTE:the schemas are correctly inserted on Tamino.

Thanks for your help,
Regards,
Diego
DVD.xml (165 KB)

Hi Diego,

the XQuery cannot work, because you did not declare the namespace.
Hint: there is a documentation for each error code (e.g. INOXQE6354) in the manual. In this case it reads:


INOXQE6354  	Namespace prefix undefined
Explanation 	

The namespace declaration is missing.
Action 	

Include a namespace declaration in the XQuery prolog.

There is also a section on XQuery Syntax in the manual.

So you should change the query to something like


declare namespace rp210Elements="urn:SMPTE:Dictionary" 
for $b in input()//rp210Elements:FrameworkTitle 
return $b 

Regards

Harald

Thanks a lot, it really works!!!
My new problem is when I try to insert that query as Java code.
It works with the Tamino XQuery tool. But I have now a new problem, cos that line that include a namespace declaration in the XQuery prolog gives me an error.

In this case I got a result:
query = “for $b in input()/DVD/Media return $b”
TXQuery querysome = TXQuery.newInstance( query );

But in this query return the ERROR INOXQE6352:
“declare namespace rp210Elements=“urn:SMPTE:Dictionary” for $b in input()//rp210Elements:FrameworkTitle return $b”

I don’t know how could I solve it.
Can anyone help me? I will be very grateful for it.
Regards,
Diego