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

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

XmlReader.Create(textReader, XmlReaderSettings) Validation Issue

Posted By:      Posted Date: August 28, 2010    Points: 0   Category :.NET Framework
For the most part, when I perform an XmlReader.Read() I am catching validation errors based on my schemas.  This, however, is a large group of schemas with several imports and includes.  My question is why I'm having validation errors in two places that seem to be defined in the schema.   Here's an example:   Schema 1 (you can see that IdentificationType has sub-elements for IdentificationID and IdentificationCode):   <xsd:complexType name="IdentificationType">                 <xsd:annotation>                         <xsd:documentation>A data type for a representation of an identity.</xsd:documentation>                         <xsd:appinfo>                                 <i:Base i:namespace="http://niem.gov/niem/structures/2.0" i:name="Object"/>               &nb

View Complete Post

More Related Resource Links

MVC2 issue - Stuck. Trying to create a cms with nested partials


I am currently trying to display multiple items on a single page. I am not sure as to how to tackle this. What I have is a database table that has all the page data in. I have this run as a PagesController and this works fine. However what I would like to do is, if say the Products page is selected via the menu, I want to pull back not only the Products page html but also get all the products, and even be able to pull them through via category. I was trying to use a partial view, but I can't get it to work. The same would be for other pages, having partial views to display the other content, ie if Gallery is selected, the page html for Gallery shows and it then can push to a partial view that pulls all the gallery images from the gallery db table and so on. 

Maybe I am tackling this the wrong way. I have the pages stored in the db to allow for a CMS system I have setup. Maybe I need to use models for all the other items(Products, Gallery, Videos and such) and use the partial for the page html?

Any help would be greatly appreciated as I am confused.

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.


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

Issue with validation using IDataErrorInfo with int range

Hi, I have a textbox which takes only numbers as input. Textbox has binding with int type property. <TextBox Name="TXT_From" Text="{Binding Path=Range, UpdateSourceTrigger=LostFocus,<br/>  ValidatesOnDataErrors=True, Mode=TwoWay}" /> public int Range { get { return (int)GetValue(RangeFromProperty); } set { SetValue(RangeFromProperty, value); } } public static readonly DependencyProperty RangeFromProperty = DependencyProperty.Register("Range", typeof(int), typeof(MyClass)); In IDataErrorInfo I am doing some auto correction of values. public string this[string property] { get { string msg = null; switch (property) { case "Range": if (Range < 0) Range = 1; if (Range > Max) Range = TempMax; break; default: throw new ArgumentException("Unrecognized property: " + property); } return msg; } } Now the issue is when I enter value greater than 2,147,483,647 which is max value for int the IDataErrorInfo member public string this[string property] is not getting called,also it displays red bordered textbox. I want to avoid this validation and dont want restriction on value input. How to achieve this?  

Issue travasering xml document with XmlReader

