473,289 Members | 1,940 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,289 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 1798
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: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...

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.