XSD Validation of an XML in C#

I am trying to develop a C# Webservice where I validate incoming XML
files using an XSD schema. 3 of the parameters may have greater than
100 valid entries. These are stored in a SQL Server DB.
Rather than use enumerations in teh XSD for the validation is there
another way I can do this?
0
9/14/2004 5:26:45 PM
dotnet.xml 7266 articles. 0 followers. Follow

0 Replies
668 Views

Similar Articles

[PageSpeed] 57

Reply:

Similar Artilces:

Loading xml schema from database
The XmlDataDocument can load xml from a string <script> string sXml = "<Root><Elemenet>Example</Element></Root>"; xdd.LaodXml(sXml) <.script> The question is, can I load a xml schema the same way(with string i retrieve from a databas)? I wand to load the schema into a DataSet or into a XmlDataDucument, and use the document DataSet member. Thank you ZAky ...

The Pivot Table field name is not valid,
I am receiving the above error message, but don't understand why. My data is in columns, organised as a list and the columns are labelled. What do I have to do to get over this? Thanks Denise Maybe there's a hidden column, with no heading text, or you've accidentally included a blank column at the end of the range. deniseh wrote: > I am receiving the above error message, but don't understand why. My data is > in columns, organised as a list and the columns are labelled. What do I have > to do to get over this? > Thanks > Denise -- Debra Dalgleish Ex...

trouble validating against xsd
Hello, I have an xsd file that I'm trying to use to validate some xml against. I'm hoping this is a simple problem, but I just don't see it. I get the error "The 'role' element is not declared." when trying to validate this xml: <users> <user id="jon" pwd="pass"> <roles><role>Admin</role></roles> </user> </users> Against this schema: <?xml version="1.0" encoding="utf-8" ?> <xs:schema elementFormDefault="unqualified" xmlns="" xmlns:xs=&...

serializing and deserializing XML fragments
Is it possible to serialize and deserialize objects into XML fragments. I have a compiled type that can be configured differently based on entries in an XML file. Something like this: public class Thing { private int thingInt; public Thing(); public int ThingInt { get { return thingInt; } set { thingInt = value; } } } So I'd like to be able to put entries into the file like this: <?xml version="1.0"?> <Thing> <ThingInt>4</ThingInt> </Thi...

About XSD Parser
Hello, I have a XSD file which has the following format: <?xml version="1.0"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.w3schools.com" xmlns="http://www.w3schools.com" elementFormDefault="qualified"> <xs:element name="note"> <xs:complexType> <xs:sequence> <xs:element name="to" type="xs:string"/> <xs:element name="from" type="xs:string"/> <xs:element name="heading&q...

Array to Xml to DataSet
I have an array of objects (my own custom class). I'm trying to convert that array to a dataset. So I serialize the array to XML, then try to load the XML to a dataset. MemoryStream mem = new MemoryStream(); XmlTextWriter w = new XmlTextWriter(mem,System.Text.Encoding.UTF8); ser.Serialize(w,books); XmlTextReader r = new XmlTextReader(mem); DataSet dsBooks = new DataSet(); dsBooks.ReadXml(r); <=== error here However, the last line generates System.Xml.XmlException. Additional info is "System Error". Does anyone know the best way to do this? I prefer not to write to dis...

MSI Serial Number Validation
Hello, I found MS's example on "How to Validate a Serial Number". However, the process seemed long and confusing. Does anybody know of a tool, that automates the process, of validating a programmer-defined serial number ? TIA, -jc Buy a third-party tool, or use one of the open source or free downloads. Nearly everyone who attempts this gets it wrong. joe On Thu, 29 Apr 2010 21:55:01 -0700, jc <jc@discussions.microsoft.com> wrote: >Hello, > >I found MS's example on "How to Validate a Serial Number". >However, the proce...

Entity XSD schemas are invalid
Hi, As part of doing a custom integration using BizTalk 2004, we need to do mappings between MS CRM and other applications. However the xsd's provided with the SDK and the stored procedures generating them are/produce invalid (non-w3c compliant) xsd. It might be an idea for someone in the MS CRM dev group to go over these xsd's with a validator and fix the incorrect sections, including th generating stored procedures so updated schemas can be made available for integration purposes. Best Regards Thomas Scheelhardt I have found the majority of examples in the SDK are incorrect an...

