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
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.

 
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.