473,657 Members | 2,667 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

XML Schema Design

Hi,

I am trying to design the schema for an XML file.

The approach that I am planning to follow is to have 2 XSD files, each
containing some relevant information about the elements in the instance
document and then
planning to automatically generate the XML file from these 2 schema files
using the XMLSpy tool.

My doubt is - What is the best way to generate the xml file ? Are there any
best practices ? Any example would be of great help.

Regards,
Kanchana


Nov 11 '05 #1
3 1825
Kanchana D S wrote:
My doubt is - What is the best way to generate the xml file ? Are there any
best practices ? Any example would be of great help.

What's the point to generate dummy XML documents from schema? If you need it
for testing/debugging, XML Spy can do that as you noted.
--
Oleg Tkachenko
http://www.tkachenko.com/blog
Multiconn Technologies, Israel

Nov 11 '05 #2
Hi,

It will not be a dummy XML file, the xml file generated will contain the
mandatory elements and it can be refined and used with my application. But I
would like to rephrase my question here as my problem doesn't seem to have
been clear. The focus is not on the XML file, but the design of the XSD
files.

I have an xml file part of which can be shown as below :

<PANEL_CLUSTE R>
<ppDialogFile>P anelClusterDlg. resx</ppDialogFile>
<ppDeletable> 0</ppDeletable>
<ppDefault>1</ppDefault>
<ppSubNodesPoss ible>1</ppSubNodesPossi ble>
<ppMax_NN_NETWO RK>8</ppMax_NN_NETWOR K>
<ppHelpIndex>%r r80202</ppHelpIndex>
<ppIcoName>PANE L_CLUSTER.ico</ppIcoName> From Definition.xsd
<ppDisplayName> %rr80202</ppDisplayName>
<ppSaveName>%rr 80202</ppSaveName>
<spcheckdate>nu ll</spcheckdate>

<ppCompute_ppDi splayName_Stric t>%rr80202+""+$ rr20003</ppCompute_ppDis playNam
e_Strict>
<ppEnum_rr20004 >%rr91004</ppEnum_rr20004>
<rr20003 FLS="5,5">Clust er with 2 Magic-Panels</rr20003> From
Attributes.xsd
<rr20004 FLS="5,5">CT_UK </rr20004>
</PANEL_CLUSTER>

There will be 2 XSD files, one which contains the constraints for some
elements of the "PANEL_CLUS TER" element and the other which contains the
constraints for the remaining elements of the SAME "PANEL_CLUS TER" element.
The question is, how should these 2 XSD files be designed so that the final
XML file ( shown above ) can be validated against the 2 schemas. Are there
any help articles on how to build the XSD files and the syntax to be used?

I have tried it this way :

Say the first XSD file is called "Definition.xsd " and it is as below :

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefa ult="qualified" >
<xs:element name="PANEL_CLU STER">
<xs:complexType >
<xs:all>
<xs:element name="ppDialogF ile" type="xs:string "/>
<xs:element name="ppDeletab le" type="xs:boolea n"/>
<xs:element name="ppDefault " type="xs:boolea n"/>
<xs:element name="ppSubNode sPossible" type="xs:boolea n"/>
<xs:element name="ppMax_NN_ NETWORK" type="xs:byte"/>
<xs:element name="ppHelpInd ex" type="xs:string "/>
<xs:element name="ppIcoName " type="xs:string "/>
<xs:element name="ppDisplay Name" type="xs:string "/>
<xs:element name="ppSaveNam e" type="xs:string "/>
<xs:element name="spcheckda te" type="xs:string "/>
<xs:element name="ppCompute _ppDisplayName_ Strict"
type="xs:string "/>
<xs:element name="ppEnum_rr 20004" type="xs:string "/>
</xs:all>
</xs:complexType>
</xs:element>
</xs:schema>

