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)
-> - Stylus Studio - Registrar en o... (1)
-> + Stylus Studio - Registrar en o... (2)
-> + Can a pipeline send a file by ... (2)
-> + After Updateing WIN10 to WIN11... (12)
-> + Where do I add the custom java... (3)
-> + Where is the Diagram tab? (5)
-> + Applying XSLT to Word DOCX/XML (2)
-> - CSV conversion via ConvertToXM... (1)
-> + Text symbols in SS not same as... (4)
-> + Exposing xquery as webservice ... (6)
-> + Syntax Identifier (2)
-> + Saving a Converted XML as an X... (5)
-> + Output document cannot be pars... (4)
-> - Archiving output from conversi... (1)
-> + EDIFACT guideline from Stylus ... (3)
-> + CSV file putting all the data ... (5)
-> + Can't install Home version 64b... (5)
-> + presale - Can I covers this sc... (5)
-> + Problem with UNB (5)
-> + Splitting EDIFACT files pipeli... (4)
-- [1-20] [21-40] [41-60] Next
+ Website Feedback (249)
+ XSLT Help and Discussion (7625)
+ XQuery Help and Discussion (2017)
+ Stylus Studio FAQs (159)
+ Stylus Studio Code Samples & Utilities (364)
+ Stylus Studio Announcements (113)
Topic  
Postnext
dinesh ramSubject: Schema Newbie
Author: dinesh ram
Date: 11 Jul 2006 11:14 PM
Hi,

This is in regard to usage of global elements in schema. This is the structure for a 'Product' having multiple 'Charge' component.

<xsd:element name="Product">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="Charge" maxOccurs="unbounded" minOccurs="0"/>
</xsd:sequence>
<xsd:attribute name="Name" type="xsd:string" use="optional"/>
<xsd:attribute name="ID" type="xsd:string" use="optional"/>
<xsd:attribute name="Desc" type="xsd:string" use="optional"/>
</xsd:complexType>
</xsd:element>

I have defined Charge component independently.

<xsd:element name="Charge">
<xsd:complexType>
<xsd:attribute name="Amount" type="xsd:string"/>
<xsd:attribute name="Description" type="xsd:string"/>
</xsd:complexType>
</xsd:element>

Should I be using the 'Charge' as a ref directly in Product or should I need to use a element of type 'Charge' in Product structure?

Kindly advise.

Regards

Posttop
Ivan PedruzziSubject: Schema Newbie
Author: Ivan Pedruzzi
Date: 13 Jul 2006 12:55 AM

Hi Dinesh,

It's a design choice.

If you decide to use a reference you need to define a global element as well. All global element are considered when validating a document root.

If you are planning to use "Charge" only as child element of other elements then you should consider to define a global complex type.
See the attached example product-charge.xsd

If you need to create just a group of attributes to re-use you should consider the AttributeGroup construct.
See the attached example product-charge-attributegroup.xsd


Hope this helps
Ivan Pedruzzi
Stylus Studio Team


DocumentProduct-charge.xsd


DocumentProduct-charge-attributegroup.xsd

   
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.