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

Schema facets and Invalid values

Hello,

I'd like to somehow put minIncl and maxIncl around the data I am
sending from my producer. One of the requirements is to allow the
producer to send an invalid number to the consumer. The consumer will
know what the invalid value is based on an INV attribute being set.

Here's a partial schema of what I'm talking about:
<xs:element name="data" minOccurs="0">
<xs:complexType>
<xs:attribute name="V">
<xs:simpleType>
<xs:restriction base="xs:short">
<xs:minInclusive value="0"/>
<xs:maxInclusive value="300"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="U" type="UnitsAttributeType" fixed="/min"/>
<xs:attribute name="INV" type="xs:short" fixed="-32768"/>
</xs:complexType>
</xs:element>

XML the producer would send
<data V="50" U="ms" INV="-32768" />
<data V="60" />
<data V="-32768" />
<data V="-32768" />
<data V="25" />
<data V="100" />

The consumer reads in the data and displays it. If they get an
invalid they display an invalid message.

The problem, which can you obviously see by now, is that when the
invalid number is sent the parser throws an error that the value (V)
is outside the range (0-300). So is there a way to do what I'm trying
to do? (i.e. range=0-300, & -32768) or is this a dream and the only
way is to make the INV a Boolean and send it every time?

Thanks for the help,
-Nate
Jul 20 '05 #1
4 2632
Can anyone help me with this? :)

Thanks,
-Nate

(Nate) wrote in message news:<d0**************************@posting.google. com>...
Hello,

I'd like to somehow put minIncl and maxIncl around the data I am
sending from my producer. One of the requirements is to allow the
producer to send an invalid number to the consumer. The consumer will
know what the invalid value is based on an INV attribute being set.

Here's a partial schema of what I'm talking about:
<xs:element name="data" minOccurs="0">
<xs:complexType>
<xs:attribute name="V">
<xs:simpleType>
<xs:restriction base="xs:short">
<xs:minInclusive value="0"/>
<xs:maxInclusive value="300"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="U" type="UnitsAttributeType" fixed="/min"/>
<xs:attribute name="INV" type="xs:short" fixed="-32768"/>
</xs:complexType>
</xs:element>

XML the producer would send
<data V="50" U="ms" INV="-32768" />
<data V="60" />
<data V="-32768" />
<data V="-32768" />
<data V="25" />
<data V="100" />

The consumer reads in the data and displays it. If they get an
invalid they display an invalid message.

The problem, which can you obviously see by now, is that when the
invalid number is sent the parser throws an error that the value (V)
is outside the range (0-300). So is there a way to do what I'm trying
to do? (i.e. range=0-300, & -32768) or is this a dream and the only
way is to make the INV a Boolean and send it every time?

Thanks for the help,
-Nate

Jul 20 '05 #2
Hello,

Let me add one more thing to make sure I am making myself clear.
Here's what I am trying to do.

valid values are: 1700 thur 4800 and -32768
1700 = okay
2500 = okay
100 = ERROR
-32768 = okay
- 1000 = ERROR

Can I put something in the schema to check this correctly?

Thanks for the help,
-Nate

(Nate) wrote in message news:<d0**************************@posting.google. com>...
Hello,

I'd like to somehow put minIncl and maxIncl around the data I am
sending from my producer. One of the requirements is to allow the
producer to send an invalid number to the consumer. The consumer will
know what the invalid value is based on an INV attribute being set.

Here's a partial schema of what I'm talking about:
<xs:element name="data" minOccurs="0">
<xs:complexType>
<xs:attribute name="V">
<xs:simpleType>
<xs:restriction base="xs:short">
<xs:minInclusive value="0"/>
<xs:maxInclusive value="300"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="U" type="UnitsAttributeType" fixed="/min"/>
<xs:attribute name="INV" type="xs:short" fixed="-32768"/>
</xs:complexType>
</xs:element>

XML the producer would send
<data V="50" U="ms" INV="-32768" />
<data V="60" />
<data V="-32768" />
<data V="-32768" />
<data V="25" />
<data V="100" />

The consumer reads in the data and displays it. If they get an
invalid they display an invalid message.

The problem, which can you obviously see by now, is that when the
invalid number is sent the parser throws an error that the value (V)
is outside the range (0-300). So is there a way to do what I'm trying
to do? (i.e. range=0-300, & -32768) or is this a dream and the only
way is to make the INV a Boolean and send it every time?

Thanks for the help,
-Nate

Jul 20 '05 #3
In article <d0**************************@posting.google.com >,
Nate <st******@msoe.edu> wrote:

[...]

% is outside the range (0-300). So is there a way to do what I'm trying
% to do? (i.e. range=0-300, & -32768) or is this a dream and the only
% way is to make the INV a Boolean and send it every time?

You can define the type as a union of a type which accepts 0--300 and
a type which accepts -32768 only. Something like

<xs:simpleType><xs:union>
<xs:simpleType>
<xs:restriction base='xs:short'>
<xs:minInclusive value='0'/>
<xs:maxInclusive value='300'/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType>
<xs:restriction base='xs:short'>
<xs:minInclusive value='-32768'/>
<xs:maxInclusive value='-32768'/>
</xs:restriction>
</xs:simpleType>
</xs:union></xs:simpleType>

I'm not sure if there's a better way to expression the -32768, however
you could define it to be a string `invalid' if you wanted to.

--

Patrick TJ McPhee
East York Canada
pt**@interlog.com
Jul 20 '05 #4
That worked perfectly! Thanks for the help.

-Nate
Jul 20 '05 #5

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

Similar topics

4
by: Roger Leigh | last post by:
Hello, I'm writing a fixed-precision floating point class, based on the ideas in the example fixed_pt class in the "Practical C++ Programming" book by Steve Oualline (O' Reilly). This uses a...
1
by: obsolete_5 | last post by:
is it possible? more specifically, a simple example: i want a 'table' element to have a sequence of 'entry' elements. i know you can use minOccur = maxOccur = x, to enforce table to have x...
3
by: Matt | last post by:
I know how to use the XmlReader to validate XML against a Schema but how do I take this one step further and get the Facet information for an invalid Xml element? I have my own validation event...
1
by: Mike | last post by:
Hi! I have an Excel 2003 Schema I need to parse to extract elements names. I am puzzled with the System.Xml.Schema object. Here's the example of my schema: I need to get a collection of element...
0
by: c j anderson, mcp | last post by:
Core Question: Is there a better way to dynamically pull the allowed values of an attribute out of a dataset's schema. I have an XML file that contains a string element with two attributes,...
1
by: Stefan Reiter | last post by:
Hi, I want to limit a date to a minDate and a maxDate - is that possible, and how? <xs:simpleType> <xs:restriction base="xs:date"> <xs: </xs:restriction> </xs:simpleType> I assume it is...
1
by: M. Fernandez | last post by:
Hello, I have some problems in the design of my XML Schema. i don't really understand the difference between Type and element. For example: <employee> <firstname>John</firstname>...
1
by: GU | last post by:
How can one get a list of enumeration values for a given element in an XML schema? I have been looking at the Schema Object Model, but I'm making very little headway. Can anyone give me a nudge...
2
by: WideBoy | last post by:
Hi, In an XML schema there is little difference between the data types 'int' and 'integer', however, if you use a tool such as WSDL.exe to generate proxy classes to handle such schemas you find...
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:
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
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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,...
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...

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.