.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

Event not raised while parsing xml file

Posted By:      Posted Date: August 21, 2010    Points: 0   Category :ASP.Net


In Visual Studio 2010 ASP.NET 4.0

I want to write a procedure to validate a xml file with a xsd. I found some examples on the web but the one i chose does not work as attended. The example uses XmlReader with a XmlReaderSettings and a ValidationEventHandler.

Here is the code

Protected Sub VerifyDes(ByVal filename As String)

        Dim xslDes As XmlReaderSettings = New XmlReaderSettings()
        xslDes.Schemas.Add("", "http://www.mysite.com/xsd/ValidData.xml")
        xslDes.ValidationType = ValidationType.Schema
        xslDes.ValidationFlags = XmlSchemaValidationFlags.ReportValidationWarnings

        AddHandler xslDes.ValidationEventHandler, AddressOf xslDesValidationEventHandler

        Dim des As XmlReader = XmlReader.Create(filename, xslDes)

        While (des.Read())

        End While

    End Sub

    Protected Sub xslDesValidationEventHandler(ByVal sender As Object, ByVal e As ValidationEventArgs)

        'some code here
    End Sub

I tested this procedure with a xml file which was well formed but contained some elements which were not conform to the xsd.

No event or error occured. It said the file was valid.

Then i tested with a badly formed file. A XmlException was raised but nothing happened with the ValidationEventHandler.

It seems lik

View Complete Post

More Related Resource Links

file upload in Create User Wizard Created User event with UpdatePanel Tag wont work?



In my Create User Wizard1 Created User Wizard Event, I am collecting extra information from text boxes and allowing

the user to uplad a file.



I have put the Submit button within an Update Panel Tag but since I have done this it does not work.

Is there a way round it. In this situation would you use a trigger.?


<br />

  <asp:UpdatePanel ID="UpdatePanel2" runat="server">

  <asp:Button ID="StepNextButton" runat="server"  CommandName="MoveNext"  align="middle"
                                            Text="Submit my Profile" />

parsing weather channel xml file using linq

 Hi I never used linq before and i'm having trouble parsing the xml file at  http://xoap.weather.com/search/search?where=" + strCityName.ToString(); I used to use a dataset but since trying to change my site to mvc, i thought i would use linq to xml, but after 2 days have still not found success. i have a class called: public class WeatherCityBLLModel { public string loc { get; set; } public string loc_id { get; set; } } and then a class called public class WeatherCityDALModel { public static List<WeatherCityBLLModel> GetLocation(string strCityName) { XDocument doc = XDocument.Load("http://xoap.weather.com/search/search?where=" + strCityName.ToString()) return doc; <<< Does not work } } How do i get the data from xoap.weather and pass it to my controller Any help appreciatedGeorge        

Event handler that will take an e-mail sent to a doc library and save it as an .MSG file within the

Hi All, I have a requirement to create an event handler that will take an e-mail sent to a doc library and save it as an .MSG file within the library? Any help/inputs on getting this done is much appreciated.  Hanif

Regarding Ui1 data type parsing in xml file

Hi all, I am sending data to host application in the xml file format given below <communicationData deviceStatus="D0"><communicationData> where "deviceStatus" is ui1 data type. The host application  throws a error " error: parsing "D0" as ui1 datatype ". I have tried to send deviceStatus value in decimal format as well but host application is not resposding correctly. If the hex value does not contain any alphabet then host application respond perfectly fine but if hex value contain any alphbet then host application throws error " error parsing "D0" as ui1 datatype" Can any one please tell me how to convert hexvalue(with alphabet) to Ui1 data types Thanks In advance Ravish Kumar      

On click Dialog Box to browse file...NOt firing serverside event...

