3

I am trying to convert Component schema definition files int to C# class files using XSD.EXE for using Tridion core services. But when I create the XSD file in VS2011.Net using component schema i am getting below error.(Here i used to used .Net just create the XSD file with schema value)

The http://www.w3.org/2001/XMLSchema:Schema element is not supported in this context.

Here is my sample xsd file

     <?xml version="1.0" encoding="utf-8"?>
   <xs:schema id="AccessRoles"
    targetNamespace="http://tempuri.org/AccessRoles.xsd"
    elementFormDefault="qualified"
    xmlns="http://tempuri.org/AccessRoles.xsd"
    xmlns:mstns="http://tempuri.org/AccessRoles.xsd"
    xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xsd:schema xmlns:tcmi="http://www.tridion.com/ContentManager/5.0/Instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
    <xsd:import namespace="http://www.tridion.com/ContentManager/5.0/Instance"></xsd:import>
    <xsd:annotation>
      <xsd:appinfo>
        <tcm:Labels xmlns:tcm="http://www.tridion.com/ContentManager/5.0">
          <tcm:Label ElementName="group" Metadata="false">Group Name</tcm:Label>
        </tcm:Labels>
      </xsd:appinfo>
    </xsd:annotation>
    <xsd:complexType name="AccessRoles">
      <xsd:sequence>
        <xsd:element name="group" minOccurs="0" maxOccurs="unbounded" type="xsd:normalizedString">
          <xsd:annotation>
            <xsd:appinfo>
              <tcm:CustomURL xmlns:tcm="http://www.tridion.com/ContentManager/5.0">/ebpcustompages/security/content-security-assoc.asp?fieldreadonly=true&amp;fldValues=%fieldValue%&amp;pubID=%publicationURI%</tcm:CustomURL>
              <tcm:ExtensionXml xmlns:tcm="http://www.tridion.com/ContentManager/5.0"></tcm:ExtensionXml>
            </xsd:appinfo>
          </xsd:annotation>
        </xsd:element>
      </xsd:sequence>
    </xsd:complexType>
  </xsd:schema>
</xs:schema>

Could any one help what wrong i am doing. or Any other alternative to convert schema defition files to C# class files.

1
  • What are you trying to achieve exactly? As Dominic and Bjorn say, you don't need to generate any classes to read your components through the core service. Or are you trying to construct a strongly typed model based on the core service?
    – Quirijn
    Commented May 31, 2013 at 13:23

1 Answer 1

2

It looks like your sample XSD file is invalid; you're declaring a schema within a schema and my guess is that's what xsd.exe trips over. Now the more obvious question here would be why you are using XSD.EXE at all to connect to the core service; i've found that the easiest way to create a .Net application that talks to the core service is to just add a service reference to the URL of the core service on your development machine (http://yourtcmurl.com/webservices/CoreService2011.svc); Visual Studio will create all of the necessary proxy classes for you in that case...

1
  • Or, these days (since 2011SP1 ?), just use the client shipped by Tridion. Commented May 31, 2013 at 12:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.