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 (2016)
-> - Issue with Processing Instruct... (1)
-> + 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
Ethan SteinSubject: Removing xmls:od and xmls:xsi from output
Author: Ethan Stein
Date: 24 May 2009 05:41 AM
I have the following xquery to take several files from a directory and combine them into a single XML file. When I run it, the files are combined properly, however, the node of each file added has the following declaration added to it:
<Iowa_x0020_Integrated_x0020_1-0_x0020_1 xmlns:od="urn:schemas-microsoft-com:officedata" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

Would someone be kind of enough to tell me how to make sure this does not occur?

My xQuery is as follows:

declare namespace ext = "ddtekjava:com.emc.wellmark.FileUtils";
declare function ext:listFiles($path as xs:string) as xs:string external;
declare variable $xPRSXMLInput as document-node(element(*, xs:untyped)) external;
declare option ddtek:serialize "indent=yes";
declare option ddtek:xml-streaming 'yes';

<CustomerData>
{
let $root := $xPRSXMLInput/dataroot/path/text()
return
for $file in fn:tokenize(ext:listFiles($root), ",")[fn:matches(., ".xml")]
return
<IOWA_INTEGRATED>
{
doc(fn:concat($root, "/", $file))/dataroot/*
}
</IOWA_INTEGRATED>
}
</CustomerData>


And a sample output is as follows:

<CustomerData>
<IOWA_INTEGRATED>
<Iowa_x0020_Integrated_x0020_1-0_x0020_1 xmlns:od="urn:schemas-microsoft-com:officedata" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<grpcovkey>Z CMM 500 IA52 04/01/2009</grpcovkey>
<UWCorp>NonHMO</UWCorp>
<IntegratedDoc>N</IntegratedDoc>
<ProductType>Medical</ProductType>
...
</Iowa_x0020_Integrated_x0020_1-0_x0020_1>
<Iowa_x0020_Integrated_x0020_1-0_x0020_1 xmlns:od="urn:schemas-microsoft-com:officedata" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<grpcovkey>Z AS CB ASHSA1 07/01/2009</grpcovkey>
<UWCorp>NonHMO</UWCorp>
<IntegratedDoc>N</IntegratedDoc>
...



Thanks for the help.

Posttop
Ivan PedruzziSubject: Removing xmls:od and xmls:xsi from output
Author: Ivan Pedruzzi
Date: 27 May 2009 10:09 AM
Ethan,

The behaviour is dictated by the XQuery language.

You can define the namespace in the output document root to avoid the problem.

<CustomerData
xmlns:od="urn:schemas-microsoft-com:officedata">

The following query illustrates the solution

declare variable $d1 :=
<d1:root xmlns:d1="unr:d1">
<a>aaa</a>
<a>aaa</a>
<a>aaa</a>
</d1:root>;

declare variable $d2 :=
<d2:root xmlns:d2="unr:d2">
<a>aaa</a>
<a>aaa</a>
<a>aaa</a>
</d2:root>;

<root
xmlns:d1="unr:d1"
xmlns:d2="unr:d2">{
$d1//a,
$d2//a
}</root>


Hope this helps
Ivan Pedruzzi
Stylus Studio Team

   
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.