XmlValidatingReader invalid xsi:type

I have an abstract base class and two derived classes that I want to
serialize and deserialize with schema validation. When I serialize
instances of the derived classes the XmlSerializer adds the
xsi:type="DerivedClass" attribute and the Instance Namespace. When I
attempt to validate the xml upon deserialization the
XmlValidatingReader chokes on this attribute value. I can't seem to
find a way around this. Any suggestions?

0
jason7153 (2)
5/4/2005 5:41:51 PM
dotnet.xml 7266 articles. 0 followers. Follow

2 Replies
688 Views

Similar Articles

[PageSpeed] 22

Could you post your final XSD and XML you are trying to validate using
XmlValidatingReader ?

"Jason Cartwright" <jason@cartwrightkids.com> wrote in message
news:1115228511.146570.88420@f14g2000cwb.googlegroups.com...
> I have an abstract base class and two derived classes that I want to
> serialize and deserialize with schema validation. When I serialize
> instances of the derived classes the XmlSerializer adds the
> xsi:type="DerivedClass" attribute and the Instance Namespace. When I
> attempt to validate the xml upon deserialization the
> XmlValidatingReader chokes on this attribute value. I can't seem to
> find a way around this. Any suggestions?
>


0
zafara (79)
5/10/2005 8:06:37 PM
Here's the XSD:

<?xml version="1.0" encoding="utf-8" ?>
<xs:schema id="esr-xrd"
targetNamespace="http://www.scriptlogic.com/esr-xrd"
elementFormDefault="qualified"
	xmlns:xrd="http://www.scriptlogic.com/esr-xrd"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
	version="1.0">
	<xs:simpleType name="guid">
		<xs:restriction base="xs:string">
			<xs:pattern
value="([a-z]|[A-Z]|[0-9]){8}-([a-z]|[A-Z]|[0-9]){4}-([a-z]|[A-Z]|[0-9]){4}-([a-z]|[A-Z]|[0-9]){4}-([a-z]|[A-Z]|[0-9]){12}"
/>
		</xs:restriction>
	</xs:simpleType>
	<xs:element name="category">
		<xs:complexType>
			<xs:attribute name="id" type="xrd:guid" use="required" />
			<xs:attribute name="parent" type="xrd:guid" use="optional" />
			<xs:attribute name="name" type="xs:string" use="required" />
			<xs:attribute name="description" type="xs:string" use="optional" />
			<xs:attribute name="path" type="xs:string" use="optional" />
		</xs:complexType>
	</xs:element>
	<xs:element name="categories">
		<xs:complexType>
			<xs:sequence>
				<xs:element ref="xrd:category" minOccurs="0" maxOccurs="unbounded"
/>
			</xs:sequence>
		</xs:complexType>
	</xs:element>
	<xs:element name="parameter">
		<xs:complexType>
			<xs:attribute name="id" type="xrd:guid" use="required" />
			<xs:attribute name="report" type="xrd:guid" use="required" />
			<xs:attribute name="name" type="xs:string" use="required" />
			<xs:attribute name="type" type="xrd:paramType" use="required" />
			<xs:attribute name="prompt" type="xs:string" use="optional" />
			<xs:attribute name="default" type="xs:string" use="optional" />
			<xs:attribute name="use" type="xrd:paramUse" use="optional" />
		</xs:complexType>
	</xs:element>
	<xs:element name="parameters">
		<xs:complexType>
			<xs:sequence>
				<xs:element ref="xrd:parameter" minOccurs="0" maxOccurs="unbounded"
/>
			</xs:sequence>
		</xs:complexType>
	</xs:element>
	<xs:element name="datasource" type="xs:string" />
	<xs:element name="fixed">
		<xs:complexType>
			<xs:sequence>
				<xs:element ref="xrd:datasource" minOccurs="0" maxOccurs="1" />
			</xs:sequence>
			<xs:attribute name="id" type="xrd:guid" use="required" />
			<xs:attribute name="parent" type="xrd:guid" use="optional" />
			<xs:attribute name="name" type="xs:string" use="required" />
			<xs:attribute name="type" type="xrd:paramType" use="required" />
			<xs:attribute name="prompt" type="xs:string" use="optional" />
			<xs:attribute name="default" type="xs:string" use="optional" />
			<xs:attribute name="use" type="xrd:paramUse" use="optional" />
		</xs:complexType>
	</xs:element>
	<xs:element name="fixed-parameters">
		<xs:complexType>
			<xs:sequence>
				<xs:element ref="xrd:fixed-parameter" minOccurs="0"
