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
Conferences Close Tree View
+ Stylus Studio Feature Requests (1192)
+ Stylus Studio Technical Forum (14621)
+ Website Feedback (249)
+ XSLT Help and Discussion (7625)
- XQuery Help and Discussion (2017)
-> + Issue with Processing Instruct... (2)
-> + problem converting json to XML... (2)
-> + Problem base64 decoding string... (3)
-> + Problems posting multipart for... (5)
-> + trouble with download of price... (2)
-> + Problem with http-post not bei... (3)
-> + path problem, xps_file:writeAl... (9)
-> + Xquery update support? (2)
-> + problem with Stylus studio try... (5)
-> + adding dtd reference to xml ou... (4)
-> + xquery escaping ambarsand when... (3)
-> + Whitespace problem when return... (5)
-> + Problem with namespace prefix ... (5)
-> - Sending via SFTP returns unexp... (1)
-> + Query and Sftp clent (4)
-> + xquery and try - catch (3)
-> + Query + ddtek:http-post optio... (5)
-> + Example files referenced in do... (3)
-> + Automatic Error Detection and ... (3)
-> + Working with result of ddtek:h... (2)
-- [1-20] [21-40] [41-60] Next
+ Stylus Studio FAQs (159)
+ Stylus Studio Code Samples & Utilities (364)
+ Stylus Studio Announcements (113)
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
(Deleted User) Subject: XQuery and eXist error processing an XMI file.
Author: (Deleted User)
Date: 11 Jun 2007 06:32 AM
Hi Jose,
the correct query to get an attribute is

{ $base_actor/@name }

Alberto

   
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.