XML Editor
Sign up for a WebBoard account Sign Up Keyword Search Search More Options... Options
Chat Rooms Chat Help Help News News Log in to WebBoard Log in Not Logged in
Show tree view Topic
Go to previous topicPrev TopicGo to next topicNext Topic
Postnext
Jose LacalSubject: XQuery and eXist error processing an XMI file.
Author: Jose Lacal
Date: 07 Jun 2007 12:36 PM
Hello, I am a newbie so this might be a stupid question.


a.) I have an XMI file (attached) generated through StarUML (a good F/OSS UML/MDA tool).


b.) I loaded the XMI file into eXist (a F/OSS native XML database).


c.) The following XQuery works as expected:

declare namespace UML = "href://org.omg/UML/1.3";
for $elem in doc("http://localhost:8080/exist/servlet/db/uml_usecases/UseCase03.xml")/XMI/XMI.content
let $base_actor := $elem/UML:Model/UML:Namespace.ownedElement/UML:Model/UML:Namespace.ownedElement/UML:Actor
let $base_tag := $elem/UML:TaggedValue
return
<UML:result>
{ $base_actor }
{ $base_tag }
</UML:result>

I get the following:

..clip..

<UML:Actor xmi.id ="UMLActor.23" name ="AB_Member" visibility ="public" isSpecification ="false" namespace ="UMLModel.2" supplierDependency ="UMLDependency.27 UMLDependency.31 UMLDependency.33" isRoot ="false" isLeaf ="false" isAbstract ="false" specialization ="UMLGeneralization.38"/>

..clip..



d.) Here is the problem: I want to extract individual values out of the UML:Actor node, for example:
* xmi.id ="UMLActor.23"
* name ="AB_Member"

So I modify the XQuery as follows:
{ $base_actor/name } instead of { $base_actor/ }
and now I do not get _any_ results under $base_actor, only under $base_tag

Then, if I modify the XQuery as follows:
{ $base_actor//@name }

I get:
Error found
XPST0081: No namespace defined for prefix request


Question:
How can I extract the values inside the UML:Actor node? Any suggestions appreciated. Regards.


Jose C. Lacal
Motorola
Boynton Beach, FL USA

Posttop
Alberto MassariSubject: XQuery and eXist error processing an XMI file.
Author: Alberto Massari
Date: 11 Jun 2007 06:32 AM
Hi Jose,
the correct query to get an attribute is

{ $base_actor/@name }

Alberto

 
Go to previous topicPrev TopicGo to next topicNext Topic
Download A Free Trial of Stylus Studio 6 XML Professional Edition Today! Powered by Stylus Studio, the world's leading XML IDE for XML, XSLT, XQuery, XML Schema, DTD, XPath, WSDL, XHTML, SQL/XML, and XML Mapping!  
go

Log In Options

Site Map | Privacy Policy | Terms of Use | Trademarks
Stylus Scoop XML Newsletter:
W3C Member
Stylus Studio® and DataDirect XQuery ™are from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2016 All Rights Reserved.