maxOccurs="unbounded" />
			</xs:sequence>
		</xs:complexType>
	</xs:element>
	<xs:element name="query" type="xs:string" />
	<xs:element name="layout" type="xs:base64Binary" />
	<xs:element name="reportDefinition">
		<xs:complexType>
			<xs:sequence>
				<xs:element ref="xrd:query" minOccurs="0" maxOccurs="1" />
				<xs:element ref="xrd:layout" minOccurs="1" maxOccurs="1" />
				<xs:element ref="xrd:categories" minOccurs="0" maxOccurs="1" />
				<xs:element ref="xrd:parameters" minOccurs="0" maxOccurs="1" />
				<xs:element ref="xrd:fixed-parameters" minOccurs="0" maxOccurs="1"
/>
			</xs:sequence>
			<xs:attribute name="id" type="xrd:guid" use="required" />
			<xs:attribute name="version" type="xs:unsignedShort" use="required"
/>
			<xs:attribute name="name" type="xs:string" use="required" />
			<xs:attribute name="description" type="xs:string" use="optional" />
		</xs:complexType>
	</xs:element>
	<xs:simpleType name="paramType">
		<xs:restriction base="xs:string">
			<xs:enumeration value="string" />
			<xs:enumeration value="bool" />
		</xs:restriction>
	</xs:simpleType>
	<xs:simpleType name="paramUse">
		<xs:restriction base="xs:string">
			<xs:enumeration value="optional" />
			<xs:enumeration value="required" />
			<xs:enumeration value="forced" />
		</xs:restriction>
	</xs:simpleType>
</xs:schema>

And the final XML:
<?xml version="1.0"?>
<xrd:reportDefinition
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:type="CLocalXmlReportDefinition"
id="5aee2f2d-1e17-4743-b271-96247c596fd5" version="0" name="Sample
Report" description="Sample Report"
xmlns:xrd="http://www.scriptlogic.com/esr-xrd">
  <xrd:query>select * from dbo.table1</xrd:query>

<xrd:layout>PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiID8+DQo8QWN0aXZlUmVwb3J0c0xheW91dCANCglHVUlETElCPSJ7MTVBNjlEOUYtQzYxRi00RjhDLTkwQkUtMjZEMzVGNDUxRDJEfSIgR1VJRFJFUD0iezUzNkVCQTI1LTJDQkEtNERDMS05OUE3LTc2MzdCMEY3MURDNn0iPg0KPC9BY3RpdmVSZXBvcnRzTGF5b3V0Pg0K</xrd:layout>
  <xrd:categories>
    <xrd:category id="e1e392ad-4b6c-4285-804b-2e23b2bb2ead"
name="Subcategory #1.1" description="Subcategory #1.1"
parent="fae94f48-82b3-43c6-aab2-4bf947432def" path="Category
#1\Subcategory #1\Subcategory #1.1" />
    <xrd:category id="e729935c-0a17-4b0f-94d0-9509d987d8c3"
name="Subcategory #2.1" description="Subcategory #2.1"
parent="0b1caba2-46a8-4f70-8043-f6d9bdb1ba95" path="Category
#2\Subcategory #2\Subcategory #2.1" />
  </xrd:categories>
  <xrd:parameters>
    <xrd:parameter id="ec6140b6-62f1-4d23-a9ae-8a23455495b3"
report="00000000-0000-0000-0000-000000000000" name="Sample Parameter"
type="string" prompt="Enter a Value" default="" use="required" />
  </xrd:parameters>
  <xrd:fixed-parameters />
</xrd:reportDefinition>

0
jason7153 (2)
5/10/2005 8:41:39 PM
Reply:

Similar Artilces:

