Expand my Community achievements bar.

SOLVED

Adaptive Form - XML Schema Validation Failure

Avatar

Level 4

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

1 Accepted Solution

Avatar

Correct answer by
Employee

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>

 

View solution in original post

3 Replies

Avatar

Correct answer by
Employee

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>

 

Avatar

Level 4

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.

Avatar

Employee

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