<script type="text/javascript">    function Open()    {         var fileupload=document.getElementById('fupload');                      fileupload.click();  //       document.form1.submit();    }       </script>protected void Page_Load(object sender, EventArgs e)    {btnimport.Attributes.Add("onclick", "javascript:return Open();");    }<asp:Button ID="btnimport" OnClick="btnimport_onclick" runat="server" Text="Import"/>                                                        <input type="file" runat="server" style="display: none" id="fupload" />protected void btnimport_onclick(object sender, EventArgs e)    {        if (ViewState["CurrentTable"] != nu

Office.sharPoint.Server Event ID: 6482 Could not load file or Assembly


Event Type: Error
Event Source: Office SharePoint Server
Event Category: Office Server Shared Services
Event ID: 6483
Date:  4/16/2009
Time:  2:41:10 PM
User:  N/A
Computer: JPFS02
Application synchronization failed for Microsoft.Office.Server.Administration.UserProfileService.

Reason: Could not load file or assembly 'Microsoft.Office.Server.Search, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c' or one of its dependencies. The system cannot find the file specified.

Techinal Support Details:
System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Office.Server.Search, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c' or one of its dependencies. The system cannot find the file specified.
File name: 'Microsoft.Office.Server.Search, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c'
   at Microsoft.Office.Server.UserProfiles.SRPSite.SynchronizeManagedPropertyMappings()
   at Microsoft.Office.Server.UserProfiles.SRPSite._Init(ServerContext serverContext)
   at Microsoft.Office.Server.UserProfiles.SRPSite..ctor(ServerContext serverContext)
   at Microsoft.Office.Server.Administration.UserProfileApplication.get_ProfileSiteCache()
   at Microsoft.Office.Server.Administration.UserProfileApplication.Synchronize()<

catch the html button click event on a class file including html text box value.


I want to catch the html button click event on a class file including html text box value..

<p><input name="" type="text"  value="Enter Name*"/></p>
<p><input name="" type="text"  value="Enter Email*"/></p>

  <input name="Input" type="submit" value="Submit" />

plz tell me how can i do this..

Im downloading a file and checking internet connection im trying to use event to check when the file


I used breakpoint on the event but its never get there.

This is the code of the connection testing of the internet while downloading the file in the contrustor:

if (fdt.http_test()== true)
                    Client.DownloadFile(remote_image_on_server, temp_dir + temp_file);
                    label6.Enabled = true;
                    label6.Visible = true;
                    label6.Text = "Internet connection active";              

parsing tab delimited spanish characters file


Using vb.net/asp.net 2005.

another spanish character issue:  I am parsing special spanish characters, removing the tildes (EX:  "ñ" becomes "n") that customers send us in files, in tab delimited files that is.

When the characters are valid spanish characters (like "ñ") then this is not an issue, however some of the files that we get have characters such as:


Which should actually be:


Has anyone seen this and know any solution?  The "ñ" is fine but I am not certain what to do about the "±".

this is only one example, other spanish characters are listed as a question mark "?" so this is causing some issues.



not able to write error to event log and log file



I am using entlib 5.0 and framewokr 3.5(vs.net 2008)

I opened entlib console and open the webconfig file and added the listeners and my webconfig file is as below

<?xml version="1.0"?>
  <section name="loggingConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.LoggingSettings, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="true" />
  <sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
			<sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
				<section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
				<sectionGroup name="webServi

Moving file in event handler




I'm trying to move the filein ItemCheckingIn event.. Move succeeds but then client displays an error:


The URL 'Test/asdf.doc' is invalid.  It may refer to a nonexistent file or folder, or refer to a valid file or folder that is not in the current Web.


As a solution, I tried moving file in ItemCheckedIn event, but then client browser renders before the event finishes, so sometimes client browser displays outdated list data (with old item). 


I need to move a file (actually  I'm trying to rename file with extention - with ListItem["title"] we can't change extention) transparently to the user.


Possible solutions (that I can think of) :

1. Find a way to modify redirect url in ItemCheckingIn event (should be possible, but I don't know how)

2. Delay response until ItemCheckingIn event completes (don't think its possible)

3. Refresh client browser when ItemCheckedIn event (don't think its possible)



I spent so much time on this still could not find a workaroud.  

Any ideas will be appreciated!




How to find the control which have raised Onrowcommand event


Hi All,

In the last cell of my gridview I have 2 separate linkbuttons. I want to further process them using Gridview Onrowcommand event but How would I know which particular link has actually raised the event. Any idea? Please help. Thanks. 

Include Button Click Event in WPF Resource dictionary's CodeBehind file

I have 3 buttons as a part of menu in my MainWindow.xaml file.  
On click of these I have a Common Grid that gets populated with the
 data from my database. Now for these i have set various Control
 templates with 3 different keys for my 3 different options.

Coming to my main point. When I include Click events under my
 Gridview and compile, it doesn't let me to do so cause of error.
 And to overcome this i made use of a Code behind C# Class file for
 my resourcedictionary (styles.xaml) that is styles.xaml.cs.
I got this from http://stackoverflow.com/questions/92100/is-it-possible-to- set-code-behind-a-resource-dictionary-in-wpf-for-event-handling

But As soon as i follow all procedure mentioned at above link it
says me ... Error Message: 'X' does not contain a definition for 'show'
 and no extension method 'show' accepting a first argument of
type 'X' could be found (are you missing a using directive or an

Session_end event raised even open a different browser? vs2010,webform


file attachment control on infopath 2010 browser form, validating event not fired


If preview within InfoPath 2010, the validating event is fired. But After deploying the form to SharePoint 2010, the validating event does not fire.

Any ideas?


Blog: http://convergingpoint.blogspot.com/

Parsing a configuration file.


I have a configuration file which looks like this..

<?xml version="1.0"?>
		<add key="abc" value=http://msn.net/>
		<add key="xyz" value=http://google.com />
      <setting name="getCommunity" serializeAs="String">
      <setting name="Real_Subsciber" serializeAs="String">

I need to parse this configuration file of different application and store the values in key value pair like

1> abc,http://msn.net

2> xyz,http://google.com




Can any one help me out with

Unexpected end of file while parsing Name has occurred.




I have created a infopath 2007 form and publish to sharepoint library. Library has a workflow attached with it, infopath form has multiple dataconnections both sharepoint and webservice. When i open the form it get the correct data and no error comes i press submit button and form is saved without any issue/error. All data is saved corretly workflow starts properly and task\emails are sent. But when i open the saved from again it opens correclty but when close button is pressed an error is poped:


Unexpected end of file while parsing Name has occurred. Line 1, position 260.

System.Xml.XmlException: Unexpected end of file while parsing Name has occurred. Line 1, position 260.
at System.Xml.XmlTextReaderImpl.Throw(Exception e)
at System.Xml.XmlTextReaderImpl.Throw(String res, String arg)
at System.Xml.XmlTextReaderImpl.Throw(Int32 pos, String res, String arg)
at System.Xml.XmlTextReaderImpl.ParseQName(Boolean isQName, Int32 startOffset, Int32& colonPos)
at System.Xml.XmlTextReaderImpl.ThrowTagMismatch(NodeData startTag)
at System.Xml.XmlTextReaderImpl.ParseEndElement()
at System.Xml.XmlTextReaderImpl.ParseElementContent()
at System.Xml.XmlTextReaderImpl.Read()
at System.Xml.XmlLoader.LoadNode(Boolean skipOverWhitespace)
at System.Xml.XmlLoader.LoadDocSequen

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