Best file type aside from PDF?
Version: 2008 Operating System: Mac OS X 10.6 (Snow Leopard) Processor: Intel What is the best file type to save a resume in when using Mac 2008 Word so that the file does not get altered in format when viewed from a Windows OS? I know PDF is ideal but not all job boards use PDF format files so I am trying to find out what is the next best file format to use so that a resume looks the same on any OS. <br><br>Thanks for any guidance on this topic. There really isn't one. PDF is essentially a 'picture' of the document, not an editable text-based file, which is...

Gurus for XML TextStream vs Response Stream vs XMLValidatingReader
Hi, I try retrieve an XML stream from a webapp using a post "http://webedu.its.uct.ac.za/webct/public/serve_webctdb?OPERATION=homearea_xml&DB=global&WebCT%20ID=rodgersn_its_main&AUTH=ee09aabc77ef593917a60720f167c733" and result = req.GetResponse() ReceiveStream = result.GetResponseStream() from here ..I try read the XML retrieved, but... I've tried XMLStream and XMLValidatingStream..both return "There is invalid data at the root level" Trying a std StreamReader with say .readtoend or sr.Read(read, 0, 256) in a count lo...

Macro Error Invalid Argument every other run
I have a lovely piece of programming done by one of our MVPs here a couple years back that was working great. After many modifications to keep it current, it is now throwing an error every other run. These are all private sub modules in a UserForm that execute when you push a button. HERE IS THE PIECE THAT ERRORS For i = 1 To lstSiteFields.ListCount ffname = lstSiteFields.List(i - 1, 0) If .Bookmarks.Exists(ffname) Then If Not IsNull(lstSites.List(j, i - 1)) Then ...

BOM type restriction for Manufacturing
System setting that can disable all BOM types except MFG from being raised as MOs. Theo :) ---------------- This post is a suggestion for Microsoft, and Microsoft responds to the suggestions with the most votes. To vote for this suggestion, click the "I Agree" button in the message pane. If you do not see the button, follow this link to open the suggestion in the Microsoft Web-based Newsreader and then click "I Agree" in the message pane. http://www.microsoft.com/Businesssolutions/Community/NewsGroups/dgbrowser/en-us/default.mspx?mid=94d275f5-0e59-4554-86f3-86eb9936...

Invalid "Office In Use" Dialog
Hello, I'm a college student and whenever I'm on my college network and I try to run any of the programs in Microsoft Office 2004 for Mac (Student Edition), I get a message that reads as follows: <br><br>"Microsoft Office 2004 cannot start because Microsoft Office is already in use. <br><br>An Office program is being used by &lt;insert name here, it's always different&gt;. Your installation exceeds the number of installations permitted by the license agreement..." <br><br>I know that this cannot be true, because I have a valid c...

exchange migration wizard "data invalid" #2
I am in the process of an Exchange 2003 email migration between 2 forest with an external trust that has been established. I would like to use the Exchange Server Migration tool, but on the screen where you pick the specific mailboxes to move, it gives me an error of "the data is invalid". The specified account does have Full exchange administrator rights. Manolo ...

Inherited Schema/ XmlValidatingReader problem.
Hi I am encoutering a problem during the validation of an XML document when using 'XmlValidingReader'. My setup is as follows. I have a schema 'Document.xsd' which is imported into a further schema 'DerivedDocument.xsd'. Our xml sample 'Instancedoc.xml' uses 'DerivedDocument.xsd' as its schema. A piece of c# code, which utilises an XmlValidingReader succeeds to validate the xml when NO attributes are used from 'Document.xsd', but fails when these attributes are included. However, we can succesfully import complexTypes from 'Document.xsd&...

Data Type mismatch
Hi, I need to know why I get this data type mismatch error in the following: strPays = rst![CountryCode] Set rst = Nothing 'find latest number strNum = NZ(DMax("Right$([BranchNo], 2)", "Branch", "Left$([BranchNo],2) LIKE '" & strPays & "'"),0) The field BranchNo is a text field like CA-01, US-17 ect.... What I need to to is to retreive the highest number so I can create a new one Thanks Have you tried using that DMax() expression in a query to see what you get? By the way, if you use the "Like&q...

