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
Topic Page 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Go to previous topicPrev TopicGo to next topicNext Topic
Postnext
chih chungSubject: puzzle of XSD to XML output
Author: chih chung
Date: 20 Mar 2006 05:34 PM
Originally Posted: 20 Mar 2006 05:26 PM
Dear All,<br> <br> I am a new user to Stylus Studio 2006 enterprise edition (e.g build 501i) environment. I need to generate XML from XSD. My XSD is the following: <br> <br> <?xml version="1.0"?><br> <xsd:schema xmlns:xsd="<a rel="nofollow" href="http://www.w3.org/2001/XMLSchema"">">http://www.w3.org/2001/XMLSchema"</a> xmlns="<a rel="nofollow" href="http://gfs.swissre.com/edms/search_populated"">">http://gfs.swissre.com/edms/search_populated"</a> targetNamespace="<a rel="nofollow" href="http://gfs.swissre.com/edms/search_populated"">">http://gfs.swissre.com/edms/search_populated"</a> elementFormDefault="qualified"> <br> <br> <xsd:element name="gfs_edms" type="gfsedmsDataType"/><br> <br> <xsd:complexType name="gfsedmsDataType"><br> <xsd:all><br> <xsd:element name="gfs_id" type="xsd:string" maxOccurs="1" minOccurs="0" /><br> <xsd:element name="user_id" type="xsd:string" maxOccurs="1" minOccurs="0" /><br> <br> <!-- common attributes --><br> <xsd:element name="insured_name" type="xsd:string" maxOccurs="1" minOccurs="0" /><br> <xsd:element name="name_of_risk" type="xsd:string" maxOccurs="1" minOccurs="0" /><br> <br> <!-- reinsurance attributes --><br> <xsd:element name="profit_center_id" type="xsd:string" maxOccurs="1" minOccurs="0" /><br> <xsd:element name="profit_center_name" type="xsd:string" maxOccurs="1" minOccurs="0" /><br> <xsd:element name="main_lob_id" type="xsd:string" maxOccurs="1" minOccurs="0" /><br> <xsd:element name="main_lob_name" type="xsd:string" maxOccurs="1" minOccurs="0" /><br> <xsd:element name="sr_branch_id" type="xsd:string" maxOccurs="1" minOccurs="0" /><br> <xsd:element name="sr_branch_name" type="xsd:string" maxOccurs="1" minOccurs="0" /><br> <xsd:element name="inception" type="dateplusemptyType" maxOccurs="1" minOccurs="0" /><br> <xsd:element name="expiration" type="dateplusemptyType" maxOccurs="1" minOccurs="0" /><br> <br> <xsd:element name="cedent_id" type="xsd:string" maxOccurs="1" minOccurs="0" /><br> <xsd:element name="cedent_name" type="xsd:string" maxOccurs="1" minOccurs="0" /><br> <xsd:element name="cedent_city" type="xsd:string" maxOccurs="1" minOccurs="0" /><br> <xsd:element name="cedent_country" type="xsd:string" maxOccurs="1" minOccurs="0" /><br> <br> <xsd:element name="broker_id" type="xsd:string" maxOccurs="1" minOccurs="0" /><br> <xsd:element name="broker_name" type="xsd:string" maxOccurs="1" minOccurs="0" /><br> <xsd:element name="broker_city" type="xsd:string" maxOccurs="1" minOccurs="0" /><br> <xsd:element name="broker_country" type="xsd:string" maxOccurs="1" minOccurs="0" /><br> <br> <xsd:element name="doc_name" type="xsd:string" maxOccurs="1" minOccurs="0" /><br> <xsd:element name="doc_date" type="xsd:string" maxOccurs="1" minOccurs="0" /><br> <xsd:element name="doc_type_id" type="integerplusemptyType" maxOccurs="1" minOccurs="0" /><br> <xsd:element name="doc_type" type="xsd:string" maxOccurs="1" minOccurs="0" /><br> </xsd:all><br> <br> <xsd:attribute name="send_date" type="xsd:date"/><br> </xsd:complexType><br> <br> <xsd:simpleType name="dateplusemptyType"><br> <xsd:union><br> <xsd:simpleType><br> <xsd:restriction base="xsd:date"/><br> </xsd:simpleType><br> <br> <xsd:simpleType><br> <xsd:restriction base="xsd:string"><br> <xsd:enumeration value=""/><br> </xsd:restriction><br> </xsd:simpleType> <br> </xsd:union><br> </xsd:simpleType><br> <br> <xsd:simpleType name="integerplusemptyType"><br> <xsd:union><br> <xsd:simpleType><br> <xsd:restriction base="xsd:integer"/><br> </xsd:simpleType><br> <br> <xsd:simpleType><br> <xsd:restriction base="xsd:string"><br> <xsd:enumeration value=""/><br> </xsd:restriction><br> </xsd:simpleType> <br> </xsd:union><br> </xsd:simpleType><br> <br> </xsd:schema><br> <br> I used Document Wizards XML Schema to XML to select gfs_edms as the root element and also select Indent XML and check we---form menu bar options and got the following XML output:<br> <br> <?xml version="1.0"?><br> <p1:gfs_edms send_date="1999-01-21" xmlns:p1="<a rel="nofollow" href="http://gfs.swissre.com/edms/search_populated"">">http://gfs.swissre.com/edms/search_populated"</a> xmlns:xsi="<a rel="nofollow" href="http://www.w3.org/2001/XMLSchema-instance"">">http://www.w3.org/2001/XMLSchema-instance"</a><br> xsi:schemaLocation="<a rel="nofollow" href="http://gfs.swissre.com/edms/search_populated">http://gfs.swissre.com/edms/search_populated</a> file:///c:/1_pandc_assentis_template/XML%20schemes%20R1.5-PROD/gfs_edms_search_populated.xsd"><br> <!--Attribute send_date is optional--><br> <!--Element p1:gfs_id is optional--><br> <p1:gfs_id>string</p1:gfs_id><br> <!--Element p1:user_id is optional--><br> <p1:user_id>string</p1:user_id><br> <!--Element p1:insured_name is optional--><br> <p1:insured_name>string</p1:insured_name><br> <!--Element p1:name_of_risk is optional--><br> <p1:name_of_risk>string</p1:name_of_risk><br> <!--Element p1:profit_center_id is optional--><br> <p1:profit_center_id>string</p1:profit_center_id><br> <!--Element p1:profit_center_name is optional--><br> <p1:profit_center_name>string</p1:profit_center_name><br> <!--Element p1:main_lob_id is optional--><br> <p1:main_lob_id>string</p1:main_lob_id><br> <!--Element p1:main_lob_name is optional--><br> <p1:main_lob_name>string</p1:main_lob_name><br> <!--Element p1:sr_branch_id is optional--><br> <p1:sr_branch_id>string</p1:sr_branch_id><br> <!--Element p1:sr_branch_name is optional--><br> <p1:sr_branch_name>string</p1:sr_branch_name><br> <!--Element p1:inception is optional--><br> <p1:inception></p1:inception><br> <!--Element p1:expiration is optional--><br> <p1:expiration></p1:expiration><br> <!--Element p1:cedent_id is optional--><br> <p1:cedent_id>string</p1:cedent_id><br> <!--Element p1:cedent_name is optional--><br> <p1:cedent_name>string</p1:cedent_name><br> <!--Element p1:cedent_city is optional--><br> <p1:cedent_city>string</p1:cedent_city><br> <!--Element p1:cedent_country is optional--><br> <p1:cedent_country>string</p1:cedent_country><br> <!--Element p1:broker_id is optional--><br> <p1:broker_id>string</p1:broker_id><br> <!--Element p1:broker_name is optional--><br> <p1:broker_name>string</p1:broker_name><br> <!--Element p1:broker_city is optional--><br> <p1:broker_city>string</p1:broker_city><br> <!--Element p1:broker_country is optional--><br> <p1:broker_country>string</p1:broker_country><br> <!--Element p1:doc_name is optional--><br> <p1:doc_name>string</p1:doc_name><br> <!--Element p1:doc_date is optional--><br> <p1:doc_date>string</p1:doc_date><br> <!--Element p1:doc_type_id is optional--><br> <p1:doc_type_id></p1:doc_type_id><br> <!--Element p1:doc_type is optional--><br> <p1:doc_type>string</p1:doc_type><br> </p1:gfs_edms><br> <br> <br> I have some question about the XML outpot as the following: <br> 1) what is these P1: prefix in the name-value pairsuch as <p1:gfs_id>string</p1:gfs_id>?<br> <br> 2)what is the <!--Attribute send_date is optional--> come from? this field is not part of XSD at all?<br> <br> 3) It seems that XML didn't include the following simple type of XSD<br> as the following:<br> <br> <xsd:simpleType name="dateplusemptyType"><br> <xsd:union><br> <xsd:simpleType><br> <xsd:restriction base="xsd:date"/><br> </xsd:simpleType><br> <br> <xsd:simpleType><br> <xsd:restriction base="xsd:string"><br> <xsd:enumeration value=""/><br> </xsd:restriction><br> </xsd:simpleType> <br> </xsd:union><br> </xsd:simpleType><br> <br> <xsd:simpleType name="integerplusemptyType"><br> <xsd:union><br> <xsd:simpleType><br> <xsd:restriction base="xsd:integer"/><br> </xsd:simpleType><br> <br> <xsd:simpleType><br> <xsd:restriction base="xsd:string"><br> <xsd:enumeration value=""/><br> </xsd:restriction><br> </xsd:simpleType> <br> </xsd:union><br> </xsd:simpleType><br> <br> why? <br> <br> 4) whers is <xsd:all> of XSD in XML?<br> <br> 5) what is Make Canonical XML menu bar doing?<br> <br> I attach the XSD and XML output for your information. Thank for your reply.<br> <br> <br> Regards,<br> chih Chung<br> <br> <br> <br>


