XSD (schemas) with xs:any tags

Hello.

I used svcutil (XMLSerializer though) to do code generation for me on my 
schemas which includes xs:any elements.

Where these xs:any elements exist, svcutil produces classes with member 
variables and their associated public properties of type:
System.Xml.XmlElement

I am taking the generated classes from svcutil and building a dll of them.  
I want someone using this dll to be able to put their type into the classes 
that had the xs:any and thus XmlElement will not work.

I can not stick just any old type in their because I don't want the 
auto-generated schema from the class to include a specific type reference.  I 
was thinking about putting a base type in there or even a type of type 
"object" and have the person using my dll inherit from that type.  I was 
thinking of combining this with the Visitor Pattern to give me control of 
what is extended.  The downside of this is that my dll user would have to 
inherit from my type and could not use inheritance on their own type.

Any thoughts on this and in dealing with xs:any?  Thank you.
0
Utf
5/25/2010 2:48:01 PM
dotnet.xml 7266 articles. 0 followers. Follow

0 Replies
1232 Views

Similar Articles

[PageSpeed] 41

Reply:

Similar Artilces:

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=&...

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 ...

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...

Loading XML schema into Access 2007
I am trying to import the XML schema at http://gdmxml.fugal.net/gdmxml.xsd into Access 2007. But I am getting strange results. Only 1 table (assertion) with a single column gets created. Can anyone point me to more info on importing XML into Access 2007? -- Dennis ...

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> ...

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...

Retrieving default values specified from XML Schema file
Hi All, I have an VS.NET 2003 app which will be processing XML files, some of which will have empty elements (for example, <Item />). I have an XSD file which should supply default values, but I am not able to read these plugged in value using an XMLDocument object. The validation is working fine--it's just not providing any default values. Has anybody tried this? Am I must be missing something? This is one of those that "should be simple..." Here's a simplifed version of the code and XML files: XmlDocument xmldoc = new XmlDocument(); XmlSchemaCollection my...

tagging file in windows and upload to sharepoint
Hello, I have created picture library in MOSS 2007 and I would like to upload images containing windows file tags from a hard drive to sharepoint. Unfortunately my picture library doesn't contain tags (or keywords) assigned to picture. Is there any way to store pictures with tags in sharepoint? If not, is there any possibility to change custom column property (title, keywords etc) for more than one picture in one editing without additional scripting? ...

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 ...

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...

Unsupported deletion of schema fields
Hi there! In a past conversation about SQL Server limitation, one of you has proposed the unsupported solution below: "...There is a very unsupported way to change what you've done: export the customizations into XML, edit directly, re-import and hope for the best...." We have a useless custom field in AccountBase and we did the following: 1. remove it from the Account Form. 2. In the SQL Server we deleted the field from the publication properties. 3. We have Exported the xml file from Deployment Manager, we deleted 2 tags in which the field name existed and then we imported ...

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...

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...

Hover over flyout tags?
Is it possible to create a tag or "flyout" that pops up when you hover over a diagram shape? I would like to be able to explain some items in more detail with out putting all the info on the "face" of the shape. Thank you! consider inserting a comment. select shape => command bar Insert => comment... Al "Dustin" <dustins@fireglass.comNOSPAM> wrote in message news:Od5S9pMTEHA.332@TK2MSFTNGP11.phx.gbl... > Is it possible to create a tag or "flyout" that pops up when you hover over > a diagram shape? > > I would like to be able...

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 ...

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...

XML/XSD: Show available attribute values from XSD in Intellisense
Hi: I want to limit the values that can be entered for particular attributes. 1) I have created an XSD from my XML document. 2) I dropped that XSD file into the following directory C:\Program Files\Microsoft Visual Studio .NET 2003\Common7\Packages\schemas\xml 3) When I use VS.NET to create a new XML document, I do get the intellisense working (all attributes and elements show up). However, I want the intellisense also show the list of possible values that can be used for particular attributes. How do I do this? Thanks, Don I dont think intellisense would perform this for you. You ...

apply in-memory .xsd schema to updategram
Below I'm generating an updategram via xslt and currently referencing schema via <updg:sync mapping-schema="hpXSD.xsd"> .... </updg:sync> But I would like to LOAD the .xsd schema into memory and APPLY to the updategram in memory. Tried using XmlValidatingReader but couldn't get it to work. Thanks Dim xmlPath As String = "xml/hpXML.xml" Dim xsltPath As String = "xml/hpXSLT.xslt" Dim xsdPath As String = "xml/hpXSD.xsd" '(1) XML object Dim xmlDoc As XmlDocument = New XmlDocument xmlDoc.Load(xmlPath) Dim root As XmlElement = xml...

Schema Manager
I want to mapp a account field to quote field. I am to trying with schema manager, but I don't see the changes. the changes are publishing and I restart the IIS. Can anybody give me any pointers on how I would achieve this? Thanks Carlos Dont know if I am following you but if you have mapped from an account to a quote and have created the mapping. Have you re-published the account and quote object then restarted iis. -- John O'Donnell Microsoft CRM MVP http://www.microsoft.com/BusinessSolutions/Community/CRMFaqLanding.aspx "Carlos" <anonymous@discussions.mic...

XSD
I am trying to design dataset xsd file using xsd designer. Every row on the table in question is defined with the following columns: id1 int dt date period0 string makeupdt0 string period1 string makeupdt1 string period2 string makeupdt2 string period3 string makeupdt3 string period4 string makeupdt4 string I am looking to represent period and makeupdt columns as part of a structure which occurs 4 times. Also, how do I access these elements using generated dataset class file? Thanks in advance, ...

Relative XSD path
Hi guys, I want to validate my xml by xsd schema. But in the xsd file I have RELATIVE includes to the others xsd files that located in ..\ directory for the main xsd. Could you provide me code example that makes such a validation. All the examples I found in google doesn't work. Thanks a lot, Aleksey Aleksey Timonin wrote: > I want to validate my xml by xsd schema. But in the xsd file I have RELATIVE > includes to the others xsd files that located in ..\ directory for the main > xsd. > Could you provide me code example that makes such a validation. All the > examples I ...

XML Schema
Hi, i'd like to validate my XML file (see below) using XML Schema. Now my question: is it possible to limit the occurrence of the element b in the data element. I mean: data can contain up to 6 b elements, but it doesn't matter how the b elements are allocated in the elements a and c. Any help would be appreciated -- thank you! XML File (shall be valid) <data> <a> <b>...</b> <b>...</b> <b>...</b> <b>...</b> </a> <c> <b>...</b> <b>...</b> </c> </da...

xsd questions (xsd to classes)
This is a multi-part message in MIME format. ------=_NextPart_000_0028_01C37925.474263F0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hi, I have some questions regarding to use vs.net to generate xsd from = database tables then generate classes, not typed datasets, from the xsd. Basically I want to have some light-weigh classes to represent the = database tables/views (I know tables/view are not business entities, but = this is a good starting point and i am lazy =3D) Here are what I did: - used xsd.exe to generate business entities,...

Querying with schema
Hi, I have the following XML, which has an associated schema but I can't get any results from an XPath query because I think I'm using the namespace prefix incorrectly. Can anyone tell me what I'm doing wrong? XML: <?xml version="1.0" encoding="UTF-8"?> <ResultSet xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:yahoo:srch" xsi:schemaLocation="urn:yahoo:srch http://api.search.yahoo.com/SiteExplorerService/V1/InlinkDataResponse.xsd" totalResultsAvailable="2104355" firstResultPosition="1&...