|
I have some data passed to a function as a string like:
"<?xml version=\"1.0\" encoding=\"utf-16\"?><Patient xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"><FirstName>Joe</FirstName><LastName>Klink</LastName></Patient>"
I load this data into an XmlDocument object as follows:
mXmlDocument.LoadXml(var) - var has the xml string above
how can I validate this XmlDocument object against an existing schema.
Background: I can easily validate an xml file against a schema if am reading it from a physical file using XmlReader. My challenge is when am dealing with a loaded XmlDocument.
Thanks
|
|
|
|
|
XMLDocument.LoadXML supports loading from a XMLReader instance. XMLReader can be loaded from a stream. You can make a stream from the XML string you have. So if you know how to validate on a XMLReader, I think it can be applied here.
|
|
|
|
|
Thanks man.
I had a feeling this is the work around I would need to use. The thing I have to focus on now is how to 'make a stream from the XML string'. I am googling my way to it but if you have some quick pointers I will be glad to hear. Thanks once again.
|
|
|
|
|
Use the other overload which takes a TextReader instance. Your code would be
StringReader stringReader = new StringReader(YourXMLString);
XMLReader reader = XMLReader.Create(stringReader,settings);
XMLDocument document = new XMLDocument();
document.LoadXML(reader); StringReader is a subclass of TextReader .
|
|
|
|
|
Your proposal is very correct. Though with my mXmlDocument, all I did was:
XmlReader mXmlReader = XmlReader.Create(new StringReader(mXmlDocument.OuterXml), mReaderSettings)
|
|
|
|
|
For validating a XMLDocument object you have to follow the below steps:
first create the XmlReaderSettings object
XmlReaderSettings settings = new XmlReaderSettings();
settings.Schemas.Add("urn:xmlns:25hoursaday-com:my-bookshelf", xsd);
settings.ValidationEventHandler += new ValidationEventHandler(ValidationCallback);
settings.ValidationType = ValidationType.Schema;
Then create the validating XmlReader object and the XmlDocument object.
XmlDocument mXmlDocument = new XmlDocument();
mXmlDocument.Load(XmlReader.Create(document, settings));
Now validate the XMLdocument
mXmlDocument.Validate(new ValidationEventHandler(ValidationCallback), element.ParentNode);
Cheers!!
Brij
|
|
|
|
|
how i can refresh datagrid of contentplaceholder1 when contentplaceholder2 panel input data in database using ajax. i am not want to refresh?
I will do my best?
|
|
|
|
|
you can use one updatepanel in contentplaceholder1 and another in contentplaceholder2 and set the updatemode of both "Conditional".Now when you provide input in contentplaceholder2 after successfully updation in database ypu can call the updatepanelId.Update() for the updatepanel in contentplaceholder1.
Cheers!!
Brij
|
|
|
|
|
AspDotNetUser wrote: how i can refresh datagrid of contentplaceholder1 when contentplaceholder2 panel
R you using Multiple ContentPlace Holder on Master Page or you want to talk about multiple update panel.
if you are using multiple updatepanel , use updatepanel.Update() method and Make mode="Conditional"
Rest try to do !!!
|
|
|
|
|
thanks to reply
i use multiple contentplaceholder on master page. and as u suggest for multiple updatepanel i try this but i have multiple contentplace holder on master page.
i use updatepanel1.update();
after edit data on save button but data in datagrid not refereshed. while i use datagrid on same contentplace holder than value refereshed means work is done but datagrid not refereshed. how can i solve problem.
I will do my best?
|
|
|
|
|
change UpdateMode="Conditional" of updatepanel1
|
|
|
|
|
thanks to reply
yes that is already conditional beacause its also have trigger control for the dropdownlist or manymore buttons.
I will do my best?
|
|
|
|
|
thanks to all. my problem is solved. many many thanks to all.
I will do my best?
|
|
|
|
|
i m using dropdownlist in my gridview edititemtemplate, when i click update of gridview to send values in database i m getting error (Exception Details: System.Data.SqlClient.SqlException: Incorrect syntax near 'nvarchar'.)
for testing i use GridView2_RowUpdating event and write all the update code in it, its working fi9 values r going in DB, then after this execution end i get the same old error screen ... ? i m confused plz help.
thnkx in advance.
|
|
|
|
|
i don't understand what u want to do? please explain your question?
I will do my best?
|
|
|
|
|
dream_liner_7e7 wrote: (Exception Details: System.Data.SqlClient.SqlException: Incorrect syntax near 'nvarchar'.)
Your exception tell every thing. please debug your code
|
|
|
|
|
ok the simple question .. how to update values from gridview, when gridview update link is clicked??
thnx in advance
|
|
|
|
|
I posted in here the other day about getting a result from a popup window holding a calendar and the reponse I had was very helpful and that is since working. I am now moving on to the next section. This is where the user can select multiple things in a pop up window and pass them back or just one, or all. I have set it up so a list box displays all the areas that they can chose from and then along the bottom are the options to select all, or they can select individual items from the list box and click ok. The all bit is working fine as that’s just a matter of passing back a string that says all, which is similar to that of passing back the calendar date. However the multiple selection option is proving more difficult so far I have it set up so each item that they have selected is saved into an ArrayList. Is it then possible to pass back the ArrayList and populate a multiline text box with the values in the array list, I presume the passing back of the ArrayList would be fairly similar. It’s the displaying of the values with in it I am having trouble with.
Any help as always is greatly appreciated.
"When will I learn? The answers to life's problems aren't at the bottom of a bottle. They're on TV" - Homer Simpson
|
|
|
|
|
Nice to know that yestradys code working fine. and i was confident on that. any way , can you me more specefic on your problem. i am not getting actually.
please confirm. I will try my best to help you !@@
|
|
|
|
|
I have a list box in a popup window wher ethe user can select area's then when they click ok it passes the area's they have selected on the main window.
so they open the popup select say (area1, area 3, area7) outs of a possible list of ten. Then when they click ok on the original screen that they opened the popup from it displays...
you selected...
area1
area3
area7
as a simple example.
however when the user selects all the areas via the button "All". its will just show
you selected...
all
I currently have the all bit working following your example with the calendar. Its getting the multiple values working. I orginally thought of adding the value of each one they have selected to an array and then passing the array back. Its then getting it to display the values that are stored in the array i.e area1, area3, area7.
Thanks for the help.
"When will I learn? The answers to life's problems aren't at the bottom of a bottle. They're on TV" - Homer Simpson
|
|
|
|
|
you can add the elected iteam a string with some Delemiter and pass it to main window and the just split the string with the delemiter.
|
|
|
|
|
Thank you i was just looking into this cheers for the help.
"When will I learn? The answers to life's problems aren't at the bottom of a bottle. They're on TV" - Homer Simpson
|
|
|
|
|
great!!!! did you read my today article. ?
|
|
|
|
|
No I haven't. Will have a look now.
"When will I learn? The answers to life's problems aren't at the bottom of a bottle. They're on TV" - Homer Simpson
|
|
|
|
|
Is there a way of temporarily disabling a SharePoint workflow for a list item?
I have a situation where I send out an email if a list item yes/no box is checked. The workflow is triggered when a list item is either added to the list or updated, allowing for either immediate notification when the item is added, if it is complete, or deferred notification if the list item is not yet complete when added but completed at a later date.
In addition to sending out the email in the workflow I would like to update a list item field with a date/time stamp of when the email notification was sent and un-check the yes/no box so if there is a failure to deliver the email it can be sent again by checking the box. The problem is if I update the list item the workflow will be triggered again which is what I would like to avoid.
I would like to have the workflow only execute when a manual update is made but not when the automatic update from the workflow itself alters the list item.
If I could temporarily disable the workflow for the individual list item while I update it and then enable it again I could accomplish this.
If anyone knows how I can accomplish this please let me know.
|
|
|
|