function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

Error: Failed to parse wsdl: Unsupported Schema element found -- attribute.

According to the SF documentation attributes are supported  in when generating classes from wsdl schemas.    Anyone know attributes generate errors on

New Apex Code from WSDL


<xs:attribute name="name" type = "xs:string"/>




Hi Bruce,


Here, I understand that the schema contain definition of attribute that is not part of any object/element.


In a normal document layout schema, this would permitted in this form for the purposes of defining reusable element attributes (via ref).

As it is defined as attribute, the conversion to Apex attempts to assign this attribute to an object, but as it is not part of an object/class/element, it cannot be defined.

You can use one of two options:

1) Declare the attribute implicitly within the elements that require them. Then remove the xs:attribute  "name" from the schema level.

2) Define the attribute as data type (xs:simpleType). If the attribute (described in #1) was intended to be defined a data type, change its declaration to "xs:simplyType", and include a "xsd:restriction" item that uses the "type" property of the original "xs:attribute" definition.

This should allow you to import and create the class.


Hope this helps!

Saniya Khan 2Saniya Khan 2
Hi Bruce,
Have you got any solution for you problem?

Many thanks,