Ignoring Elements in XSD
How do I write a schema that is only validating elements: 1,4,7,8,9 and ignores every other element? I also need to not to care about the order of the elements or how many are in between elements that I am trying to validate. XML: <root> <element1 /> <element2 /> <element3 /> <element4 /> <element5 /> <element6 /> <element7 /> <element8 /> <element9 /> </root> XSD: <xs:element name="root"> <xs:complexType> ...

Data Validation Ammendment
I have set up two drop down menus which use data validation. The results of the second drop down menu depend on what was selected in the first drop down menu. Nonetheless, now I want to ammend one of my list. I have tried adding my new determining factor in the next cell and then highlighting all the cells and naming the cells again, however whenever I press "return", it just highlights the original cells, unhighlighting the new one. Any help? Do insert>name>define, select the name and in the refers to box change the range and click add or select the new range, insert&g...

How can I generate a user friendly error message when validating XML against a schema?
Hello When validating xml against a schema, the most frequent error I get is something like "The 'FOO' attribute has an invalid value according to its data type. An error occurred at , (25, 913)". That error message is not very user friendly, so I'd like to extract the data in the failing node along with its parent node data, and show that to the user. Do you know a way to do this? I don't think there's any other information about the error position than the line number and position. Yes, line number and position is the only information that you have to...

Create filtered dataset from XML file?
I need to create a Dataset and datatable from an XML file. The only way I know how to make a Dataset and Datatable, is by using an Access database as my datastore: You know, the usual thing in all the books; an OleDbDataAdapter, with a SQL string and connection. How can I do this using an XML file instead of an Access table? I know I can convert an XML file straight into a Dataset. But the dataset always contains ALL the info from the XML file. I want the dataset to be filtered by using some sort of query. A couple years ago I hurt my brain figuring out Xpath. Boy, i'm just not mea...

Workflow Error "The Parent is Not Valid"
I have a custom Entity that will not permit me to create a Task associated to it through Workflow. When I run a Workflow to create a Task I get the error message, "The Parent is Not Valid". When I look at Workflow Monitor the Workflow is paused on that particular Task. However, when I go back into Apply Rule the Workflow rule is still available to be run again??? Which would seem to indicate that the Workflow had been completed or was never run. I can manually create a Task associated with the Entity. I can also create phone call and e-mail Activities through Workflow with no errors...

using embedded .xsd vs file based .xsd
I am thinking of embedding my schemas as embedded resources instead of reading it using URI at run-time. I came across some snags while trying to do just that such as, previously unknown to me, XmlValidatingReader.Schemas.Add was using XmlValidatingReader.Resolver to resolve my schemas using the URI method. Resolver property was never set, so the reader simply ignored any external references even though one of the schema explicitly imports the other one. I verified this by removing the referred schema from the schema collection, and the code chugged along fine. But when I changed the code to ...

Binding DataList to XML
Hi, I'm trying to bind a datalist to an XML file to create a menu bar of sorts. The XML file contains a list of menu items grouped into two main topic areas see below: <TOPICLIST TYPE="MenuItems"> <TOPICS TYPE="Type1"> <TOPIC> <TITLE>Menu 1</TITLE> <URL>somewhere.aspx</URL> </TOPIC> <TOPIC> <TITLE>Menu 2</TITLE> <URL>somewhere.aspx</URL> </TOPIC> <TOPIC> <TITLE>Menu 3</TITLE> <URL>somewhere.aspx</URL> </TOPIC> </TOP...

suppressing xsd namespace declarations with XmlSerialize?
Hi... I'm just starting to play around with xml serialization. Is there any way to suppress the xsd and xsi declarations in the resulting xml? It doesn't appear that they're used but they come out anyway. Thanks -Mark Hi Mark, We need to perform more research on this issue . We will reply here as soon as possible. If you have any more concerns on it, please feel free to post here. Thanks for your understanding! Best regards, Wen Yuan Hi Mark, Thanks for your wait. If you don��t need xsi and xsd declaration with xml serialization, you can use XmlSerializerNamesp...

Problems with XML, XSD, Web, Services & InfoPath
Hi all, Have been playing about with web services but unable to achieve what I am wanting and in attempts finding strange problems. I have created a web service for retrieving customer data and for updating the data using datasets. I have created a XML schema. I decided to use InfoPath for testing things out. Works great for getting the data. The data table on SQL Server 2000 allows nulls. If I was to change this I would have to split my customers into 2 tables. The table allows customer details to be stored as an individual or organisation. As a result some fields don't require ...

