Hello, I am trying to generate source for a schema using the Ant task and
Castor v1.3.3-rc1 (I have also tried Castor v1.3.2).  The schema has an
Import, and I have told the ant task not to generate code for the import.
I also have a binding file that tries to link an element in a complex type
to an already generated class, but this does not seem to work.  Please find
below the scenario I am talking about

Schema I am generating for:

<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns="http://www.w3.org/2001/XMLSchema";
 xmlns:xsd="http://www.w3.org/2001/XMLSchema"; targetNamespace="
http://www.example.com/digit-service/digit-schema";
 xmlns:tns="http://www.example.com/digit-service/digit-schema";
 xmlns:app="http://www.example.com/appian-pas-data-model/ws";
 elementFormDefault="qualified">
 <xsd:import namespace="http://www.example.com/appian-pas-data-model/ws";
  schemaLocation="appian-policy-change.xsd" />
 <xsd:complexType name="SetupPolicyChangeResponse">
  <xsd:sequence>
   <xsd:element name="policyChangeRequest"
type="app:PASWS_PolicyChangeRequestType"
    minOccurs="1" maxOccurs="1" />
  </xsd:sequence>
 </xsd:complexType>
</xsd:schema>

Note that the schema appian-policy-change.xsd has already had code
generated for it that lives in a jar file on the class path

Binding file to tie the policyChangeRequest element to the generated
classes:
<binding xmlns="http://www.castor.org/SourceGenerator/Binding";
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
 defaultBindingType="type">
 <complexTypeBinding name="/complexType:SetupPolicyChangeResponse">
  <java-class name="SetupPolicyChangeResponse">
  </java-class>
  <elementBinding
   name="/complexType:SetupPolicyChangeResponse/policyChangeRequest">
   <member name="policyChangeRequest"
java-type="com.example.appian.bean.PolicyChangeRequest"/>
  </elementBinding>
 </complexTypeBinding>
</binding>

This does not generate what I would expect, as it creates a java class that
has a variable called "_policyChangeRequest" and its class is
com.example.digit.PolicyChangeRequest (which is not actually generated so
the code can not compile).  I guess the question I have is if
it is possible to run the generator and reference a class that has already
been generated, if so is my syntax wrong?

Thanks,


Matt Pontius
Senior Consulting Software Engineer
Blue Slate Solutions <http://www.blueslate.net/>
518.810.0402 W
518.926.0306 C
315.208.4041 H

Reply via email to