473,785 Members | 2,299 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Schema validation of control totals

Hi,

I have xml data containing "line item" elements and a "footer" element
which contains control totals for the line items. While I can easily
validate the control totals in xslt, I have not been able to do it
using a schema, which I need to do.

Example:
<data>
<item><fld1>1 </fld2><fld2>2</fld2></item>
<item><fld1>3 </fld2><fld2>4</fld2></item>
<item><fld1>5 </fld2><fld2>6</fld2></item>
<footer><tot1>1 0</tot1><tot2>12</tot2></footer>
</data>

Given the above, where tot1 and tot2 are control totals for fld1 and
fld2, the required schema validation should raise an error because
tot1 should be 9, whereas it is actually 10.

Is it possible?

Thanks in advance,
Steve.
Jul 20 '05 #1
2 1795


Steve wrote:
Hi,

I have xml data containing "line item" elements and a "footer" element
which contains control totals for the line items. While I can easily
validate the control totals in xslt, I have not been able to do it
using a schema, which I need to do.

Example:
<data>
<item><fld1>1 </fld2><fld2>2</fld2></item>
I think you want
<fld1>1</fld1><fld2>2</fld2>
the same error occurs in the next two lines
<item><fld1>3 </fld2><fld2>4</fld2></item>
<item><fld1>5 </fld2><fld2>6</fld2></item>
<footer><tot1>1 0</tot1><tot2>12</tot2></footer>
</data>

Given the above, where tot1 and tot2 are control totals for fld1 and
fld2, the required schema validation should raise an error because
tot1 should be 9, whereas it is actually 10.

Is it possible?


I don't think it is possible with the W3C XML schema language. It should
be possible with other schema languages that allow to specify
constraints with XPath.

--

Martin Honnen
http://JavaScript.FAQTs.com/

Jul 20 '05 #2
Thanks Martin - pretty much what I had gathered. Thanks for your assistance.

Steve.

Martin Honnen <Ma***********@ t-online.de> wrote in message news:<3F******* *****@t-online.de>...
Steve wrote:
Hi,

I have xml data containing "line item" elements and a "footer" element
which contains control totals for the line items. While I can easily
validate the control totals in xslt, I have not been able to do it
using a schema, which I need to do.

Example:
<data>
<item><fld1>1 </fld2><fld2>2</fld2></item>


I think you want
<fld1>1</fld1><fld2>2</fld2>
the same error occurs in the next two lines
<item><fld1>3 </fld2><fld2>4</fld2></item>
<item><fld1>5 </fld2><fld2>6</fld2></item>
<footer><tot1>1 0</tot1><tot2>12</tot2></footer>
</data>

Given the above, where tot1 and tot2 are control totals for fld1 and
fld2, the required schema validation should raise an error because
tot1 should be 9, whereas it is actually 10.

Is it possible?


I don't think it is possible with the W3C XML schema language. It should
be possible with other schema languages that allow to specify
constraints with XPath.

Jul 20 '05 #3

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

Similar topics

4
5611
by: joes | last post by:
Hello there I tried for several days to get a simple validation with xml schema & xerces working. Goal for me is tuse JAXP and not specific Xerces classes. I don't get the point what I am doing wrong. Could somebody help me? I didn't find any full example working on the net. Thank you for any hints! If I run the examples below, the parsers parses the file well, no vlaidation is occuring although the schema and xml file does not
2
2152
by: wumingshi | last post by:
Hi, When validating an XML instance, sometimes the schema is not enough to expression the validation rules. Additional validation rules may be expressed in an application-specific way. For example, using XPath or Java method. So is there a concept and/or standard for post-schema validation or application validation? Is there any hook in XML standards that allow me to hook up with my customized validation? Additionally and more...
0
1346
by: MG | last post by:
The following below is Microsoft sample to validate a XML document. My question is how can I put the validate errors in DataGrid? Using the ValidationEventHandle subroutine and adding ListBox control in that event works find but i can't firgure out to use a DataGrid instead. Can someone help, Please.? Dim m_success As Boolean Public Sub ValidationEventHandle(ByVal sender As Object, ByVal args As ValidationEventArgs)
1
1823
by: Anders Nilsson | last post by:
I'd like to know if there is support in .NET to somehow "flatten" a nested XML schema. Here is the situation: Currently I have code that can validate nested XML against a schema. The XML is generated by using a DataSet. Now I want to generate the XML as non-nested from the DataSet by setting the flag Nested to false in the Relation objects but still be able to validate it using the same "nested" schema. So I'm hoping there is a way to...
2
9453
by: Shone | last post by:
I would like to perform a 2-pass XML reading from a stream. Once using the Validating reader, just to confirm the validity against the schema, and next time to do a reading to extract the data. Actually, second time I do a deserialization, the data from XML is fed directly to an object. The problem I am experiencing is the error at the second reading attempt, and error description implies that reader is winded to the end of the XML and...
1
1633
by: Colin Basterfield | last post by:
Hi, I have a web form which takes daily sales totals, both counts and monetary value and is done on a weekly basis, so on a Monday morning the User would enter these totals. Each total has a range, which at the lower end is >= 0 and the upper limit is configurable, these totals are then submitted to a web service which posts them to a data store. The question is regarding validation, obviously I can validate on the web form using...
0
1137
by: Ricky Li | last post by:
I went through some article to see how I can add schema validation for my templated control by adding an XSD file into the VS.NET schema folder. Everything works fine for a schema like this: <mycontrolns:mycontrol id="test" runat="server"> <mytemplate>test</mytemplate> </mycontrolns> and I was able to specify the XSD to validate "mytemplate" as the only valid child type for "mycontrol". Here's a challenge: Is there anyway
1
6408
by: billa1972 | last post by:
Hi, I am trying to hook into Yellow Freight's rating webservice. Below is the wsdl. When i try and create a proxy file with wsdl.exe i get the following errors, see below. Also, when i reference this wsdl in .NET it seems to do it fine, yet there are no objects to reference except RateQuoteBeanService. In the WSDL it looks like there should be getRateQuote, and QUOTEREQUEST, etc.
0
2693
by: Mark Parter | last post by:
I'm trying convert an XML Schema (http://www.elframework.org/projects/xcri/efc_r1.0.xsd/view) to a VB.Net class using the XSD tool provided with the .NET 2 SDK. However, it's failing to generate the class and is outputting the following error(s); Schema validation warning: Undefined complexType 'http://purl.org/dc/elements/1.1/:SimpleLiteral' is used as a base for complex type extension. Line 433, position 5. Schema validation warning:...
0
9480
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
10315
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10147
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...
1
10085
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,...
0
8968
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7494
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6737
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
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2877
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.