I have an xml schema that I am working on. I wanted to know if it was a
normal thing to do something like this:
1. Have a ZipCode simple type that has to be 5 characters long.
2. Have a StateCode simple type that has to be 2 characters long.
3. Have an Address complex type that has:
- Street (string)
- City (sgring)
- State (StateCode) [noted in item 2 above]
- ZipCode (ZipCode) [noted in item 1 above]
4. Have a Venue complex type that has the following:
- Name (string)
- Address (Address) [noted in item 3 above]
- PhoneNumber (string)
5. Have an element that can contain only 1 instance of the Venue complex
type. 8 1993
Andy B wrote:
I have an xml schema that I am working on. I wanted to know if it was a
normal thing to do something like this:
1. Have a ZipCode simple type that has to be 5 characters long.
2. Have a StateCode simple type that has to be 2 characters long.
3. Have an Address complex type that has:
- Street (string)
- City (sgring)
- State (StateCode) [noted in item 2 above]
- ZipCode (ZipCode) [noted in item 1 above]
4. Have a Venue complex type that has the following:
- Name (string)
- Address (Address) [noted in item 3 above]
- PhoneNumber (string)
5. Have an element that can contain only 1 instance of the Venue complex
type.
Sounds fine to me, you might additionally restrict zip code to five
digits, enumerate the possible state codes.
--
Martin Honnen --- MVP XML http://JavaScript.FAQTs.com/
Sounds fine to me, you might additionally restrict zip code to five
digits, enumerate the possible state codes.
I forgot about the fact that I had ZipCode set to require 5 characters. I
want to make this a 5 digit number but cant find a length property for the
int or integer data type. How would I fix this? I have it set to ZipCode
(string) - length=5. You also said to make an enum for the state codes. How
exactly do I do this?
Andy B wrote:
>Sounds fine to me, you might additionally restrict zip code to five digits, enumerate the possible state codes.
I forgot about the fact that I had ZipCode set to require 5 characters. I
want to make this a 5 digit number but cant find a length property for the
int or integer data type. How would I fix this? I have it set to ZipCode
(string) - length=5. You also said to make an enum for the state codes. How
exactly do I do this?
Straight from <URL:http://www.w3.org/TR/xmlschema-0/is this example:
<xsd:simpleTy pe name="USState">
<xsd:restrictio n base="xsd:strin g">
<xsd:enumeratio n value="AK"/>
<xsd:enumeratio n value="AL"/>
<xsd:enumeratio n value="AR"/>
<!-- and so on ... -->
</xsd:restriction >
</xsd:simpleType>
As for the zip code, one way is with a regular expression pattern:
<xsd:simpleTy pe name="zipType">
<xsd:restrictio n base="xsd:posit iveInteger">
<xsd:pattern value="\d{5}"/>
</xsd:restriction >
</xsl:simpleType>
--
Martin Honnen --- MVP XML http://JavaScript.FAQTs.com/
Why would it be a good idea to do an enum for the state codes instead of
just letting somebody typing it in just a string field?
"Martin Honnen" <ma*******@yaho o.dewrote in message
news:%2******** ********@TK2MSF TNGP02.phx.gbl. ..
Andy B wrote:
>>Sounds fine to me, you might additionally restrict zip code to five digits, enumerate the possible state codes.
I forgot about the fact that I had ZipCode set to require 5 characters. I want to make this a 5 digit number but cant find a length property for the int or integer data type. How would I fix this? I have it set to ZipCode (string) - length=5. You also said to make an enum for the state codes. How exactly do I do this?
Straight from <URL:http://www.w3.org/TR/xmlschema-0/is this example:
<xsd:simpleTy pe name="USState">
<xsd:restrictio n base="xsd:strin g">
<xsd:enumeratio n value="AK"/>
<xsd:enumeratio n value="AL"/>
<xsd:enumeratio n value="AR"/>
<!-- and so on ... -->
</xsd:restriction >
</xsd:simpleType>
As for the zip code, one way is with a regular expression pattern:
<xsd:simpleTy pe name="zipType">
<xsd:restrictio n base="xsd:posit iveInteger">
<xsd:pattern value="\d{5}"/>
</xsd:restriction >
</xsl:simpleType>
--
Martin Honnen --- MVP XML http://JavaScript.FAQTs.com/
Andy B wrote:
Why would it be a good idea to do an enum for the state codes instead of
just letting somebody typing it in just a string field?
In terms of the W3C schema language I suggested an _enumeration_ below:
><xsd:simpleTyp e name="USState"> <xsd:restrictio n base="xsd:strin g"> <xsd:enumeratio n value="AK"/> <xsd:enumeratio n value="AL"/> <xsd:enumeratio n value="AR"/> <!-- and so on ... --> </xsd:restriction > </xsd:simpleType>
Or are you now talking about a .NET enumeration defined with C# or VB.NET?
--
Martin Honnen --- MVP XML http://JavaScript.FAQTs.com/
You have the right thing. Does it do the same thing a c# enum would do?
either restrict the strings that can be used, or make useful names for
meaningless numbers (like a c# enum does)?
"Martin Honnen" <ma*******@yaho o.dewrote in message
news:Om******** ******@TK2MSFTN GP04.phx.gbl...
Andy B wrote:
>Why would it be a good idea to do an enum for the state codes instead of just letting somebody typing it in just a string field?
In terms of the W3C schema language I suggested an _enumeration_ below:
>><xsd:simpleTy pe name="USState"> <xsd:restrictio n base="xsd:strin g"> <xsd:enumeratio n value="AK"/> <xsd:enumeratio n value="AL"/> <xsd:enumeratio n value="AR"/> <!-- and so on ... --> </xsd:restriction > </xsd:simpleType>
Or are you now talking about a .NET enumeration defined with C# or VB.NET?
--
Martin Honnen --- MVP XML http://JavaScript.FAQTs.com/
Andy B wrote:
You have the right thing. Does it do the same thing a c# enum would do?
either restrict the strings that can be used, or make useful names for
meaningless numbers (like a c# enum does)?
The simple type I posted is a restriction of xsd:string allowing only
the enumerated string values (e.g. "AK" or "AL") to be used.
--
Martin Honnen --- MVP XML http://JavaScript.FAQTs.com/
Makes sense to me. I added all of the state codes to the schema.
"Martin Honnen" <ma*******@yaho o.dewrote in message
news:eT******** ******@TK2MSFTN GP03.phx.gbl...
Andy B wrote:
>You have the right thing. Does it do the same thing a c# enum would do? either restrict the strings that can be used, or make useful names for meaningless numbers (like a c# enum does)?
The simple type I posted is a restriction of xsd:string allowing only the
enumerated string values (e.g. "AK" or "AL") to be used.
--
Martin Honnen --- MVP XML http://JavaScript.FAQTs.com/ This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
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...
|
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
|
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">
|
by: Kanchana D S |
last post by:
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.
|
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...
| |
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...
|
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"/>
|
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...
|
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
|
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...
|
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...
| |
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.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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...
|
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 most users, this new feature is actually very convenient. If you want to control the update process,...
|
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...
|
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...
|
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();...
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |