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)
-> + Multiple Sibling Matches (2)
-> + Issue with data($element) (4)
-> + convert text to xml from more ... (2)
-> + xquery syntax (2)
-> + SQL Table To XML using XQuery (4)
-> + delimiting values of attribute... (3)
-> + empty child nodes (9)
-> - Illegal XML characters (4)
-> ->Illegal XML characters
-> ->Illegal XML characters
-> ->Illegal XML characters
-> + Complete SQL Server database t... (34)
-> + Prevent xquery from converting... (8)
-> + Another edi question. (6)
-> + Running xquery with a source c... (4)
-> + xml to edi segment count quest (3)
-> + Running xquery from the comman... (7)
-> + How to change the node name in... (5)
-> + How to loop through a set of e... (10)
-> + Can I pass a parameter/vaiable... (3)
-> + generating an XML file (3)
-> + generating log files of Xquery... (2)
-> + Stylus Studio crashes when edi... (3)
-- Previous [181-200] [201-220] [221-240] Next
+ Stylus Studio FAQs (159)
+ Stylus Studio Code Samples & Utilities (364)
+ Stylus Studio Announcements (113)
Topic  
Postnext
Bernard QuinnSubject: Illegal XML characters
Author: Bernard Quinn
Date: 14 Aug 2008 11:33 AM
I have an XQuery built which generates the XML I need from a relational db (MS SQL Server 2005). I ocassionally get an "illegal xml character" error that kills the pull. Since studio obviously recognizes the bad character, is there a way to filter them out on the fly? Shouldn't there be a simple "drop anything illegal" filter available somewhere?

Postnext
Minollo I.Subject: Illegal XML characters
Author: Minollo I.
Date: 14 Aug 2008 11:44 AM
That actually shouldn't happen; characters pulled from the database which are not valid XML characters should just get escaped by the XQuery engine.

Can you narrow down the problem and provide more details about the context in which that error is reported?

Postnext
Bernard QuinnSubject: Illegal XML characters
Author: Bernard Quinn
Date: 14 Aug 2008 11:57 AM
I'm in studio, doing an XQuery that has a fairly complex mapping implemented. For certain records, when I run the query (in preview mode), I'll get:

[DataDirect][XQuery][err:SERE0006]The character '' is an invalid XML character.

details:

com.ddtek.xquery3.XQQueryException: [DataDirect][XQuery][err:SERE0006]The character '' is an invalid XML character.

at com.ddtek.xquery3.xqj.Util.XQQueryException(Util.java:376)

at com.ddtek.xquery3.xqj.Util.XQException(Util.java:250)

at com.ddtek.xquery3.xqj.layer.DDXQAbstractSequence.writeSequence(DDXQAbstractSequence.java:431)

Caused by: com.ddtek.xquery.util.XQueryException: [SER0017][DataDirect][XQuery][err:SERE0006]The character '' is an invalid XML character.

at com.ddtek.xquery.serialize.Serializer.writeEscaped(Serializer.java:1473)

at com.ddtek.xquery.serialize.Serializer.doXMLSerialization(Serializer.java:902)

at com.ddtek.xquery.serialize.Serializer.serialize(Serializer.java:491)

at com.ddtek.xquery.serialize.Serializer.serialize(Serializer.java:473)

at com.ddtek.xquery3.xqj.layer.DDXQAbstractSequence.writeSequence(DDXQAbstractSequence.java:427)

When this happens, no output is generated, all I know is that somewhere in the 1000 records I was working on, it found something bad.

Posttop
Minollo I.Subject: Illegal XML characters
Author: Minollo I.
Date: 21 Aug 2008 01:32 PM
 is indeed an invalid XML character. And there isn't a way to instruct the XQuery engine to skip/replace invalid XML character retrieved from the database.

Since you are using SQLServer 2005, you can try the following approach:

import module namespace ddtek-sql = "http://www.datadirect.com/xquery/sql-function" at "sqlfunctions_sqlserver.xq";
for $row in collection("MYTABLE")/MYTABLE
let $col := $row/column1
let $col := ddtek-sql:REPLACE($col, ddtek-sql:CHAR(xs:int(1)), "")
return $col

The sqlfunctions_sqlserver.xq can be found in the examples/ExternalFunctions directory of your DataDirect XQuery installation (or in <stylusstudiodir>\Components\DataDirect XQuery\examples" in a typical Stylus Studio installation).

For multiple illegal characters you could do:

import module namespace ddtek-sql = "http://www.datadirect.com/xquery/sql-function" at "sqlfunctions_sqlserver.xq";
for $row in collection("MYTABLE")/MYTABLE
let $col := $row/column1
let $col := ddtek-sql:REPLACE($col, ddtek-sql:CHAR(xs:int(1)), "")
let $col := ddtek-sql:REPLACE($col, ddtek-sql:CHAR(xs:int(2)), "")
return $col

   
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.