And the second is called "Attribute. xsd" and in this file, I want to specify
the remaining 2 elements of the PANEL_CLUSTER element, namely "rr20003" and
"rr20004". For this, I "include" the Definition.xsd file in the
Attribute.xsd file and add the remaining elements as follows :

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefa ult="qualified" attributeFormDe fault="unqualif ied">
<xs:include schemaLocation= "Definition.xsd "/>
<xs:element ref="PANEL_CLUS TER">
<xs:complexType >
<xs:element name="rr20003">
<xs:complexType >
<xs:simpleConte nt>
<xs:extension base="xs:string ">
<xs:attribute name="FLS" type="xs:string "
use="required"/>
</xs:extension>
</xs:simpleConten t>
</xs:complexType>
</xs:element>
<xs:element name="rr20004">
<xs:complexType >
<xs:simpleConte nt>
<xs:extension base="xs:string ">
<xs:attribute name="FLS" type="xs:string "
use="required"/>
</xs:extension>
</xs:simpleConten t>
</xs:complexType>
</xs:element>
</xs:complexType>
</xs:element>
</xs:schema>

But this gives me an error saying the <xs:element ref="PANEL_CLUS TER"> is
not valid. Is there something wrong with what I am doing? Is there a better
way to accomplish the same goal ?

Regards,
Kanchana
Nov 11 '05 #3
Thanks so much, that was of great help!

Regards,
Kanchana


Nov 11 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2711
by: Gregg Williams | last post by:
Hi--I am having a problem designing a schema to fit my XML data, and I'm hoping that someone can help. Essentially, I have a schema in mind and two target vocabularies for it, where one vocabulary is a subset of the other. I will describe one part of the schema to give you an idea of what my problem is. The "big" schema calls for 0 or more selector elements, each containing a (required) name attribute and simple character data, as...
5
1901
by: Ralf Wahner | last post by:
Dear Masters of XML As I'm new to XML Schema I dare to ask a possibly recurring question: Given an element <elem> with two attributes @a and @b. The attributes are bound by the condition, that either both or none must be present, i.e. <elem a="val_a" b="val_b"/> or <elem/> is valid, whilst
4
2389
by: Gordon Dickens | last post by:
I have target xml to generate from schema. All of the XML instances have the same global element i.e. <base>. I would like to combine all of the schemas into a single schema where I could generate any of the specific instances. sample schema one: <?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"> <xs:element name="base">
1
1522
by: Jeff S | last post by:
Hello all, I'm trying to design a schema from which I can generate a typed dataset class. I'm having problems incorporating choice and enumerations in the schema and getting the xml results that I want. In the following example I want the TopElement to contain either a Car element *or* a Truck element, but not both. So I tried to use a Choice tag to accomplish this. However, The Car element is of type CarType which is a simpleType...
4
2616
by: cmc | last post by:
I need some clarification to help me understand the DB2 strucure more. The questions are about "implicit schema" 1. This is a very interest concpet that DB2 let every user to create new schema (as this is part of the PUBLIC group privilege - if I am not wrong). From a practical stand point, what is the application of such concept. 2. Suprisingly, if the schema is an implicitly created, everyone else can create objects in it too. What...
3
5629
by: Eric Lilja | last post by:
Hello again, I'm having a new problem converting a dtd to an xml schema. This once is a little bit more complicated than in my previous question. The following file validates correctly: <?xml version="1.0" encoding="utf-8"?> <!DOCTYPE books > <books> <book title="Winter's Heart" isbn="123456789"> <author name="Robert Jordan"/>
3
1943
by: Michael | last post by:
If I come up with an XML Schema, do I own the intellectual propertyrights for that schema? Can I legally restrict others from using that schema? I'm in the UK if that makes any difference...
8
2727
by: send.me.all.email | last post by:
Hi experts, which approaches would you suggest for: - Reading a database schema (tables, fields, relationships) from SQL Server 2005? - Visualizing the DB schema? For developing a DB tool the schema should be read from the server and then be visualized, e.g. like the SQL Server BI Development Studio
12
1497
by: Summercoolness | last post by:
I wonder instead of just brainstorming, there probably is a very standard and a simple way to do database schema design. let's say we are doing a website. the user can go over and type in the movie name and zipcode, and the website will return all the theaters showing that movie and at what time, for theaters in THAT zipcode only (for simplicity). so how do we just start and use a standard method that can be simple and very accurate...
0
8402
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8734
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8608
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7341
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5633
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4164
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4323
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1962
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1627
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.