.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

need to add 2 more validation in XML Schema

Posted By:      Posted Date: September 04, 2010    Points: 0   Category :Sql Server
I have below XML Schema Collection, --DROP XML SCHEMA COLLECTION [dbo].[AS_MetaDataRegistry_Schema] CREATE XML SCHEMA COLLECTION [dbo].[AS_MetaDataRegistry_Schema] AS N'<?xml version="1.0" encoding="utf-16"?> <xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:element name="PDI_Approval_MetaData"> <xs:complexType> <xs:sequence> <xs:element name="Header"> <xs:complexType> <xs:sequence> <xs:element name="SourceSystem"> <xs:complexType> <xs:attribute name="Value" type="xs:string" use="required" /> <xs:attribute name="Name" type="xs:string" use="required" /> </xs:complexType> </xs:element> <xs:element name="TransactionType"> <xs:complexType> <xs:attribute name="Value" type="xs:string" use="required" /> <xs:attribute name="Name" type="xs:string" use="required" /> </xs:complexType> </xs:element> <xs:element name="TransactionVersion"> &l

View Complete Post

More Related Resource Links

Web Services: Extend the ASP.NET WebMethod Framework by Adding XML Schema Validation


WebMethods make the development of XML Web Services easier by encapsulating a good deal of functionality, but there is still a lot of underlying XML processing that you have to be responsible for. For example, WebMethods do not validate messages against the implied schema. Because they are not validated, the response that's returned can result in unintended consequences. To address this, the authors extend the WebMethod framework by adding XML Schema validation through a custom SoapExtension class.

Aaron Skonnard and Dan Sullivan

MSDN Magazine July 2003

XML schema validation issue

In case a particular node is mandatory, the error described is for the next sibling. In case there exists a error for the next sibling as well. That error message is supressed. On resolving the first issue, and running the validation again, the second error is thrown. Is there a way we can set options on the schema validation, so that we can receive both errors at the same time. For example we have a xml with the following nodes <NM101></NM101> <NM102></NM102> <NM103></NM103> Here NM101 is a mandatory node and NM102 has type as integer. In case we receivethe below xml <NM102>ABC</NM102> <NM103>DEF</NM103> Error: The element 'NM1' has invalid child element 'NM102'. List of possible elements expected: 'NM101' But the error for NM102 is now supressed and can be retrieved only when NM101 is present. Is there a way that all errors can be reported at the same time ?Swapnil Kasodekar

how to skip schema validation?

Hello All, I wrote below XML schema to validate below XML, In schema I do not include below element <Emp_ID></Emp_ID>  <Name></Name>, the reason is I do not want to validate what are the child element under <Attributes>..mean to say I only want to validate <Header> part of XML. what need to do with schema so that the checking of <Attributes> can be skiped...is there any way..please help me?? DECLARE @x XML(TestSchema) SELECT @x = '<PDI_Approval_Message> <Header> <SourceSystem Value="WF" Name="Workforce"></SourceSystem> <TransactionType Value="WF_TS" Name="WFSheet"></TransactionType> <RequestType Value="Submit" Name="Action"></RequestType> <SubmittedOn Value="06/10/2010" Name="SumbmitedOn"></SubmittedOn> <SubmittedBy Value="pdi/vmuser3" Name="hannok"></SubmittedBy> </Header> <Transactions> <Transaction> <Attributes> <Emp_ID>75867</Emp_ID> <Name>AYZA</Name> </Attributes> </Transaction> </PDI_Approval_Message>' CREATE XML SCHEMA COLLECTION TestSchema AS'<?xml version="1.0" ?> <xsd:schema attributeFormDefault="unqualified" elementFormDef

Help regarding Schema validation using C#


Hi All,

I am validating an xml markup against a schema using a XmlReader object. To find validation warnings i am passing a schemavalidation settings object. How do I find the elements that are causing the validation errors and their value that is causing the validation errors.

exploring the validationargs object, i found a variable holding the element that caused the error. But the problem is,it is a non public member of ValidationEventArgs.Exception.

How do I get that info??

Validation script in list schema



Anyone knows what the script tag in the validation element is good for? Do we put javascript here?

<Field ID="" Name="FieldName">
        <Validation Message="Message" Script="What's in here???"></Validation>

Server side validation of Fileupload control not working



