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)
-> + Sample XQuery extension using ... (2)
-> + Another EDI problem (7)
-> - Removing xmls:od and xmls:xsi ... (2)
-> ->Removing xmls:od and xmls...
-> + Configuring MarkLogic with Sty... (10)
-> + EDI to XML (7)
-> + Can't write to SQL-Server (4)
-> + XQuery and SQL-Server (2)
-> + Connection to MS SQL Server in... (2)
-> + copy/modify with Stylus Studio... (5)
-> - copy/modify with Stylus Studio... (1)
-> + [SQLServer JDBC Driver]Value c... (5)
-> + wild card chracter usage in XS... (2)
-> + Xquery with SQL NEWID function (4)
-> + Change Only One Line (5)
-> + Format DB xQuery results (3)
-> + Adding MsSQL Database to XQuer... (3)
-> + Need help with using XQuery in... (2)
-> + please help! simple XML transf... (2)
-> + xquery for invoice data (3)
-> + Xquery to cross reference two ... (3)
-- 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: 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.