473,569 Members | 3,035 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.xm l from above begins:

<?xml version="1.0" ?>
<?xml-stylesheet type="text/xsl"
href="http://emle.sourceforg e.net/emle020000/emle_lab.xsl"?>
<emle xmlns:xsi="http ://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocat ion="noNamespac eSchemaLocation
http://emle.sourceforg e.net/emle020000/emle.xsd">

I expect an error when emle_lab_003.xm l 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="EmleEmleT ype"/>

What am I missing?

--
C.W.Holeman II | cw***@Julian5Lo cals.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 1674
C.W.Holeman II wrote:
<emle xmlns:xsi="http ://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocat ion="noNamespac eSchemaLocation
http://emle.sourceforg e.net/emle020000/emle.xsd">
This either needs to be
xsi:schemaLocat ion="http://emle.sourceforg e.net
http://emle.sourceforg e.net/emle020000/emle.xsd"
or

xsi:noNamespace SchemaLocation= "http://emle.sourceforg e.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
elementFormDefa ult="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*******@yaho o.dewrote in message
news:45******** **************@ newsspool3.arco r-online.net...
C.W.Holeman II wrote:
><emle xmlns:xsi="http ://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocat ion="noNamespac eSchemaLocation
http://emle.sourceforg e.net/emle020000/emle.xsd">

This either needs to be
xsi:schemaLocat ion="http://emle.sourceforg e.net
http://emle.sourceforg e.net/emle020000/emle.xsd"
or

xsi:noNamespace SchemaLocation= "http://emle.sourceforg e.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
elementFormDefa ult="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.sourceforg e.net/emle020000/emle_lab_003_te stb.xml:xsi:noN amespaceSchemaL ocation="http://emle.sourceforg e.net/emle020000/emle_testb.xsd" >In
http://emle.sourceforg e.net/emle020000/emle_testb.xsd: <xsd:schema
xmlns:xsd="http ://www.w3.org/2001/XMLSchema"
xmlns="http://emle.sourceforg e.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*******@yaho o.dewrote in message
news:45******** **************@ newsspool3.arco r-online.net...
>C.W.Holeman II wrote:
>><emle xmlns:xsi="http ://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocat ion="noNamespac eSchemaLocation
http://emle.sourceforg e.net/emle020000/emle.xsd">

This either needs to be
xsi:schemaLocat ion="http://emle.sourceforg e.net
http://emle.sourceforg e.net/emle020000/emle.xsd"
or

