473,385 Members | 1,753 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

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 1801
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_CLUSTER>
<ppDialogFile>PanelClusterDlg.resx</ppDialogFile>
<ppDeletable>0</ppDeletable>
<ppDefault>1</ppDefault>
<ppSubNodesPossible>1</ppSubNodesPossible>
<ppMax_NN_NETWORK>8</ppMax_NN_NETWORK>
<ppHelpIndex>%rr80202</ppHelpIndex>
<ppIcoName>PANEL_CLUSTER.ico</ppIcoName> From Definition.xsd
<ppDisplayName>%rr80202</ppDisplayName>
<ppSaveName>%rr80202</ppSaveName>
<spcheckdate>null</spcheckdate>

<ppCompute_ppDisplayName_Strict>%rr80202+""+$rr200 03</ppCompute_ppDisplayNam
e_Strict>
<ppEnum_rr20004>%rr91004</ppEnum_rr20004>
<rr20003 FLS="5,5">Cluster 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_CLUSTER" element and the other which contains the
constraints for the remaining elements of the SAME "PANEL_CLUSTER" 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"
elementFormDefault="qualified">
<xs:element name="PANEL_CLUSTER">
<xs:complexType>
<xs:all>
<xs:element name="ppDialogFile" type="xs:string"/>
<xs:element name="ppDeletable" type="xs:boolean"/>
<xs:element name="ppDefault" type="xs:boolean"/>
<xs:element name="ppSubNodesPossible" type="xs:boolean"/>
<xs:element name="ppMax_NN_NETWORK" type="xs:byte"/>
<xs:element name="ppHelpIndex" type="xs:string"/>
<xs:element name="ppIcoName" type="xs:string"/>
<xs:element name="ppDisplayName" type="xs:string"/>
<xs:element name="ppSaveName" type="xs:string"/>
<xs:element name="spcheckdate" type="xs:string"/>
<xs:element name="ppCompute_ppDisplayName_Strict"
type="xs:string"/>
<xs:element name="ppEnum_rr20004" 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"
elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:include schemaLocation="Definition.xsd"/>
<xs:element ref="PANEL_CLUSTER">
<xs:complexType>
<xs:element name="rr20003">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="FLS" type="xs:string"
use="required"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<xs:element name="rr20004">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="FLS" type="xs:string"
use="required"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:complexType>
</xs:element>
</xs:schema>

But this gives me an error saying the <xs:element ref="PANEL_CLUSTER"> 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
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...
5
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...
4
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...
1
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...
4
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...
3
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...
3
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
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...
12
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...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.