Unknowngfs_edms_search_populated.xsd
sample XSD

Unknowngfs_edms_search_populated.xml
xml output file

Postnext
Minollo I.Subject: puzzle of XSD to XML output
Author: Minollo I.
Date: 20 Mar 2006 06:15 PM
>1) what is these P1: prefix in the name-value pairsuch as ><p1:gfs_id>string</p1:gfs_id>?

Your XML Schema defines a target namespace, which means that all elements (not only the global ones, as you also defineselementFormDefault="qualified") need to be defined in a specific namespace. The XML Schema to XML wizard chooses to generate an explicit prefix for each namespace that should be used rather than overriding the default namespace; so, what you are seeing is equivalent to <gfs_id xmlns="http://gfs.swissre.com/edms/search_populated">string</gfs_id>

>2)what is the <!--Attribute send_date is optional--> come from? this
>field is not part of XSD at all?

As you may notice, that's an XML comment; it's output to help you understand the generated XML; you can control the generation of XML comments in Tools > Options > XML Schema Editor > XML Schema to XML

>3) It seems that XML didn't include the following simple type of
>XSD as the following...

I've asked engineering to take a look; I'll let you know if this is a limitation of the current wizard implementation.

>4) whers is <xsd:all> of XSD in XML?

It's implicit effect is to create the collection of the various elements as children of gfs_edms. What different behavior would you expect?

