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

 
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.