bad type for word wrap
Dynamics GP v9.0 Message pops up in a window with the error "Bad type for word wrap." Purchasing>transaction entry User creates a credit memo, saves, posts. When printing this message pops up. It does not cause any problems with the posting or printing. It is more of an annoyance than anything. Can anyone tell me how to stop it from popping up? It happens even if I change the default printer. -- ToddR Has the posting report been modified? If so, does the same message appear if you disable the modified report for the user, forcing use of the standard version? -- Richar...

Error 94 Invalid Use of Null
This code was working at first with the help of the experts on this site but I went on a 2 week Military Training and came back to finish up this database and now it's giving me an error of "Error 94 Invalid Use of Null". What in creation could have happened? This is my code. Could it be the formatting on the form? I think I changed the formatting of cells and am not using some of the fields. Please HELP!! Private Sub AddAppt_Click() On Error GoTo AddAppt_Err ' Save record first to be sure required fields are filled. DoCmd.RunCommand acCm...

Bank Rec Record Type Code?
We're trying to set up Bank Rec and can't figure out how to identify the record type code that is required by GP 8.0. Our bank doesn't provide us with a record type code so how can we set up bank rec correctly? The fields we get are: account # date amount transaction type check # description Any help would be greatly appreciated. Thanks, Mike Abrahamson If you're attempting to set up "Electronic Reconcile" I believe that the record type code relates to the records coming from your bank. You need to specify which records are headers, detail, footers. There ha...

XmlValidatingReader problem
Hi I am encoutering a problem during the validation of an XML document when using 'XmlValidingReader'. My setup is as follows. I have a schema 'Document.xsd' which is imported into a further schema 'DerivedDocument.xsd'. Our xml sample 'Instancedoc.xml' uses 'DerivedDocument.xsd' as its schema. A piece of c# code, which utilises an XmlValidingReader succeeds to validate the xml when NO attributes are used from 'Document.xsd', but fails when these attributes are included. However, we can succesfully import complexTypes from 'Document.xsd&...

PivotTable: Type Mismatch
I am trying to use the PivotTable view in Access 2007 using VBA, but I keep getting type mismatch errors. According to Microsofts guide in: http://msdn.microsoft.com/en-us/library/aa139960(office.10).aspx (for Access 2003 - but should be the same for 2007) The code I should use is (as a sample): Dim pTable As OWC11.PivotTable ' Set pTable = Me.PivotTable Set pTable = Forms("frmPivotTable").PivotTable pTable.BackColor = vbRed I have a reference to the OWC11 DLL The type mismatch error happens on the Set pTable = Line - either one cause...

Encryption Type
Hi There I have a customer who wants to know how secure the data is when it transfers from SO to HQ or from HQ to SO. He wants to know thinks like what protcol is it using to transfer data and what type of encryption is used for data security. would be grate if one of yous can help.... -- Cheers Topi This is a multi-part message in MIME format. ------=_NextPart_000_02F1_01C6D6CF.B76D8460 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Topi, Numerous times in different docs its mentioned that the transfers are = compressed and encrypte...

invalid object
how can one fix "invalid object message" problem on trying to close a pst folder? OD I have to start a new profile from scratch to fix the problem. There are quite a few accounts and alias to go through. I am willing to go through registry to fix after backup if registry fix is possble the content of the folder is visible and valid and indeed the corresposing ..pst file is locked. I think what happened was that another user had that pst file open and outlook was started with the same pst file to be opened. ...

data type mismatch
I am trying to run the following code and keep getting a data type mismatch. Can somebody please have a look and let me know where I'm going wrong. Private Sub Command7_Click() Dim ctl As Access.Control Dim db As DAO.Database Dim qdf As DAO.QueryDef Dim varItem As Variant Dim strCriteria As String Dim strSQL As String Dim Val As Currency Set db = CurrentDb() Set qdf = db.QueryDefs("qry_payrolledit") For Each varItem In Me!LstPayroll.ItemsSelected strCriteria = strCriteria & "," & Me!LstPayroll.ItemData(va...