>5) what is Make Canonical XML menu bar doing?

That's described in the documentation; details here: http://www.stylusstudio.com/canonical_xml.html

Thanks,
Minollo

Postnext
Minollo I.Subject: puzzle of XSD to XML output
Author: Minollo I.
Date: 21 Mar 2006 09:33 AM
>>3) It seems that XML didn't include the following simple type of
>>XSD as the following...
>
>I've asked engineering to take a look; I'll let you know if this is a >limitation of the current wizard implementation.

Turns out this was a limitation in Stylus Studio 2006 (rel 1); Stylus Studio 2006 Release 2 fixes that problem. Release 2 will be available next week.

Thanks,
Minollo

Postnext
chih chungSubject: puzzle of XSD to XML output
Author: chih chung
Date: 22 Mar 2006 05:15 PM
Originally Posted: 22 Mar 2006 05:11 PM
Dear Minollo,<br> <br> Thank for your reply and it is very helpful. I have another question that you might help me:<br> <br> I have 1 XML (e.g. Casualty Certificate-v2_update.xml) that need to generate XML Schema. I use stylus studio version 46 to generate attached Casualty Certificate-v2_update_SS_46.xsd; I use stylus studio 2006 to generate attached Casualty Certificate-v2_update2006.xsd. I find that there are sigificant difference between these 2 XSDs such as the following:<br> <br> stylus studio version 46 output<br> <xsd:element name='doc_type' type='xsd:string'><br> </xsd:element><br> <br> stylus studio 2006 output <br> <xs:element ref="doc_type"/><br> <xs:element name="doc_type" type="xs:NCName"/><br> <br> My questions are:<br> <br> 1) what is the difference between prefix xsd and prefix xs? <br> 2) if we convert both Schema XSDs to XML file, do we get the same XML output? if not, which XSD is better to use? <br> <br> Thank for your advice.<br> <br> Regards,<br> Chih Chung <br> <br> <br>


UnknownCasualtyCertificate-v2_update_SS_46.xsd


UnknownCasualtyCertificate-v2_update.xml


UnknownCasualtyCertificate-v2_update2006.xsd

Posttop
Minollo I.Subject: puzzle of XSD to XML output
Author: Minollo I.
Date: 22 Mar 2006 05:22 PM
I would rely on what Stylus Studio 2006 generates; Stylus Studio 2006 relies on Trang (http://www.thaiopensource.com/relaxng/trang.html) for XML to XML Schema conversions, while older versions used simpler algorithms.

xs or xsd, or any other prefix, are equivalent as long as they are assigned to the same namespace URI.

Minollo

 
Topic Page 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 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.