| Author |
Error -- > Validation against XML schema failed
|
divya chamarti
Ranch Hand
Joined: Jul 28, 2006
Posts: 56
|
|
Hi All Initially i am using a.xsd file(Schema) for a project which takes an input file (.xml) file from a location and read the entire file and then a .xslt(transformation purpose) is used to transform the input xml file in a desired fashion (which is compatible with the .xsd file against which the outcomming .xml file from .xslt , is validated , so it's running fine but what happen there is some changes done in the schema(.xsd file) (and no changes in the inpuit .xml file) so what we have to do , we have to change in the .xslt file so that it will change the outcomming .xml file compatible to .xsd(new one) file for validation to be sussessfully. for the old .xsd and .xslt files everything is running fine but according to the .xsd file i have changes the .xslt file but at run time the validation fails and the error is : "Validation against XML schema failed" sample file is : 1) old .xsd file : <?xml version="1.0" encoding="UTF-8"?> <!-- ============================================================================= --> <!-- VMS to Vcommerce catalog schema --> <!-- v 6/22/2007 --> <!-- ============================================================================= --> <!-- Revision History --> <!-- 4/23: added minOccurs="0" to all second-level collection tags including <genre>, <actor>, <director> --> <!-- <writer>, <producer>, <image-reference>, <video-reference> --> <!-- 6/8: renamed <genres> to <studio-genres>. added <amg-genres>. added <asset-type> --> <!-- 6/11: moved <amg-genres> under new <discovery> tag, removed <amg-did> tag from <studio-genres>, --> <!--collapsed <studio-genres><genre><description> to <studio-genres><genre> --> <!-- 6/22: renamed <studio-genres> to <genres>, restructured <discovery> block a bit, created discovery-type --> <!--renamed <mpaa-rating> to <rating> --> <!-- ============================================================================= --> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified"> <!-- ============================================================================= --> <!-- discovery type --> <!-- ============================================================================= --> <xs:complexType name="discovery-type"> <xs:sequence> <xs:element name="amg" minOccurs="0"> <xs:complexType> <xs:sequence> <xs:element name="genres" minOccurs="0"> <xs:complexType> <xs:sequence> <xs:element name="genre" minOccurs="0" maxOccurs="unbounded"> <xs:complexType> <xs:sequence> <xs:element name="description" type="xs:string"/> <xs:element name="amg-did" type="xs:string" minOccurs="0"/> </xs:sequence> </xs:complexType> and corresponding .xslt file is : (only relevant values i am giving) <discovery> <amg> <genres> <xsl:for-each select="amg-genres/genre"> <genre> <description><xsl:value-of select="name" /></description> <amg-did><xsl:value-of select="amg-did" /></amg-did> </genre> </xsl:for-each> </genres> </amg> </discovery> 2) The new one .xsd file is : <?xml version="1.0" encoding="UTF-8"?> <!-- ============================================================================= --> <!-- VMS to Vcommerce catalog schema --> <!-- v 6/22/2007 --> <!-- ============================================================================= --> <!-- Revision History --> <!-- 4/23: added minOccurs="0" to all second-level collection tags including <genre>, <actor>, <director> --> <!-- <writer>, <producer>, <image-reference>, <video-reference> --> <!-- 6/8: renamed <genres> to <studio-genres>. added <amg-genres>. added <asset-type> --> <!-- 6/11: moved <amg-genres> under new <discovery> tag, removed <amg-did> tag from <studio-genres>, --> <!--collapsed <studio-genres><genre><description> to <studio-genres><genre> --> <!-- 6/22: renamed <studio-genres> to <genres>, restructured <discovery> block a bit, created discovery-type --> <!--renamed <mpaa-rating> to <rating> --> <!-- ============================================================================= --> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified"> <!-- ============================================================================= --> <!-- discovery type --> <!-- ============================================================================= --> <xs:complexType name="discovery-type"> <xs:sequence> <xs:element name="amg" minOccurs="0"> <xs:complexType> <xs:sequence> <xs:element name="genric" minOccurs="0"> <xs:complexType> <xs:sequence> <xs:element name="genres" minOccurs="0"> <xs:complexType> <xs:sequence> <xs:element name="genre" minOccurs="0" maxOccurs="unbounded"> <xs:complexType> <xs:sequence> <xs:element name="description" type="xs:string"/> <xs:element name="amg-did" type="xs:string" minOccurs="0"/> </xs:sequence> and corresponding .xslt file is : (only relevant content is given) <discovery> <amg> <genric> <genres> <xsl:for-each select="amg-genres/genre"> <genre> <description><xsl:value-of select="name" /></description> <amg-did><xsl:value-of select="amg-did" /></amg-did> </genre> </xsl:for-each> </genres> </genric> </amg> </discovery> Note : there is only one tag changes in the .xsd file <genric> in between <amg> and <genres> , But at run time the validation fails against the Schema defined and in the output .xml file there is no <genric> tag included even though it has been included in the .xslt(new one) file. Please do the needfull Thanks In Advance Divya
|
 |
Rahul Bhattacharjee
Ranch Hand
Joined: Nov 29, 2005
Posts: 2300
|
|
|
Is it giving any other information other than "Validation against XML schema failed" ?
|
Rahul Bhattacharjee
LinkedIn - Blog
|
 |
divya chamarti
Ranch Hand
Joined: Jul 28, 2006
Posts: 56
|
|
Thanks Rahul for giving response to me but it is saying only that "Validation against XML Schema failed" information on the browser where we are tracking about the application , but on the server where we are running the application it's saying that : Validation against XML schema failed during publishing of phoenix movie catalog full ftp. Schema validation error: cvc-complex-type.2.4.a: Invalid content was found starting with element 'genres'. One of '{genric}' is expected.. : that means it is saying that genric tag is expected according to the Schema(.xsd) defined but after even applying the .xslt , it has been not added in the original xml file. so is there any thing else required in the .xslt file for genric tag should be included in the output xml file after .xslt applied over the original xml file? Awaiting your response Thanks [ July 23, 2007: Message edited by: divya chamarti ]
|
 |
 |
|
|
subject: Error -- > Validation against XML schema failed
|
|
|