Adaptive Form - XML Schema Validation Failure | Community
Skip to main content
New Participant
December 6, 2021
Solved

Adaptive Form - XML Schema Validation Failure

  • December 6, 2021
  • 1 reply
  • 1461 views

Hello,

 

I have created an XML Schema Definition (XSD) and there are no issues with creating the data connection in the Designer XDP. I am able to properly bind the fields in the XDP.

 

When creating an adaptive form in AEM and selecting the Schema, it states there is an error: "XML Schema Validation Failure - An error occurred while parsing SCHEMA. Ensure that you have selected a valid SCHEMA.".

 

Below is the XSD file:

<?xml version="1.0" encoding="UTF-8" ?> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xhtml="http://www.w3.org/1999/xhtml"> <xsd:import namespace="http://www.w3.org/1999/xhtml"/> <xsd:element name="formData"> <xsd:complexType> <xsd:sequence> <xsd:element name="headerInfo"> <xsd:complexType> <xsd:sequence> <xsd:element name="field1" /> <xsd:element name="field2" /> </xsd:sequence> </xsd:complexType> </xsd:element> <xsd:element name="bodyInfo"> <xsd:complexType> <xsd:sequence> <xsd:element name="field3"> <xsd:complexType> <xsd:sequence> <xsd:element ref="xhtml:body" /> </xsd:sequence> </xsd:complexType> </xsd:element> </xsd:sequence> </xsd:complexType> </xsd:element> </xsd:sequence> </xsd:complexType> </xsd:element> </xsd:schema>

 

I was under the assumption that any XSD supported in Designer is supported in AEM as well. Any insight on why this is occurring is appreciated. Thank you

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Mayank_Tiwari

There are missing properties in your XSD. Make sure your XSD follows the following sample XSD's structure:

 

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  
   <xsd:element name="Work" type="workType"/> 
      <xsd:complexType name="workType">
       <xsd:sequence>
    	   <xsd:element name="FreelanceContract"	type="FreelanceContractInfo"/>
    	    </xsd:sequence>
      </xsd:complexType>
    <xsd:complexType name="FreelanceContractInfo">
       <xsd:sequence>
           <xsd:element name="RequestFor"	 		type="xsd:string"/>
           <xsd:element name="FileNames"			type="xsd:string"/>
           <xsd:element name="Software"				type="xsd:string"/>
           <xsd:element name="ReferenceNames"		        type="xsd:string"/>
           <xsd:element name="Rate"				type="xsd:string"/>
           <xsd:element name="RateType"				type="xsd:string"/>
           <xsd:element name="ReviserName"			type="xsd:string"/>
           <xsd:element name="ReviserPhoneNumber"	        type="xsd:string"/> 			
        </xsd:sequence>
   </xsd:complexType>
  
</xsd:schema>

 

1 reply

Mayank_Tiwari
Mayank_TiwariAccepted solution
Employee
December 7, 2021

There are missing properties in your XSD. Make sure your XSD follows the following sample XSD's structure:

 

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  
   <xsd:element name="Work" type="workType"/> 
      <xsd:complexType name="workType">
       <xsd:sequence>
    	   <xsd:element name="FreelanceContract"	type="FreelanceContractInfo"/>
    	    </xsd:sequence>
      </xsd:complexType>
    <xsd:complexType name="FreelanceContractInfo">
       <xsd:sequence>
           <xsd:element name="RequestFor"	 		type="xsd:string"/>
           <xsd:element name="FileNames"			type="xsd:string"/>
           <xsd:element name="Software"				type="xsd:string"/>
           <xsd:element name="ReferenceNames"		        type="xsd:string"/>
           <xsd:element name="Rate"				type="xsd:string"/>
           <xsd:element name="RateType"				type="xsd:string"/>
           <xsd:element name="ReviserName"			type="xsd:string"/>
           <xsd:element name="ReviserPhoneNumber"	        type="xsd:string"/> 			
        </xsd:sequence>
   </xsd:complexType>
  
</xsd:schema>

 

techddxAuthor
New Participant
December 7, 2021

Hi @mayank_tiwari, thank you for the reply.

 

Your provided XML Schema works. However, I found it no longer works when I add the xhtml namespace.

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xhtml="http://www.w3.org/1999/xhtml">
<xs:import namespace="http://www.w3.org/1999/xhtml"/> 
    <xs:element name="Work" type="workType"/>
    <xs:complexType name="workType">
        <xs:sequence>
            <xs:element name="FreelanceContract" type="FreelanceContractInfo"/>
        </xs:sequence>
    </xs:complexType>
    <xs:complexType name="FreelanceContractInfo">
        <xs:sequence>
            <xs:element name="RequestFor" type="xs:string"/>
            <xs:element name="FileNames" type="xs:string"/>
            <xs:element name="Software" type="xs:string"/>
            <xs:element name="ReferenceNames" type="xs:string"/>
            <xs:element name="Rate" type="xs:string"/>
            <xs:element name="RateType" type="xs:string"/>
            <xs:element name="ReviserName" type="xs:string"/>
            <xs:element name="ReviserPhoneNumber" type="xs:string"/>
        </xs:sequence>
    </xs:complexType>

</xs:schema>

Is AEM not able to parse the XML schema when there is a namespace included? The reason I need xhtml is because I have rich text fields in the adaptive form and need the output service to generate the PDF from XDP.

Mayank_Tiwari
Employee
December 8, 2021

Seems like this is not yet supported, as there is no mention of this in the public documentation.