Data Validation Question #10
First sorry if this is a repeat - tried earlier but can not see it I have a list of equipment that is Type,Make,Model, Height,weight,Lenth,Depth etc What I would like to do is have combo boxes (3) starting with Type - you pick the type you want the in the next combo it filters the list so just the Makes with that type available are in that combo - pick your make and the third combo is just the model numbers of the type and make I can then use vlookup to add in the height etc The big list is on a different worksheet any easy ways to do this without VB or guidance on the VB way if that is t...

validation list drop down box, how do I bring in text commands
I have a reference set in excel that is two columns. The first column lists functions in text (i.e. AVERAGE, COUNT, COUNTA, MAX, MIN....). The second column lists the corresponding function number (i.e. AVG = 1, COUNT =2....). I made a drop down box using data, validation, list so that the function numbers appear in a row. The row below I put in subtotal(grab command from drop down, data set to calc). I can't figure out how to return the TEXT from my columns above, rather than function number. I want my drop down to have AVERAGE, not 1. Hi Scott, Debra Dalgleish has pages ...

XML Validation #5
I'm validating an XML document against an XSD schema using the code shown below. Everything works good, but I'm trying to find a way to grab the node\attribute value that threw the error. Ideally if I could get the attribute name and value that would be all I need. In addition to what is shown below I've tried catching XmlSchemaValidationException, but it still didn't have what I needed. If anyone has an example or idea on how to do this I would really appreciate the help. Thanks. === XML === <?xml version="1.0" encoding="utf-8" ?> <annu...

Schema Validation
I have an XML document that contains the xsi:noNamespaceSchemaLocation attribute giving the location of the XSD file to use for validating it. I created an XmlReader on the XML file. I then created an XmlValidatingReader based on the XmlReader which I use to read the file with validation. What I haven't been able to figure out is how to get the code to pick up the XSD to use for validation. I have manually put it into the XmlSchemaCollection of the XmlValidatingReader using the hard-coded location of the XSD file and it validates correctly, but I want to know how I get the schema from...

Validating XML against XSD where XSD has includes
I have 2 Xsd's The one contains basic type definitions <?xml version="1.0" encoding="utf-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified"> <xs:simpleType name="TrueFalse"> <xs:restriction base="xs:NMTOKEN"> <xs:enumeration value="true"/> <xs:enumeration value="false"/> </xs:restriction> </xs:simpleType> </xs:schema> The other includes the previous XSD so th...

Mail validation using rules.
I have some questions for Outlook 2000: - - - - - 1) I prefer to validate incoming mails using rules checking the sender against a whitelist of addresses and domains. To my knowledge this is rather unhandy to implement in Outlook 2000 because the addresses must be in my addressbook/contact which can not contain domains only addresses. Hereby I have to maintain a long list of rules just for this validation purpose. I wonder if there is a possibility somehow for using simple textfiles (1 or 2) containg valid addresses and domains handled by 1 or 2 rules. Or maybe there is another way around i...

XSD #2
I have an XML that when I try to create an xsd schema for it it would error out and say something about duplicate keys. Does that mean that the XML is bad? Thanks How are you trying to create a schema for it? Are you using http://apps.gotdotnet.com/xmltools/xsdinference/ -- This posting is provided "AS IS" with no warranties, and confers no rights. <john88m@hotmail.com> wrote in message news:eCcFyFK1DHA.3416@tk2msftngp13.phx.gbl... > I have an XML that when I try to create an xsd schema for it it would error > out and say something about duplicate keys. Does that me...

How does C# avoid needing C++ style header files?
I am new to C# and want to understand its architecture a little better. How does C# avoid needing C++ style header files? Hello, By design when you compile some code, metadata are stored as part of the generated file allowing to use those classes in a self contained way. It has all the needed info built into it. See : http://msdn.microsoft.com/en-us/library/xcd8txaw(VS.71).aspx (Metadata Overview) -- Patrice "Peter Olcott" <NoSpam@SeeScreen.com> a �crit dans le message de groupe de discussion : t8CdnWMCZcduNcTWnZ2dnUVZ_hudnZ2d@giganews.com... &...