473,394 Members | 1,700 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,394 software developers and data experts.

First pass at using a schema

I am new to using XML. I am using Mozilla/5.0 (Windows; U; Windows NT 5.1;
en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1. In my test I am
attempting to have the style sheet:
http://emle.sourceforge.net/emle020000/emle_lab.xsl transform:
http://emle.sourceforge.net/emle020000/emle_lab_003.xml . The results
display as I expect and look fine to me using the "DOM Inspector". I have
also used CookTop V2.5 to validate the XML and to run the XSLT without
apparent error.

emle_lab_003.xml from above begins:

<?xml version="1.0" ?>
<?xml-stylesheet type="text/xsl"
href="http://emle.sourceforge.net/emle020000/emle_lab.xsl"?>
<emle xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="noNamespaceSchemaLocation
http://emle.sourceforge.net/emle020000/emle.xsd">

I expect an error when emle_lab_003.xml does not follow what is defined
in emle.xsd. I have tested this idea by changing "emle" to "emlexxx" in
emle.xsd in this line:

<xsd:element name="emle" type="EmleEmleType"/>

What am I missing?

--
C.W.Holeman II | cw***@Julian5Locals.com -5 | http://JulianLocals.com/cwhii
To only a fraction of the human race does God give the privilege of
earning one's bread doing what one would have gladly pursued free, for
passion. I am very thankful. The Mythical Man-Month Epilogue/F.P.Brooks

Jan 3 '07 #1
3 1659
C.W.Holeman II wrote:
<emle xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="noNamespaceSchemaLocation
http://emle.sourceforge.net/emle020000/emle.xsd">
This either needs to be
xsi:schemaLocation="http://emle.sourceforge.net
http://emle.sourceforge.net/emle020000/emle.xsd"
or

xsi:noNamespaceSchemaLocation="http://emle.sourceforge.net/emle020000/emle.xsd"

In your schema you need to decide what you want to do, if you want to
define elements in the namespace
http://emle.sourceforge.net/emle020000/emle.xsd, then you need to add
elementFormDefault="qualified"
as an attribute on xsd:schema. If you want to define elements in no
namespace then remove the targetNamespace attribute.
--

Martin Honnen
http://JavaScript.FAQTs.com/
Jan 4 '07 #2
"Martin Honnen" <ma*******@yahoo.dewrote in message
news:45**********************@newsspool3.arcor-online.net...
C.W.Holeman II wrote:
><emle xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="noNamespaceSchemaLocation
http://emle.sourceforge.net/emle020000/emle.xsd">

This either needs to be
xsi:schemaLocation="http://emle.sourceforge.net
http://emle.sourceforge.net/emle020000/emle.xsd"
or

xsi:noNamespaceSchemaLocation="http://emle.sourceforge.net/emle020000/emle.xsd"

In your schema you need to decide what you want to do,
if you want to define elements in the namespace
http://emle.sourceforge.net/emle020000/emle.xsd, then you need to add
elementFormDefault="qualified"
as an attribute on xsd:schema.
If you want to define elements in no namespace then remove the
targetNamespace attribute.
I want to specify what elements are allowed and to constrain them as
defined in .xsd file. Also, I want to not use namespace prefixes at this
time. So, this is waht I am trying:
In
http://emle.sourceforge.net/emle020000/emle_lab_003_testb.xml:xsi:noNamespaceSchemaLocati on="http://emle.sourceforge.net/emle020000/emle_testb.xsd">In
http://emle.sourceforge.net/emle020000/emle_testb.xsd:<xsd:schema
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns="http://emle.sourceforge.net">I get the same clean results as before.
Then I again change the main element name from "emle" to "emelxxx" in the
..xsd fileto force whatever kind of error will happen when the elements in my
..xml do notmatch the ones defined in the .xsd file. I expect there to be
some difference but see nochange in behavior.
http://emle.sourceforge.net/emle0200...le_testxxx.xsd
Jan 4 '07 #3
I am attempting to undo the mess that the MicroSoft and its newsreader
created
in the posting.
"Martin Honnen" <ma*******@yahoo.dewrote in message
news:45**********************@newsspool3.arcor-online.net...
>C.W.Holeman II wrote:
>><emle xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="noNamespaceSchemaLocation
http://emle.sourceforge.net/emle020000/emle.xsd">

This either needs to be
xsi:schemaLocation="http://emle.sourceforge.net
http://emle.sourceforge.net/emle020000/emle.xsd"
or

xsi:noNamespaceSchemaLocation="http://emle.sourceforge.net/emle020000/emle.xsd"

In your schema you need to decide what you want to do,
if you want to define elements in the namespace
http://emle.sourceforge.net/emle020000/emle.xsd, then you need to add
elementFormDefault="qualified"
as an attribute on xsd:schema.
If you want to define elements in no namespace then remove the
targetNamespace attribute.
I want to specify what elements are allowed and to constrain them as
defined in .xsd file. Also, I want to not use namespace prefixes at this
time. So, this is what I am trying:

In http://emle.sourceforge.net/emle0200..._003_testb.xml :

xsi:noNamespaceSchemaLocation=http://emle.sourceforge.net/emle020000/emle_testb.xsd

In http://emle.sourceforge.net/emle020000/emle_testb.xsd :

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns="http://emle.sourceforge.net">

I get the same clean results as before.

Then I again change the main element name from "emle" to "emelxxx" in the
.xsd file to force whatever kind of error will happen when the elements in
my
.xml do not match the ones defined in the .xsd file. I expect there to be
some difference but see no change in behavior.

http://emle.sourceforge.net/emle0200...03_testxxx.xml

http://emle.sourceforge.net/emle020000/emle_testxxx.xsd
Below the .xml and .xsd file contents have been added:

http://emle.sourceforge.net/emle0200...003_testb.xml:

<?xml version="1.0" ?>
<?xml-stylesheet type="text/xsl"
href="http://emle.sourceforge.net/emle020000/emle_lab.xsl"?>
<emle xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://emle.sourceforge.net/emle020000/emle_testb.xsd">
<emleLab emleLNum="3">
<emleLTitle>Rectangle/Fraction (XSLT)</emleLTitle>
<emleEquipment>
<emleETitle>Left Rectangle</emleETitle>
<emleEServer emleESType="EMLE_EST_RECTANGLE" emleWidth="601"
emleHeight="101" />
<emleEControl emleECEnable="properP1Fraction">
<emleECNumerator emleECMin="2" emleECMax="4" emleECStyle="radio"
emleECOrder="ascendingByComponent" />
<emleECDenominator emleECMin="2" emleECMax="4"
emleECStyle="radio" emleECOrder="ascendingByComponent" />
</emleEControl>
</emleEquipment>
<emleEquipment>
<emleETitle>Right Rectangle</emleETitle>
<emleEServer emleESType="EMLE_EST_RECTANGLE" emleWidth="601"
emleHeight="101" />
<emleEControl emleECEnable="properP1Fraction">
<emleECNumerator emleECMin="1" emleECMax="9" emleECStyle="radio"
emleECOrder="ascendingByComponent" />
<emleECDenominator emleECMin="1" emleECMax="9"
emleECStyle="radio" emleECOrder="ascendingByComponent" />
</emleEControl>
</emleEquipment>
<emleLDoc>This is the textual content of the lab "Rectangle/Fraction
(XSLT Test Case)".</emleLDoc>
</emleLab>
</emle>

http://emle.sourceforge.net/emle020000/emle_testb.xsd:

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns="http://emle.sourceforge.net">
<xsd:annotation>
<xsd:documentation xml:lang="en">
Electronic Mathematics Labatory Equipment schema for
emle.sourceforge.net.
Copyright 2006. http://emle.sourceforge.net/use.shtml All rights
reserved.
</xsd:documentation>
</xsd:annotation>
<xsd:element name="emle" type="EmleEmleType"/>
<xsd:complexType name="EmleEmleType">
<xsd:sequence>
<xsd:element name="emleLab" type="EmleLabType"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="EmleLabType">
<xsd:attribute name="emleLNum" type="xsd:positiveInteger"/>
<xsd:sequence>
<xsd:element name="emlsLTitle" type="xsd:string"/>
<xsd:element name="emleEquipment" type="EmleEquipmentType"/>
<xsd:element name="emleLDoc" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="EmleEquipmentType">
<xsd:sequence>
<xsd:element name="emleETitle" type="xsd:string"/>
<xsd:element name="emleEServer" type="EmleEServerType"/>
<xsd:element name="emleEControl" type="EmleEControlType"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="EmleEServerType">
<xsd:attribute name="emleESType" type="EmleESTypeType"/>
<xsd:attribute name="emleWidth" type="xsd:positiveInteger"/>
<xsd:attribute name="emleHeight" type="xsd:positiveInteger"/>
</xsd:complexType>
<xsd:simpleType name="EmleESTypeType">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="EMLE_EST_RECTANGLE"/>
<xsd:enumeration value="EMLE_EST_PIE"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:complexType name="EmleEControlType">
<xsd:attribute name="emleECEnable" type="EmleECEnableType"/>
<xsd:sequence>
<xsd:element name="emleECNumerator" type="EmleECWidgetType"
minOccurs="0"/>
<xsd:element name="emleECDenominator" type="EmleECWidgetType"/>
</xsd:sequence>
</xsd:complexType>
<xsd:simpleType name="EmleECEnableType">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="properFraction"/>
<xsd:enumeration value="properP1Fraction"/>
<xsd:enumeration value="improperFraction"/>
<xsd:enumeration value="mixedFraction"/>
<xsd:enumeration value="wholeNumber"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:schema>

--
C.W.Holeman II | cw***@Julian5Locals.com -5 | http://JulianLocals.com/cwhii
To only a fraction of the human race does God give the privilege of
earning one's bread doing what one would have gladly pursued free, for
passion. I am very thankful. The Mythical Man-Month Epilogue/F.P.Brooks
Jan 4 '07 #4

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

Similar topics

1
by: Jonathan Gibbs | last post by:
I'm very new to xml, and struggling a bit.. I want to use an .xsd file passed to a windows application to define a dataset's schema, and also (if possible) pass other metadata associated with...
2
by: djharrison | last post by:
Greetings, I was wondering if anyone could help me with a project involving MS Acces as a front-end to an SQL Server 2000 database. I am running a program that currently populates the Access...
0
by: dotnet | last post by:
I am trying to make a page that is changing the page schema(colors and graphics) depends on the specific value (for example, test.aspx?page=1) I have so far achieved accepting page values (with...
1
by: Justin Crossley | last post by:
I'm having a type mismatch problem when trying to pass a typed dataset to a web service. My code is: CLIENT CODE I have a dataset schema file called MainData.xsd containing a table called...
2
by: Anil Pundhir | last post by:
What is the best way to pass data to a web service. The client(to send data) has .net environment and also the server on which the web service is hosted also has the .net environment. Should I...
5
by: wolf_y | last post by:
My question is simply: under what conditions will empty tags of the form <MOM></MOM> pass schema validation? Of course, the mirror question is: under what conditions will empty tags fail...
4
by: =?Utf-8?B?bmlja25hbWU=?= | last post by:
I have the following xml Schema: “<?xml version="1.0" encoding="Windows-1252"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"...
3
by: Ultrus | last post by:
Hello XML gurus, After much reading, I made my first XML Schema! May I trouble you all for your thoughts? Perhaps there is a better way to go about it, or I did something totally wrong without...
4
by: Mike | last post by:
Which comes first? The database schema or class design? I'm used to developing the database tables and fields based on the functional requirements of an application, so it makes sense to me to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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:
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
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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...

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.