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)
-> + Issue with Processing Instruct... (2)
-> + 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
Roel van der HoevenSubject: EDI to XSD and validation
Author: Roel van der Hoeven
Date: 04 Jun 2009 05:42 AM
I have an XSD which was made through the document wizzard in SS. It is the COPRAR message (EDIFACT, 95B) using attached SEF file.

The XSD give me all groups/elements, seems correct at first sight. In the XSD Group_1 there is a collection of the following segments:

TDT
RFF (VON)
RFF (SSX)
LOC

The EDI file reads:
UNB+UNOA:4+NLRHNTMR0.EDI+NLRTMECTDCD2+080429:1542+17312454X'
UNH+COPRAR1+COPRAR:D:95B:UN:ITG12'
BGM+45+DOC MSG NUMBER+9'
RFF+XXX:1'
TDT+20+VOYAGENR TDT+1++ROAD RUNNER:172:ZZZ'
RFF+VON:VOYAGENR VON'
RFF+SSX:REFERENCE SSX'
LOC+9+SUITE 542:139:6+PLACE:::OLENTANGY'
NAD+CA+ACCOUNTS PAYABLE:160:ZZZ'
NAD+MR+NAD MR:160:ZZZ'
EQD+CN+F45++++4'
RFF+CN:RFF CN'
MEA+AAE+G+KGM:750'
CNT+16:30'
UNT+14+COPRAR1'
UNZ+1+1'

Which is correct. If I try to validate in the XQuery:

let $input := ddtek:validate(/EDIFACT,'../dictionaries/applications/ecs/xsd/ECS_COPRAR_IN.xsd')
return
<a:xlCoprar>
<a:xlAgentsVoyageNumber>
{
let $RFF_VON := for $RFF in $input/EDIFACT/COPRAR/GROUP_1/RFF where $RFF/RFF0101/text() = 'VON' return $RFF/RFF0102/text()
return
if( string-length($RFF_VON) > 0 ) then
$RFF_VON
else
$input/EDIFACT/COPRAR/GROUP_1/TDT/TDT02/text()
}
</a:xlAgentsVoyageNumber>
</a:xlCoprar>

I get the validation error:
[DataDirect][XQuery]Error in call to ddtek:validate(): Error in complex type GROUP_1: Ambiguous content model, element <RFF> appears more than once


Any thoughts on this one?


UnknownECS_COPRAR_M121(1).sef
SEF file

UnknownECS_COPRAR_IN.xsd
XSD

UnknownECS_COPRAR_M121.xquery
XQuery

UnknownCOPRAR_var(1).edi
EDI

Posttop
Roel van der HoevenSubject: EDI to XSD and validation
Author: Roel van der Hoeven
Date: 04 Jun 2009 06:10 AM
When I change the XSD from:

<xsd:complexType name="GROUP_1">
<xsd:sequence>
<xsd:element name="TDT" type="TDT"/>
<xsd:element name="RFF" type="RFF" minOccurs="0" maxOccurs="1"/>
<xsd:element name="RFF" type="RFF" minOccurs="0" maxOccurs="1"/>

<xsd:element name="LOC" type="LOC" minOccurs="0" maxOccurs="9"/>
</xsd:sequence>
</xsd:complexType>

to:
<xsd:complexType name="GROUP_1">
<xsd:sequence>
<xsd:element name="TDT" type="TDT"/>
<xsd:element name="RFF" type="RFF" minOccurs="0" maxOccurs="2"/>
<xsd:element name="LOC" type="LOC" minOccurs="0" maxOccurs="9"/>
</xsd:sequence>
</xsd:complexType>


It works, but then I get the error:
[DataDirect][XQuery]Error in call to ddtek:validate(): In content of element <GROUP_3>: The content model does not allow element <EQD> to appear here. Expected: NAD

The XSD (created by stylusstudio) reads:
<xsd:complexType name="GROUP_2">
<xsd:sequence>
<xsd:element name="NAD" type="NAD"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="GROUP_3">
<xsd:sequence>
<xsd:element name="NAD" type="NAD"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="GROUP_4">
<xsd:sequence>
<xsd:element name="EQD" type="EQD"/>
<xsd:element name="RFF" type="RFF"/>
<xsd:element name="MEA" type="MEA" minOccurs="0" maxOccurs="3"/>
</xsd:sequence>
</xsd:complexType>

So I got an NAD segment in group 2 and 1 in group 3. However when I check the raw output stylus studio gives it comes back with:

<GROUP_2>
<NAD>
<NAD01><!--3035: PARTY QUALIFIER-->CA<!--Carrier--></NAD01>
<NAD02>
<NAD0201><!--3039: Party id. identification-->ACCOUNTS PAYABLE</NAD0201>
<NAD0202><!--1131: Code list qualifier-->160<!--Party identification--></NAD0202>
<NAD0203><!--3055: Code list responsible agency, coded-->ZZZ<!--Mutually defined--></NAD0203>
</NAD02>
</NAD>
</GROUP_2>
<GROUP_2>
<NAD>
<NAD01><!--3035: PARTY QUALIFIER-->MR<!--Message recipient--></NAD01>
<NAD02>
<NAD0201><!--3039: Party id. identification-->NAD MR</NAD0201>
<NAD0202><!--1131: Code list qualifier-->160<!--Party identification--></NAD0202>
<NAD0203><!--3055: Code list responsible agency, coded-->ZZZ<!--Mutually defined--></NAD0203>
</NAD02>
</NAD>
</GROUP_2>
<GROUP_3>
<EQD>
<EQD01><!--8053: EQUIPMENT QUALIFIER-->CN<!--Container--></EQD01>
<EQD02>
<EQD0201><!--8260: Equipment identification number-->F45</EQD0201>
</EQD02>
<EQD06><!--8169: FULL/EMPTY INDICATOR, CODED-->4<!--Empty--></EQD06>
</EQD>
<RFF>
<RFF01>
<RFF0101><!--1153: Reference qualifier-->CN<!--Carrier's reference number--></RFF0101>
<RFF0102><!--1154: Reference number-->RFF CN</RFF0102>
</RFF01>
</RFF>
<MEA>
<MEA01><!--6311: MEASUREMENT APPLICATION QUALIFIER-->AAE<!--Measurement--></MEA01>
<MEA02>
<MEA0201><!--6313: Measurement dimension, coded-->G<!--Gross weight--></MEA0201>
</MEA02>
<MEA03>
<MEA0301><!--6411: Measure unit qualifier-->KGM</MEA0301>
<MEA0302><!--6314: Measurement value-->750</MEA0302>
</MEA03>
</MEA>
</GROUP_3>

So It skips 1 group, and changes group 4 into group 3...

A bit confused now.......

   
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.