I've tried this method in my code behind to try and validate that the Fileupload control has a file or not. I get the error message the the event "Server Validate" cannot be found. Can anyone tell why? Thanks.

Public Sub CustomValidator1_ServerValidate(ByVal source As Object, ByVal args As System.Web.UI.WebControls.ServerValidateEventArgs) Handles CustomValidator1.ServerValidate

' Get file name

        Dim uploadAvatar As FileUpload = DirectCast(AdvertisementForm.FindControl("uploadAvatar"), FileUpload)

        Dim UploadFileName As String = uploadAvatar.PostedFile.FileName

        If UploadFileName = "" Then
            ' There is no file selected
            args.IsValid = False
            Dim Extension As String = UploadFileName.Substring(UploadFileName.L

Integer Validation



I need to make validation for Textbox to allow enter integer stated by 9 or 6 or 5 , and also maximum 8 digits , how to do that ?





VS 2010 HTML validation "in CSS" option - where the hell is it?


In VS 2008 there is a very useful feature of background HTML validation - it checks if CSS class name is valid i.e. it exists in one of the linked css files. But VS 2010 Express does not do that any more. And the relevant setting in Options->Text Editor->HTML->Validation->in CSS is not there. Ok, maybe they made it paid for option? VS 2010 Professional? Not there. Or maybe VS 2010 Ultimate? Not a trace.

1. am I blind?

2. they decided it is too convenient to use and removed it?

3. they will "introduce" it in SP1?

What is going on? That one thing made me move back to VS 2008 web developer.


How to extract a schema from a sql server database



  I need to extract or get the schema from tables in my databse and what is the best way to do it. Is there any third party tool to do it??


Any idea will be appreciated..



User validation Issue in xlsx file



I am validating user from Login.xlsx file. It was working fine by validating email and password from that file. For testing i got new file same contents of file but added some more user names.

So after that when i validating the user i am getting the following error "Data type mismatch in criteria expression".

But when i replaced the new to old one it is working fine. The contens of both files are the same. So why this kind of error happened.


set messageTemplateResourceName from resource file in Validation appication block.



  I am using Validation application block in my project and want to set validation message from resource file, but not able to do that. I tried giving the path of resource file in messageTemplateResourceType and name of resource in messageTemplateResourceName. But it did not help as I only receive the message if I have set something in messageTemplate even after setting the resource file.

Here is my code:

<validator lowerBound="1" lowerBoundType="Inclusive" upperBound="250"
              upperBoundType="Inclusive" negated="false" messageTemplate=""
              messageTemplateResourceType="Asurion.jCare.Common.Resources.UIResources.PerilTypeAndDetailsSection, Asurion.jCare.Common.Resources, Version=, Culture=neutral, PublicKeyToken=null"
              tag="" type="Microsoft.Practices.EnterpriseLibrary.Validation.Validators.StringLengthValidator, Microsoft.Practices.Enterpris

Localize framework message from xml validation error


I need to validate an XML through XSD. I am using XMLReader (with XmlReaderSettings and 

Validation_EventHandler to do it). Depend on users preference, I would like to change the output message generated by  Validation_EventHandler in french or english.

Any idea on how to perform this?





Input Validation: Enforcing Complex Business Data Rules with WPF


Windows Presentation Foundation has a rich data binding system that includes flexible support for business data validation. We take a look at implementing some complex data input validation scenarios that include customized data errors for users.

Brian Noyes

MSDN Magazine June 2010

Extreme ASP.NET: Model Validation & Metadata in ASP.NET MVC 2


Scott Allen shows how to improve your user input validation with new features coming out in ASP.NET MVC 2 that easily allow validation on both the client and server.

Scott Allen

MSDN Magazine March 2010

Contract-First Web Services: Schema-based Development with Windows Communication Foundation


Schema- first contract-first modeling of Web Services gives you the ability to model your contracts with an XML-centric mindset. This process keeps you focused on universally acceptable types and the hierarchical data structures that can be represented in XML.

Christian Weyer, Buddhike de Silva

MSDN Magazine October 2009

Data Points: Data Validation with Silverlight 3 and the DataForm


In this month's column, John Papa shows you how the DataForm control works and how it can be customized.  He presents in detail a sample application that uses several features to bind, navigate, edit and validate data using the DataForm.

John Papa

MSDN Magazine October 2009

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend