473,611 Members | 2,236 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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:simpleTyp e>
<xs:restricti on base="xs:short" >
<xs:minInclusiv e value="0"/>
<xs:maxInclusiv e value="300"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="U" type="UnitsAttr ibuteType" 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 2652
Can anyone help me with this? :)

Thanks,
-Nate

(Nate) wrote in message news:<d0******* *************** ****@posting.go ogle.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:simpleTyp e>
<xs:restricti on base="xs:short" >
<xs:minInclusiv e value="0"/>
<xs:maxInclusiv e value="300"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="U" type="UnitsAttr ibuteType" 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.go ogle.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:simpleTyp e>
<xs:restricti on base="xs:short" >
<xs:minInclusiv e value="0"/>
<xs:maxInclusiv e value="300"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="U" type="UnitsAttr ibuteType" 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:simpleTyp e>
<xs:restricti on base='xs:short' >
<xs:minInclusiv e value='0'/>
<xs:maxInclusiv e value='300'/>
</xs:restriction>
</xs:simpleType>
<xs:simpleTyp e>
<xs:restricti on base='xs:short' >
<xs:minInclusiv e value='-32768'/>
<xs:maxInclusiv e 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.c om
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
7836
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 long int to store the value, and the precision (number of decimal points) is variable (it's a templated class): template <size_t _decimal_places = 4> class FixedFloat {
1
1364
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 entry elements in it. but this x value needs to be hardcoded in the schema.
3
2350
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 handler and I get the overall message about the problem but I need to report on what exactly the problem is. Does any know how to do this? Xml-Spy gives you the exact information but I need to do it programmatically with customers data and report...
1
23956
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 names(TemplateB62,TemplateC62 ......) <?xml version='1.0' encoding='UTF-8'?> <xsd:schema targetNamespace="http://tempuri.org/XMLSchema.xsd" elementFormDefault="qualified" xmlns:xsd="http://www.w3.org/2001/XMLSchema"...
0
1779
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, weight and color. for example, <keyword color="blue" weight="normal">And</keyword> the color and weight attributes are restricted to only certain values (color to the 16 named colors in HTML; weight to normal, bold or italic
1
1496
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 only possible with "pattern".
1
1308
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> <lastname>Smith</lastname> </employee>
1
2054
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 in the right direction? Specifically, I am using Actions Pane to assist in creating a WordML document. For elements with enumerated values, I want to provide the user with the list of valid values from the schema. For example, if I have an...
2
2400
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 that Xsd:int is deserialised as a 32-bit int whereas Xsd:integer is deserialised as a string. Which leads me to the conclusion that 'ints' should be used in XML schemas unless your requirement really demands a humongous number so as
0
8149
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8097
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8561
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8411
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5527
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();...
0
4042
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4108
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2546
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
1
1692
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.