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)
-> + How to resolve XPTY0004 error (3)
-> + Search a sequence of siblings ... (3)
-> + DataDirect process getting XPS... (2)
-> + Find the parent who doesn't ha... (3)
-> + Help with a basic FLWOR query (3)
-> + xQuery Efficient Performance B... (5)
-> + How to break down a sequence a... (3)
-> + Xquery returning odd number fo... (2)
-> + Problems with Java date parame... (3)
-> + Xquery filter on multiple valu... (2)
-> + Xquery filter by using contain... (5)
-> + multiple xslt execution using ... (2)
-> + How to access to global variab... (6)
-> + "Value can not be converted to... (4)
-> + (simple) problem with xquery (3)
-> + Version of xQuery Included wit... (3)
-> + xQuery 1.0 Produces XPTY0004 E... (3)
-> + Replace Node with Set of Nodes (2)
-> - Unable to Use File Name as Ext... (5)
-> ->Unable to Use File Name a...
-> ->Unable to Use File Name a...
-> ->Unable to Use File Name a...
-> ->Unable to Use File Name a...
-> + EDI to XSD and validation (2)
-- Previous [121-140] [141-160] [161-180] Next
+ Stylus Studio FAQs (159)
+ Stylus Studio Code Samples & Utilities (364)
+ Stylus Studio Announcements (113)
Topic  
Postnext
Ethan SteinSubject: Unable to Use File Name as External Variable With stylus Studio 2007 XML enterprise suite
Author: Ethan Stein
Date: 09 Jun 2009 06:59 PM
Originally Posted: 09 Jun 2009 06:58 PM
Moved to XQuery Help and Discussion Forum:
---------------------------------------------------

When I try to run the following xquery in Stylus Studio 2007 XML Enterprise Edition Build 894d, with the xPRSXMLInput external variable value of file:///C:/H0303015.xml, I get the following error:

Error encountered while initializing variable xPRSXMLInput with value file:///C:/H0303015.xml:

[DataDirect][XQuery][err:XPST0003]Error at line 1, column 6. Character ":" not allowed as start of a token.

I'm not sure what I'm doing wrong.

Please help. Thanks.

--------------------------
xQuery:

declare option ddtek:xml-streaming 'yes';
declare option ddtek:serialize "indent=yes, omit-xml-declaration=no";

declare variable $xPRSXMLInput as document-node(element(*, xs:untyped)) external;

declare function local:transformPlanName($planName as xs:string)
{
let $planName := fn:replace($planName, "AARP", "AARP®")
let $planName := fn:replace($planName, "MedicareComplete Essential", "MedicareComplete Essential®")
let $planName := fn:replace($planName, "Evercare", "Evercare®")
let $planName := fn:replace($planName, "MedicareComplete Choice", "MedicareComplete Choice®")
let $planName := fn:replace($planName, "Erickson Advantage", "Erickson Advantage®")
let $planName := fn:replace($planName, "SecureHorizons ", "SecureHorizons ®")
let $planName := fn:replace($planName, "MedicareComplete Plus", "MedicareComplete Plus™")
let $planName := fn:replace($planName, "MedicareComplete Value", "MedicareComplete Value™")
let $planName := fn:replace($planName, "MedicareComplete Premier", "MedicareComplete Premier™")
let $planName := fn:replace($planName, "MedicareComplete Balance", "MedicareComplete Balance™")
let $planName := fn:replace($planName, "MedicareComplete Mosaic", "MedicareComplete Mosaic™")
let $planName := fn:replace($planName, "MedicareDirect", "MedicareDirectࡈ")
return
if(fn:contains($planName, "MedicareComplete") and not(fn:contains($planName, "Essential")) and not(fn:contains($planName, "Choice")) and not(fn:contains($planName, "Plus")) and not(fn:contains($planName, "Value")) and not(fn:contains($planName, "Premier")) and not(fn:contains($planName, "Balance")) and not(fn:contains($planName, "Mosaic"))) then fn:replace($planName, "MedicareComplete", "MedicareComplete®")
else $planName
};

declare function local:rename($n as element(*, xs:untyped))
{
element { name($n) } {$n/@*,
if(starts-with(upper-case(local-name($n)), "PLANNAME")) then local:transformPlanName($n/text())
else
($n/text(),
for $child in $n/*
return local:rename($child))}
};

<ExtractData>
{
for $CurrentYearPlan in $xPRSXMLInput/ExtractData/CurrentYearPlan
return
local:rename($CurrentYearPlan)
}
</ExtractData>

Postnext
Ethan SteinSubject: Unable to Use File Name as External Variable With stylus Studio 2007 XML enterprise suite
Author: Ethan Stein
Date: 09 Jun 2009 07:07 PM
Okay, so I was able to get past that error if I assign the external variable to doc('C:\H0303015.xml')

However, now I get a different error when I try to run it against the DataDirect xQuery processor:

Error encountered while initializing variable xPRSXMLInput with value doc('C:\H0303015.xml'):

[DataDirect][XQuery][err:FODC0005]Exception returned by Adaptor (Streaming Adaptor) : java.net.URISyntaxException: Illegal character in opaque part at index 2: C:\H0303015.xml


Any ideas what this means?

Postnext
Ethan SteinSubject: Unable to Use File Name as External Variable With stylus Studio 2007 XML enterprise suite
Author: Ethan Stein
Date: 09 Jun 2009 08:01 PM
Okay, issue was due to file name requiring "/" instead of "\".

Postnext
(Deleted User) Subject: Unable to Use File Name as External Variable With stylus Studio 2007 XML enterprise suite
Author: (Deleted User)
Date: 10 Jun 2009 03:35 AM
The argument for the doc() function must be a valid URI, and that implies using / as separator, and escaping non-latin characters (as well as spaces) with their HTML-escaped representation, e.g. %20

Alberto

Posttop
Ethan SteinSubject: Unable to Use File Name as External Variable With stylus Studio 2007 XML enterprise suite
Author: Ethan Stein
Date: 10 Jun 2009 04:20 AM
Good to know. Thanks.

   
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.