However, when I try to validate the XML against the XSD, I get this error message:
The element 'Autodiscover' in namespace 'http://schemas.microsoft.com/exchange/autodiscover/mobilesync/requestschema/2006' has invalid child element 'Request' in namespace 'http://schemas.microsoft.com/exchange/autodiscover/mobilesync/requestschema/2006'.
List of possible elements expected: 'Request'.
Can anyone please please help me with this? I've been wrestling with this problem all afternoon. Thanks!
manfingram
0 Points
4 Posts
Trouble with XML/XSD validation
Apr 25, 2012 12:08 AM|LINK
I'm working with Exchange ActiveSync and the document here: http://msdn.microsoft.com/en-us/library/dd299441(v=exchg.80).aspx describes a sample XML request as:
<?xml version="1.0" encoding="utf-8"?> <Autodiscover xmlns="http://schemas.microsoft.com/exchange/autodiscover/mobilesync/requestschema/2006"> <Request> <EMailAddress>chris@woodgrovebank.com</EMailAddress> <AcceptableResponseSchema> http://schemas.microsoft.com/exchange/autodiscover/mobilesync/ responseschema/2006 </AcceptableResponseSchema> </Request> </Autodiscover>It then describes the XSD as:
<?xml version="1.0" encoding="utf-8"?> <xs:schema xmlns="http://schemas.microsoft.com/exchange/autodiscover/mobilesync/requestschema/2006" xmlns:mstns="http://schemas.microsoft.com/exchange/autodiscover/mobilesync/requestschema/2006" xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://schemas.microsoft.com/exchange/autodiscover/mobilesync/requestschema/2006" elementFormDefault="unqualified" id="requestschema2006"> <xs:element name="Autodiscover"> <xs:complexType> <xs:sequence> <xs:element name="Request" type="RequestType"/> </xs:sequence> </xs:complexType> </xs:element> <xs:complexType name="RequestType"> <xs:sequence> <xs:sequence> <xs:element name="EMailAddress" type="xs:string"/> <xs:element name="AcceptableResponseSchema" type="xs:string"/> </xs:sequence> </xs:sequence> </xs:complexType> </xs:schema>However, when I try to validate the XML against the XSD, I get this error message:
The element 'Autodiscover' in namespace 'http://schemas.microsoft.com/exchange/autodiscover/mobilesync/requestschema/2006' has invalid child element 'Request' in namespace 'http://schemas.microsoft.com/exchange/autodiscover/mobilesync/requestschema/2006'. List of possible elements expected: 'Request'.
Can anyone please please help me with this? I've been wrestling with this problem all afternoon. Thanks!
amit.jain
Star
11225 Points
1815 Posts
Re: Trouble with XML/XSD validation
Apr 25, 2012 08:32 AM|LINK
Change your XSLT schema as mentioend below
<!--?xml version="1.0" encoding="utf-8"?-->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl">
<xsl:output method="xml" indent="yes">
<xsl:template match="/">
<Request>
<xsl:apply-templates select="//Request">
</xsl:apply-templates></Request>
</xsl:template>
<xsl:template match="//Request">
<Request>
<xsl:attribute name="EMailAddress">
<xsl:value-of select="EMailAddress">
</xsl:value-of></xsl:attribute>
<xsl:attribute name="AcceptableResponseSchema">
<xsl:value-of select="AcceptableResponseSchema">
</xsl:value-of></xsl:attribute>
</Request>
</xsl:template>
</xsl:output></xsl:stylesheet>
Refer http://csharpdotnetfreak.blogspot.com/2011/12/gridview-xmldatasource-example.html for more info
amiT jaiN
ASP.NET C# VB Articles And Code Examples
manfingram
0 Points
4 Posts
Re: Trouble with XML/XSD validation
Apr 30, 2012 11:35 PM|LINK
Hi Amit, can you please elaborate on why applying an XSLT would help? Thanks!