Type Mismatch
I have a type *Address* and a type *ResidentialAddress* which inherits Address. When I try to execute SOMECLASS.ResAddr = OTHERCLASS.Addr I get the inevitable type mis-match error "unable to cast type ObjectModel.Address to Type ObjectModel.ResidentialAddress" I was thinking that since ResidentialAddress inherits Address, there must be some way to do this assignment Dave T schrieb: > I have a type *Address* and a type *ResidentialAddress* which inherits > Address. When I try to execute SOMECLASS.ResAddr = OTHERCLASS.Addr I get the > inevitable type mis-ma...

XmlValidatingReader
I have troubles validating XML files with key/keyref constraints. Here´s my schema: <?xml version="1.0" encoding="utf-8"?> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:transNS="http://Festo.Common.Translation" xmlns="http://Festo.Common.Translation" targetNamespace="http://Festo.Common.Translation" elementFormDefault="qualified" attributeFormDefault="unqualified" version="1.0.1"> <xsd:simpleType name="stVersionSyntax"> <xsd:restriction base=&q...

Invalid high surrogate character (0xDEB6).
I am building an XML document using the standard calls to create elements and attributes. Occasionally I get the following when calling xmlDoc.OuterXml. What's going on and how do I avoid this? System.ArgumentException occurred Message="Invalid high surrogate character (0xDEB6). A high surrogate character must have a value from range (0xD800 - 0xDBFF)." Source="System.Xml" StackTrace: at System.Xml.XmlTextEncoder.Write(String text) at System.Xml.XmlTextWriter.WriteString(String text) at System.Xml.XmlText.WriteTo(XmlWriter w) at Sys...

Invalid Domain Name. Domain name invalid or unreachable #2
Hi, I am getting following error in MS CRM 4.0 when using Deployment Manager: "Invalid Domain Name. Domain name is either invalid or unreachable". Also when using the Plug-in registration tool, I am getting the same error. And I am not able to register any plug-in. Request you to please provide your inputs. Thanks in advance, help appreciated. Bharat On this posting there is some code to help you list the domains active from the machine you wish to install CRM 4.0 on. create this inside a .vbs file and run it using cscript from the system32 folder and it listed mine correctl...

Investment Type #3
I am using Money 2006 Premier. I incorrectly classified a sock as a mutual fund and now can't change the investment type. The details screen does not have an appropriate check box. I deleted all transactions with the hope that I could then delete the investment and reenter it with the correct type. However Money will not allow me to delete the investment insisting there are open transactions even though they have been deleted. Can anyone help advising me how to change the investment type. A friend said something about exporting and reimporting a QIF file. In microsoft.public.money,...

XmlValidatingReader too sensitive?
XmlValidatingReader too sensitive? I have the following schemas (simplified) and xml file which validate fine in xmlspy, but blow up in xmlvalidatingreader with: 'The 'Hierarchy' element is not declared. An error occurred'. Any help appreciated. To give a brief explanation of what I'm trying to do, the schema 1 is a schema that is coming from a third party. The schema 2 is a wrapper around that document. The problem comes into light when a document based upon schema 1 has an element outside of any namespace. Even though I qualify the tag, as in <Hierarchy xmlns=...

Invalid carachter loading xml
I'm trying to parse a xml source. 1) I query via webservices one table and obtain this output ================================================================ <?xml version="1.0" encoding="utf-8"?> <ExecuteReaderResult xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.mysite.com"> <DataSet> <xs:schema id="NewDataSet" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-c...

SchemaCollection and XmlValidatingReader
Can anyone answer this question - or tell me if it's possible? I have this collection of XML files that do not define a doctype, therefore explorer etc just says that a particular entity is undeclared. When using a validator so that I can validate the xml file, I create an XmlValidatingReader, setting the validation type to DTD. Then I add both the dtd and an entities.txt file (which is all the entities defined in xml format). When the SchemaCollection tries to .Add (null, dtdFile) - I get an exception saying that Doctype is not defined. When looking at the dtd, it looks like a norma...

Outlook caused and invalid page fault
Receiving message "Outlook caused an invalid page fault in module MS09.DLL at 017f:3092159f." This occurs when closing Outlook and occasionally when in Outlook. Have tried "Detect and Repair" and tried applying updates to Office 2000. Could not find answer on Knowledge Base. Any suggestions?? ...