hi asp.net 4.0, visual studio 2010 I'm having trouble looping through the contens of the xml document using XmlReader. The problem is not exactly with xml but it lies in how to create this loop. Below I've posted an example of the code.  This is the problem: When reader.Name == "car" I know it's on the beginning of a new xml node in the xml file. Then the loop loops through and set the values to the rest of the values for the item object. Once again if reader.Name == "car" and item has a value, then the item is added to the returnlist. So basically I'm looking for ideas to make this code cleaner and safer (less likely to fail). I'm new to xml and this code looks terrible. I don't like the idea that I don't find all the data to one Car object in one loop, instead I have to use multiple loop runs before I get all the data. I coould use XmlDocument if that is cleaner, it's slower but the xmlfile is so little that no user is able to notice a differencereturnList List<Car> = new List<car>();Cars item; while (reader.Read()) { if (reader.Name == "car") { if (item != null) returnlist.Add(item); item = new Car(); } else if (reader.Name == "model") { item.Model = reader.Value; } else if (reader.Name == "engine") { item.Engine = reader.Value

Report Builder 3.0 issue - can view existing rdl files but cannot create new reports

I have Report Builder 3.0 deployed on my local machine pointing to a remote SQL Server 2008 R2 instance outside of my local domain.  Within this local Report Builder 3.0 instance I am able to open up previously created rdl files from the remote SQL Server 2008 R2 instance that I am connecting to.  However, if I try to create a new report on my local instance of Report Builder 3.0 and attempt to use the same data source as was used to create these existing rdl files, I receive the error: "Unable to connect to data source. The user credentials provided in the connection string do not have permission to connect to Reporting Services."  So why can I open existing rdl files from this remote SQL Server 2008 R2 instance, but not create new ones even though I'm using the same data source as the existing rdl files?  Thanks, Mark

XmlReader.Create() always {None}


Hi all,

Can anybody explain why does XmlRader.Create() always return {None}?

MemoryStream memStream = new MemoryStream();
byte[] data = Encoding.Unicode.GetBytes("<root><item>Demo</item></root>");
memStream.Write(data, 0, data.Length);
System.Xml.XmlReaderSettings xmlSettings = new XmlReaderSettings();
xmlSettings.ConformanceLevel = ConformanceLevel.Fragment;    // Can be document - it changes nothing
xmlSettings.IgnoreWhitespace = true; xmlSettings.IgnoreComments = true; XmlReader a = XmlReader.Create(memStream, xmlSettings); // First try with MemoryStream
XmlReader b = XmlReader.Create(new StringReader("<root><item>Demo</item></root>"), xmlSettings); // Second - with TextReader

Actual result : a = {None}, b = {None} .. all fields of created XmlReader are empty! Why?

Thanks for replies.

Easier way to programiclly create validation controls.


I know you can create validation controls in C# code

        RequiredFieldValidator Name = new RequiredFieldValidator();
        Name.ControlToValidate = "ControlName";

        RegularExpressionValidator name = new RegularExpressionValidator();
        name.ControlToValidate = "ControlName";
        name.ValidationExpression = "xx/xx/xxxx";

but is there a way to do it in a single line? In a recent post I had I learned a one line method to make textboxes and drop down lists

        Label lblReleaseDate = DynamicControlCreator.Label("lblReleaseDate" + i, " Release Date (MM/DD/YYYY): ");
        TextBox tbReleaseDate = DynamicControlCreator.TextBox("tbReleaseDate" + i);
        Label lblRegion = DynamicControlCreator.Label("lblRegion" + i, " Region: ");
        DropDownList ddlRegion = DynamicControlCreator.DropDownList("ddlRegion" + i, Region);

So,  is there a oneliner I can use for the validators? 

MultiView issue with validation in form


Hi all,

Currently I am working on a user control which has the following "layout":

  • the user control elements are placed inside an Update Panel
  • inside the Update Panel I have a MultiView control with 4 views:
    • first view 2 buttons to select the type of the user to create (clicking one button changes the active view to the second view, clicking the other one activates the third view)
    • second view is for the form used to create a user type
    • third view is for the form used to create the other user type
    • forth view should be used to display the confirmation message for the creation of both user types

In both forms, besides he usual textboxes I am also using validation controls to make sure the data the user inputs is correct.

However, I have a problem in case the data is invalid (the user doesn't input some mandatory field): for a very short period of time I see the * next to the mandatory field and the error in the validation summary, but immediately the active view is switched back to the first view in the MultiView control.

How can I force the control to stay on the view with the selected form?

Any ideas, suggestions or comments are welcomed!

Thank you in advance!


Create validation formating


I want to create a sort of validation formatting (like regex).  It doesn't have to actual validate; just make it easier for the user to enter the correct number of character needed.  I want something like domain: [xxx].[xxx].[xxx] (so it only allows 9 numbers, 2 periods).

So for instance when the user moves to the field they would be presented with one field with ability to enter 3 numbers.3 numbers.3 numbers

Any Ideas?  Thanks,


Catch 22 Database Connection Validation Issue w/ BIDS and Production Server


I have a rather simple SSIS package that exports data through an ODBC connection from an IBM iSeries database and copies that data to a SQL Server 2005 database.  When I was designing the application, I was able to connect to the iSeries database and store the user ID and password with my BIDS project and copy the data with out any problems.  Great!

When I finished designing and testing the project, I loaded it to the production server.  The final test was to schedule the process so that it would run each night.  I didn't realize it at the time but the password that I had stored with the project in BIDS was removed from the package and various MS documentation stated that I should create a configuration file and load the password from there.  So, I made the necessary changes to the project, adding a configuration file.  The config file is in the Miscellaneous folder within the BIDS project, however, it isn't automatically copied to the bin directory when I build the project.  I have to manually save it to the server, and then after importing the project I have to manually link to the necessary config fields.

This fixed the problem with the server, however, now I can not get BIDS to save my password with the connection string from within the designer.  This is a huge problem.  I am exporting from 21 different da

ISSUE: Cannot create a row of size which is greater than max 8060...Need Help




I have an issue related to maximum row size. I have a DW environment which has a table with multiple hierarchies and levels.


OLE DB error: OLE DB or ODBC error: Cannot create a row of size XXXX
which is greater than the allowable maximum of 8060. Errors in the OLAP
storage engine: An error occurred while the dimension, with the ID
of 'DATABASE', Name of 'DIMENSION' was being processed.
Server: The operation has been cancelled.

My current version is SQL Server 9.00.3257 (SP2 + CU 8). I would like to check if there is any upgrade available to fix this limitation (SQL Server 2005 SP3 / SQL Server 2008 SP1)....

Any advice is much appreciated.

Thanks in Advance

Security Validation / Silverlight issue?

When Security Validation is turned off on a 2010 web application, the Silverlight menus break in that web app.  Why is that?  I've seen it across many farms, so I know it's an issue.

MVC 3 Beta - PasswordFor Validation Issue


I have been working with MVC 3 Beta, and things are off to a very good start.

However, I discovered that PasswordFor() is not emitting unobtrusive validation.  I worked around it for now by using TextBoxFor(), and adding type = "password" to the attributes for the textbox.  This gives me a password field, and my unobtrusive validation is emitted.

Is this the correct forum to report MVC 3 Beta issues?



help in validation with XMLReader


Hi all,

I have an xml file of  the structure

      <elt 1 />
      <elt 2 />
      <elt 3 />
      <elt n />
         <elt C1 />
         <elt C2 />
         <elt C3 />
         <elt Cn />         
         <elt O1 />
         <elt O2 />
         <elt O3 />
         <elt On />         

I am using an xmlreader to validate this xml with an xml schema.  I am finding it difficult to frame a solution for the following problem.

Lets suppose that element 7 in the master element(<elt 7 />) is a non conforming element. the validation code will find it. So far so good, now i want to find the value of the last element within the master element(<elt n />) when there is an error in one of the elements. The same also applies for core and other elements. How do I go about finding a solution for this. The value in the last element will be used in a report of errors in the xml. There can be many "master elements".

The code for validation is as foll

Metadata buddy class validation issue


I accidentally duplicated the thread and I found no way to delete one of them.

Please, follow the thread here: http://forums.asp.net/t/1614475.aspx




I am using asp.net MVC 2 and Entity Framework 4. I followed the directions to annotate my model classes through a buddy metadata class, so annotations are not lost when EF classes are generated.

It worked fine for a simple class, but now I am working on a more complex class, that requires regular expression and range validation for double type values.

It seems that for this class, MVC is finding the annotation to display the label (I changed the annotation and I saw it changed on my browser), but as far as the validation annotations, it is ignoring it completely.

Any idea before I try something crazy, like downloading the mvc source, and debugging the framework myself?



Input-validation-Error issue when Model has complex types



I have implemented aps.net mvc validation and it is working fine. Only issue I have "Input-validation-error" css class is not getting applied if model has complex types.

I am using my own data annotations for validation.

Any idea how to resolve  this.



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