xsi:noNamespac eSchemaLocation ="http://emle.sourceforg e.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
elementFormDefa ult="qualified"
as an attribute on xsd:schema.
If you want to define elements in no namespace then remove the
targetNamespac e 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:noNamespace SchemaLocation= http://emle.sourceforg e.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.sourceforg e.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.sourceforg e.net/emle020000/emle_lab.xsl"?>
<emle xmlns:xsi="http ://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespace SchemaLocation= "http://emle.sourceforg e.net/emle020000/emle_testb.xsd" >
<emleLab emleLNum="3">
<emleLTitle>Rec tangle/Fraction (XSLT)</emleLTitle>
<emleEquipmen t>
<emleETitle>Lef t Rectangle</emleETitle>
<emleEServer emleESType="EML E_EST_RECTANGLE " emleWidth="601"
emleHeight="101 " />
<emleEControl emleECEnable="p roperP1Fraction ">
<emleECNumerato r emleECMin="2" emleECMax="4" emleECStyle="ra dio"
emleECOrder="as cendingByCompon ent" />
<emleECDenomina tor emleECMin="2" emleECMax="4"
emleECStyle="ra dio" emleECOrder="as cendingByCompon ent" />
</emleEControl>
</emleEquipment>
<emleEquipmen t>
<emleETitle>Rig ht Rectangle</emleETitle>
<emleEServer emleESType="EML E_EST_RECTANGLE " emleWidth="601"
emleHeight="101 " />
<emleEControl emleECEnable="p roperP1Fraction ">
<emleECNumerato r emleECMin="1" emleECMax="9" emleECStyle="ra dio"
emleECOrder="as cendingByCompon ent" />
<emleECDenomina tor emleECMin="1" emleECMax="9"
emleECStyle="ra dio" emleECOrder="as cendingByCompon ent" />
</emleEControl>
</emleEquipment>
<emleLDoc>Thi s 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.sourceforg e.net">
<xsd:annotation >
<xsd:documentat ion xml:lang="en">
Electronic Mathematics Labatory Equipment schema for
emle.sourceforg e.net.
Copyright 2006. http://emle.sourceforge.net/use.shtml All rights
reserved.
</xsd:documentati on>
</xsd:annotation>
<xsd:element name="emle" type="EmleEmleT ype"/>
<xsd:complexTyp e name="EmleEmleT ype">
<xsd:sequence >
<xsd:element name="emleLab" type="EmleLabTy pe"/>
</xsd:sequence>
</xsd:complexType >
<xsd:complexTyp e name="EmleLabTy pe">
<xsd:attribut e name="emleLNum" type="xsd:posit iveInteger"/>
<xsd:sequence >
<xsd:element name="emlsLTitl e" type="xsd:strin g"/>
<xsd:element name="emleEquip ment" type="EmleEquip mentType"/>
<xsd:element name="emleLDoc" type="xsd:strin g"/>
</xsd:sequence>
</xsd:complexType >
<xsd:complexTyp e name="EmleEquip mentType">
<xsd:sequence >
<xsd:element name="emleETitl e" type="xsd:strin g"/>
<xsd:element name="emleEServ er" type="EmleEServ erType"/>
<xsd:element name="emleECont rol" type="EmleECont rolType"/>
</xsd:sequence>
</xsd:complexType >
<xsd:complexTyp e name="EmleEServ erType">
<xsd:attribut e name="emleESTyp e" type="EmleESTyp eType"/>
<xsd:attribut e name="emleWidth " type="xsd:posit iveInteger"/>
<xsd:attribut e name="emleHeigh t" type="xsd:posit iveInteger"/>
</xsd:complexType >
<xsd:simpleTy pe name="EmleESTyp eType">
<xsd:restrictio n base="xsd:strin g">
<xsd:enumeratio n value="EMLE_EST _RECTANGLE"/>
<xsd:enumeratio n value="EMLE_EST _PIE"/>
</xsd:restriction >
</xsd:simpleType>
<xsd:complexTyp e name="EmleECont rolType">
<xsd:attribut e name="emleECEna ble" type="EmleECEna bleType"/>
<xsd:sequence >
<xsd:element name="emleECNum erator" type="EmleECWid getType"
minOccurs="0"/>
<xsd:element name="emleECDen ominator" type="EmleECWid getType"/>
</xsd:sequence>
</xsd:complexType >
<xsd:simpleTy pe name="EmleECEna bleType">
<xsd:restrictio n base="xsd:strin g">
<xsd:enumeratio n value="properFr action"/>
<xsd:enumeratio n value="properP1 Fraction"/>
<xsd:enumeratio n value="improper Fraction"/>
<xsd:enumeratio n value="mixedFra ction"/>
<xsd:enumeratio n value="wholeNum ber"/>
</xsd:restriction >
</xsd:simpleType>
</xsd:schema>

--
C.W.Holeman II | cw***@Julian5Lo cals.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
2928
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 given elements of the schema (tables and columns) that the application also requires. I've guessed that Annotations are a way to do this, so added...
2
6340
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 database, but I would like to be able to send this data directly to the SQL Server also. I am currently using a DSN connection, but would prefer to...
0
2021
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 c# code behind, request). Now I need to pass back to all the schema values to aspx page; however, it doesn't seem to work by using inline...
1
4480
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 mytable
2
5663
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 send dataset or an xml which will be created at the client and parsed at the server, in the web service. Which will have a better performance. ...
5
3668
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 validation? The former seems to be an easier question to answer. XML files will arrive from around the world and must be schema validated before further...
4
2264
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" attributeFormDefault="unqualified"> <xs:element name="Document"> <xs:complexType> <xs:sequence> </xs:sequence> <xs:attribute name="name" type="xs:string" />
3
1894
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 knowing. My project goal is to make a randomly generated story generator using recursive xml. There will be random elements within random elements,...
4
1342
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 model my objects on the database schema, and their methods on the SQL/stored procs. Most of what I read suggests starting with the class. Am I...
0
7703
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...
0
7619
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7930
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8138
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...
1
7681
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7983
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...
0
6290
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...
1
5514
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5228
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...

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.