Validation Framework & xsd:include

I'm having some problems using the new Validation Framework with schemas that have <xsd:include> dependancies.
Assume this schema (TestSchema.xsd):
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
     <xsd:include schemaLocation="TestInclude.xsd"/>
     <xsd:element name="RootElement">
          <xsd:complexType>
               <xsd:sequence>
                    <xsd:element name="SubElement1" type="xsd:string"></xsd:element>
                    <xsd:element name="SubElement2" type="xsd:string"></xsd:element>
                    <xsd:element ref="IncludedElement"/>
               </xsd:sequence>
          </xsd:complexType>
     </xsd:element>
</xsd:schema>...Which relies on this dependancy (TestInclude.xsd)
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
     <xsd:element name="IncludedElement" type="xsd:string"></xsd:element>
</xsd:schema>And a simple document based on this Schema (TestDoc.xml)
<?xml version="1.0" encoding="UTF-8"?>
<RootElement>
  <SubElement1>Hello</SubElement1>
  <SubElement2>World</SubElement2>
  <IncludedElement>Include me too!</IncludedElement>
</RootElement>My validation code looks like this:
public class ValidatorTest
     public ValidatorTest()
          SchemaFactory factory = SchemaFactory.newInstance(
                    XMLConstants.W3C_XML_SCHEMA_NS_URI);
          StreamSource source = new StreamSource(
                    getClass().getResourceAsStream("/TestSchema.xsd"));
          StreamSource includeSource = new StreamSource(
                    getClass().getResourceAsStream("/TestInclude.xsd"));
          Schema schema;
          try
//By the javadocs, this is the proper way of compiling schemas w/ dependancies
                    schema = factory.newSchema(new StreamSource[]{includeSource,source});
                    System.out.println("Schema compiled.");
                    Validator v = schema.newValidator();
                    StreamSource document = new StreamSource(getClass().getResourceAsStream("/TestDoc.xml"));
                    v.validate(document);
                    System.out.println("Document validated.");
               catch(Exception ex)
                    ex.printStackTrace();
     }This schema compiles correctly (I see my first log message). But an exception occurs when I call v.validate(document).
Cannot find the declaration of element 'RootElement'.
I should also point out that this code works when I test against an xsd that doesn't have an external dependancy.
Any advice?

Sigh
Looks like this is a bug.
Sigh

Similar Messages

  • Integrate struts validator framework

    (JHeadstart 9.0.4: Toplink/JSP/Struts)
    I am trying to integrate the struts validator framework . I'm encountering the following
    problem. When a validation rule(defined in the struts validation.xml) is violated I would expect
    that the JSP include named jhsInfo.jsp would show the errormessage because I assumed that it also
    reads from the same Error Bean (ActionErrors object ) struts normally uses.
    When I include a jsp of my own, containing the following:
    <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
    <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
    <%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
    <html:errors/>
    then messages raised by the struts validation framework are shown and everything seems to work.
    I have the following questions:
    - Is it possible to show struts validation error messages using the jhsInfo.jsp ?
    I investigated the <jhs:ifContainsError> in the JHeadstart Taglibrary
    and noticed how it checks for the JHS_USER_INFO session attribute; apparently, when the validate()
    method in JhsDynaActionForm finds ActionErrors through the Struts Validator framework, this session attribute is not set.
    However, even if we add this attribute explicitly to sessionData in validate(), we do not get the Struts Validator Action Errors.
    - If not possible, how could we adapt the code to make it work? Should we instantiate JHeadstart UserExceptions
    for all ActionErrors or does JHeadstart have built-in functionality to deal with these ActionErrors in the proper way?
    Are we running into a bug, is it intentional to keep Struts Validator Error separate from JHeadstart Exception Errors
    or is JHeadstart currently not equipped with the logic to deal with the ActionErrors?
    Thanks in advance,
    Rob Brands (Amis)

    Rob,
    JHeadstart transforms UserExceptions (controller-independent) to Struts specific ActionErrors and ActionMessages in JhsRequestprocessor.convertUserExceptions.
    So, with JHeadstart you can either use ACtionErrors/ActionMessages directly, or indirectly by thrwoing UserExceptions.
    In jhsInfo we use html:messages to loop over both messages and errors (The boolean attribute message determines whether ActionErrors or ActionMessages are iterated). We do not use html:errors because that does not provide you with control over the layout of individual messages.
    You are right that our custom tags ifContainsError and ifContainsInformation should also directly check for existence of ActionErrors and ActionMessages. We will fix that for the upcoming release.
    With that fix in place, you should be able to use jhsInfo.jsp to display validator messages.
    You mentioned you tried to put a "dummy" JHS_USER_INFO exception on the session in the validate() method. This approach should work, however, to display ActionErrors (as is the case with the validator framework), you should use JHS_USER_ERROR as the key, noy JHS_USER_INFO.
    For now, you could choose to modify jhsInfo.jsp and use your own ifContains tags, until we have fixed this.
    Steven Davelaar.

  • Struts validation framework not working

    Hi
    I created a very simple webapp and using struts validation framework. But, it always give me validation errors even i filled out all the required firled information. i have my struts-config included the plug-in, points to the location of validation.xml & validation-rule.xml, and i have the validate set to true, and an input point to the page when validation fails, plus my formbean to extend the validatorForm. But, no matter what, it always pass the validation. in other words, the validate method in the validator always returns 0 errors. Any ideas what might be wrong? or any suggestions of how i can debug it?
    Thanks a lot.
    cc

    There is an bug in Sun One App Server
    U need to add permission for delete in the server policy file
    please refer to
    http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4803631

  • Dyna Form +Validator Framework--- peculair problem with java.lang.Integer

    In my struts application , i m using Dyna Action form,and Validator framework
    <form-bean
    name="myDynaForm"
    type="org.apache.struts.validator.DynaValidatorForm">
    <form-property name="name" type="java.lang.String"/>
    <form-property name="phoneNo" type="java.lang.Integer"/>
    </form-bean>
    Now if user does not enter name , then a error meassage is dispalyed,
    and aslo this time phoneNo shows 0.
    why 0 is displayed here?
    Can anybody tell me

    Hi all,
    If my memory serves me well, the exception is thrown because the application needs a working calendar for a person provided in time mangement. Make sure the correct infotypes are used. Also the organization structure needs to be set up correctly. The manager needs someone to approve and the employee needs someone to get approved by.
    Regards, Marcel.

  • XML validation against XSD

    Hi,
    Does Oracle 8i (Release 3) support XML validations against XSD? I know Oracle 9i (Release 2) supports XML validations against XSD.
    Also, Does Oracle support XML validations against XDR?
    Any info is appreciated.
    Thanks
    Pavan

    Validate with DOMParser or the SAXParser.

  • Client side validation in struts using validation framework

    Hi ,
    am new to struts.....
    I want to validate a simple login page using struts validation framework...
    For that i created,
    login.jsp ( contains html:errors and html:javascript and onsubmit)
    LoginForm extends ValidatorForm
    LoginAction
    resource bundles
    validation.xml ( required, minlength and maxlength rules for both fields)
    struts-config.xml ( configured action mapping and form beans)
    whats my problem is....
    i will get error messages through server side validation...
    i cant able to get the error messages using javascript i.e alert messages.
    i seen the page resource in that all javascript functins are inserted.
    on seeing the javascript error console... it shows
    formName has no properties...............
    exactly at this line
    oRequired = eval('new ' + formName.value + '_required()'); //function validateRequired(form)

    Thanks for your valuable reply.....
    Ya of course what you said was correct....
    I got error messages while submitting the form without any value....
    error messages are displayed using the <html:errors/> tag (server side validation ).
    But it fails to show the alert messages for those errors ( client side validation).
    i inserted the <html:javascript formName="form bean name" /> tag in the bottom of my login jsp.....
    on seeing the error console, it shows formName has no properties.
    Could anybody help me to sort out this problem........

  • Ant autotype does not seem to recognize xsd:include

    Hi
    I am currently using WebLogic 7.0. I was trying to use ant autotype to generate
    java classes based on a schema. I ran into a problem that the autotype does not
    seem to include the other schema files listed with xsd:include. I could only get
    around the problem by literally copy and paste the complex types definition into
    the calling schema file. Below are the two schemas that illustrate the problem.
    x.xsd includes y.xsd but however the EmployeeBean listed in y.xsd results in a
    unresolve type with autotype. Problem only goes away if EmployeeBean definition
    is listed in x.xsd.
    Any help is much appreciated.
    ==========================================================
    x.xsd
    ==========================================================
    <?xml version="1.0" encoding="utf-8" standalone="no"?>
    <xsd:schema xmlns:ofx="http://ofx.net/v3.0"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    targetNamespace="http://ofx.net/v3.0">
    <xsd:include schemaLocation="y.xsd" />
    <xsd:complexType name="Company">
    <xsd:sequence>
    <xsd:element name="XYZ" type="ofx:EmployeeBean" />
    </xsd:sequence>
    </xsd:complexType>
    </xsd:schema>
    ==========================================================
    y.xsd
    ==========================================================
    <?xml version="1.0" encoding="utf-8" standalone="no"?>
    <xsd:schema targetNamespace="http://ofx.net/v3.0"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:ofx="http://ofx.net/v3.0">
    <xsd:complexType name="EmployeeBean">
         <xsd:sequence>
         <xsd:element name="name"
              type="xsd:string"
              nillable="true"
              minOccurs="1"
              maxOccurs="1">
         </xsd:element>
         <xsd:element name="id"
              type="xsd:int"
              minOccurs="1"
              maxOccurs="1">
         </xsd:element>
         </xsd:sequence>
    </xsd:complexType>
    </xsd:schema>
    =============================================================

    Actually imports will work in most cases, though some bug fixes have
    been made since and will show up in future releases.
    --Scott
    In article <[email protected]>,
    Bruce Stephens <[email protected]> wrote:
    Hello,
    At the moment, we handle wsdl imports as done by SOAPBuilders Round
    3, but not schema imports. Look for this in the upcoming release;
    Contact Michael Bamford ([email protected]) if you would like
    to be on the Beta.
    Thanks,
    Bruce
    Sooleng Lau wrote:
    Thank you for the response and info. What about schema import, is
    it handled by weblogic 7.0 at the moment ? What is the upcoming
    release, is it WebLogic 7.1 ?
    Thank you.
    Soo Leng
    Bruce Stephens <[email protected]> wrote:
    Hello,
    Schema include is a known problem that will be corrected in the upcoming
    release.
    The workaround at this point is the cut and paste :-( you described.
    Bruce
    Sooleng Lau wrote:
    Hi
    I am currently using WebLogic 7.0. I was trying to use ant autotypeto generate
    java classes based on a schema. I ran into a problem that the autotypedoes not
    seem to include the other schema files listed with xsd:include. I couldonly get
    around the problem by literally copy and paste the complex types definitioninto
    the calling schema file. Below are the two schemas that illustratethe problem.
    x.xsd includes y.xsd but however the EmployeeBean listed in y.xsd resultsin a
    unresolve type with autotype. Problem only goes away if EmployeeBeandefinition
    is listed in x.xsd.
    Any help is much appreciated.
    ==========================================================
    x.xsd
    ==========================================================
    <?xml version="1.0" encoding="utf-8" standalone="no"?>
    <xsd:schema xmlns:ofx="http://ofx.net/v3.0"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    targetNamespace="http://ofx.net/v3.0">
    <xsd:include schemaLocation="y.xsd" />
    <xsd:complexType name="Company">
    <xsd:sequence>
    <xsd:element name="XYZ" type="ofx:EmployeeBean" />
    </xsd:sequence>
    </xsd:complexType>
    </xsd:schema>
    ==========================================================
    y.xsd
    ==========================================================
    <?xml version="1.0" encoding="utf-8" standalone="no"?>
    <xsd:schema targetNamespace="http://ofx.net/v3.0"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:ofx="http://ofx.net/v3.0">
    <xsd:complexType name="EmployeeBean">
    <xsd:sequence>
    <xsd:element name="name"
    type="xsd:string"
    nillable="true"
    minOccurs="1"
    maxOccurs="1">
    </xsd:element>
    <xsd:element name="id"
    type="xsd:int"
    minOccurs="1"
    maxOccurs="1">
    </xsd:element>
    </xsd:sequence>
    </xsd:complexType>
    </xsd:schema>
    =============================================================

  • Autotype support for xsd import and xsd include statement

    Hi,
    I am using Weblogic 7.0.1. While using autotype for a Schema, I get the error unable to resolve element ref: "qb:WireCenterCLLI. This element exists in an xsd imported in the main XSD which in turn includes a few XSD's. I saw few posts which indicated there were issues with autotype recognising xsd:import and xsd:include statements. Were these issues fixed? If so, what SP were they fixed in?
    My XSD:
    <?xml version = "1.0" encoding = "UTF-8"?>
    <xsd:schema xmlns = "http://www.qwest.com/XMLSchema"
    targetNamespace = "http://www.qwest.com/XMLSchema"
    xmlns:qb = "http://www.qwest.com/XMLSchema/BIM"
    xmlns:xsd = "http://www.w3.org/2001/XMLSchema"
    elementFormDefault = "qualified">
    <xsd:import namespace = "http://www.qwest.com/XMLSchema/BIM" schemaLocation = "/u/skarani/sia_code/xsd/ProjectSpecific/SIA/BIM/AddressValidationInclude_v01_00.xsd"/>
    <xsd:include schemaLocation = "/u/skarani/sia_code/xsd/ProjectSpecific/SIA/Common/AddressValidationCommon_v01_00.xsd"/>
    <xsd:include schemaLocation = "/u/skarani/sia_code/xsd/ProjectSpecific/SIA/Common/RequestMessage_v02_01.xsd"/>
    <xsd:element name = "AddressValidationByServiceIdRequest">
    <xsd:complexType>
    <xsd:complexContent>
    <xsd:extension base = "WebServiceRequestT">
    <xsd:sequence>
    <xsd:element name = "InputData" type = "AddressValidationByServiceIdInputDataT">
    </xsd:element>
    </xsd:sequence>
    </xsd:extension>
    </xsd:complexContent>
    </xsd:complexType>
    </xsd:element>
    <xsd:complexType name = "AddressValidationByServiceIdInputDataT">
    <xsd:sequence>
    <xsd:element ref = "qb:WireCenterCLLI" minOccurs = "0"/>
    <xsd:element ref = "qb:WireCenterPrimaryNPANXX" minOccurs = "0"/>
    <xsd:element ref = "AdministrativeArea" minOccurs = "0"/>
    <xsd:element ref = "qb:PostalCode" minOccurs = "0"/>
    <xsd:element ref = "qb:BTN"/>
    <xsd:element name = "ParsedAddressFlag" type = "xsd:boolean" minOccurs = "0">
    </xsd:element>
    <xsd:element ref = "qb:CCNA" minOccurs = "0"/>
    <xsd:element name = "CompanyCode" type = "xsd:string" minOccurs = "0">
    </xsd:element>
    <xsd:element ref = "AssignedHouseNumberFlag" minOccurs = "0"/>
    <xsd:element ref = "GSGRqmtFlag" minOccurs = "0"/>
    <xsd:element ref = "TNStatus" minOccurs = "0"/>
    </xsd:sequence>
    </xsd:complexType>
    </xsd:schema>
    Thanks
    Shekhar

    Hmmmm.... No answers!!!
    Has anyone had success using autotype with an xsd having include and import statements???
    Thanks
    Shekhar

  • External definitions: is xsd:include schemaLocation="..."/ allowed?

    Hi everybody,
    I guess to remember I read that <xsd:include> is not allowed. Do you have some information?
    Regards Mario

    http://help.sap.com/bp_bpmv130/Documentation/Operation/MappingXI30.pdf - ref page 33.

  • Validating framework

    HI
    can we we use server side validation framework in struts and validate() method in form.
    I used both but only server side validate framework works.
    can u suggest how to use vaildate method also.
    here is the code what i have done
    register.jsp
         <body>
              <html:form action="regs.do" method="post">          
              <bean:message key="user" />
                   <html:text property="userid" />
                   <html:errors property="userid" />
                   <br>
                   <bean:message key="pass" />
                   <html:password property="password" />
                   <html:errors property="password" />
                   <br>
                   <html:submit value="Submit" />
              </html:form>
         </body>
    </html>
    struts-config.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN" "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">
    <struts-config>
    <data-sources />
    <form-beans>
         <form-bean name="regForm" type="com.forms.RegistrationForm" />
    </form-beans>
    <global-exceptions />
    <global-forwards>
         <forward name="start" path="/register.jsp" />
    </global-forwards>
    <action-mappings>
         <action path="/regs" type="com.actions.RegistrationAction" name="regForm" scope="request" validate="true" input="/register.jsp">
              <forward name="success" path="/success.jsp" />
              <forward name="failure" path="/failure.jsp" />
         </action>
    </action-mappings>
    <message-resources parameter="com.yourcompany.struts.ApplicationResources" />
    <!-- validator framework plugin -->
         <plug-in className="org.apache.struts.validator.ValidatorPlugIn">
         <set-property property="pathnames" value="/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml" />
         </plug-in>     
    </struts-config>
    ApplicationResources.properties
    errors.required={0} is required as said rama.
    RegistrationForm .java
    package com.forms;
    import javax.servlet.http.HttpServletRequest;
    import org.apache.struts.action.ActionError;
    import org.apache.struts.action.ActionErrors;
    import org.apache.struts.action.ActionMapping;
    import org.apache.struts.validator.ValidatorForm;
    public class RegistrationForm extends ValidatorForm {     
         protected String userid;
         protected String password;
         public String getPassword() {
              return password;
         public void setPassword(String password) {
              this.password = password;
         public String getUserid() {
              return userid;
         public void setUserid(String userid) {
              this.userid = userid;
         public ActionErrors validate(ActionMapping map,HttpServletRequest req){
              ActionErrors errors=new ActionErrors();
              if(this.password==null ||this.password == "" ||this.userid==null ||this.userid== ""){
                   errors.add("userid",new ActionError("this is rama"));
              return errors;
    validation.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE form-validation PUBLIC
    "-//Apache Software Foundation//DTD Commons Validator Rules Configuration 1.0//EN"
    "http://jakarta.apache.org/commons/dtds/validator_1_0.dtd">
    <form-validation>
         <formset>
              <form name="regForm">
                   <field property="userid" depends="required">
                        <arg0 key="some.userid"/>
                   </field>
                   <field property="password" depends="required">
                        <arg0 key="some.password"/>
                   </field>          
              </form>
         </formset>
    </form-validation>

    I think you could still use the validator form.
    You say you have 10 fields on your form, up to 3 of which are visible?
    Its a bit of a hack, but what it would require is 10 hidden fields on the page. One for each of the controls. The hidden field value would be set if the control was meant to be present, and empty if not.
    That way the validWhen syntax only has to deal with two fields
    1 - a hidden field indicating whether or not to validate
    2 - the field to validate itself.
    You just have to set the values of the hidden fields according to which controls you are showing/hiding.
    An alternative:
    Use ValidatorActionForm rather than just ValidatorForm.
    ValidatorActionForm fires on a specific "action" rather than a specific "form"
    ie it uses the name of the action to choose which validation to run rather than the name of the form
    You would then have to define seperate ACTIONS in struts-config for each of the variations of the page, and validation for each action, but you would still only have one jsp page and one Action class as they could all be the same.
    Cheers,
    evnafets

  • Java Validation Framework

    Hi,
    Is there any Validation Framework avail for validating a Form,i am expecting this framework will be a plugin,so i can change the validation at any time,without building the application everytime, so we can configure different validations for different projects, without changing the build.
    I searched the net & find out Rule Engine ( Ex: Drools ) can do this, is there any other framework available..?
    Thx.

    There is the general Java validation JSR, of which [Hibernate Validator|http://www.hibernate.org/subprojects/validator.html] is a populate implementation. Your actual MVC framework also undoubtedly has a validator API.
    - Saish

  • Custom Binding + xsd:include

    Here's the problem...
    I have 2 xsd: A and B.
    A includes B.
    But I want the classes (from JAXB) to be generated in different packages (packageA and packageB).
    Because of the xsd:include (in A), XJC tries to generate the classes for A and B in the same package (A's package). I wan't to force XJC to create the JAXB classes in different packages, no matter if there's a include or not!
    Note: Both xsd use the default namespace (xsd), should I use different namespaces?
    Could anyone help me out? It's a bit urgent...
    Thanks A LOT !!!!
    Paulo

    Problem solved. (by the way, thanks for nothing)
    For the ones who may face the same problem:
    1) use xsd:import instead of xsd:include
    2) rethink the use of namespaces in your design (XSDs with the same namespace cannot go to different packages when you use JAXB, as far as I investigated)
    Regards,
    Paulo

  • XML Validation with XSD in java mapping

    Hi experts,
    I have created an interface to send differents messages between bussines system, the bussiness system receiver is put in the message, to get this value I have a configuration file indicating the path of this field for each message type. In a java mapping I transform the message sent in this structure:
    <document>
    <message>HERE THE MESSAGE AS STRING</message>
    <parameters>
    <sender>HERE SENDER BUSSINESS SYSTEM</sender>
    <receiver>HERE RECEIVER BUSSINESS SYSTEM</receiver>
    </parameters>
    </document>
    the messaging interface works fine, but now I have to validate the XML vs XSD. I need doing in a java mapping because the messaging interface send the message and a email to sender in error case.
    To do this validation I have implemented two java mappings that works fine in my local, the first way is with class Validator of java 5, but my system PI 7.1 return an error with this class. The second way is with SAX parse:
    String schema = "XXXXXxsd";
    DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
    docBuilderFactory.setNamespaceAware(true);
    docBuilderFactory.setValidating(true);
    docBuilderFactory.setAttribute("http://java.sun.com/xml/jaxp/properties/schemaLanguage","http://www.w3.org/2001/XMLSchema");
    InputStream is = this.getClass().getClassLoader().getResourceAsStream(schema);
    docBuilderFactory.setAttribute("http://java.sun.com/xml/jaxp/properties/schemaSource",is);
    in my local works fine but in PI always return OK never fail.
    For this moment the schema is hardcoded to do proofs, in the future will be loaded from my configuration file.
    Any idea?
    Thanks in advance
    Jose

    hi Jose,
    PI 7.1 has a built in feature available called XML vaidations ..
    your source xml can be validated against a XSD placed at a specific location on the PI server..
    validation can be performed at adapter/integration engine
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/d06dff94-9913-2b10-6f82-9717d9f83df1?quicklink=index&overridelayout=true

  • Using XSL on XML validated against XSD

    Transforming XSD validated XMLType Data
    Re: example XSL in Chapter 6 that transforms XML with associated XSD schema definition (Oracle 9i XML Database Developer's Guide)
    I noted that this XSL uses only the "general" node identification functions (e.g., name() ) to access nodes in the <xsl:value-of select..>. I have also noted that standard XSL templates from other sections of the documentation, for example in Chapter 3 and in Appendix D, do not work with an XML which is validated against an XSD schema.
    Can anyone give me an example <xsl:value-of select..> that addresses a specific node in the "purchase order" example, like the shipTo, name, street -- or any other specific node. This is critical since there is always bound to be node-specific processing in any transformation, and this is not demonstrated by any example of XML which has been validated against an XSD.
    I have tried this endlessly on my own examples of XML w/XSD validation. Even if the value-of select="name(.)" tells you that the name of the node is "FooBar", you cannot use FooBar as a select test to do FooBar specific processing.
    Help?????

    Not quite understand your question. Can you send me the example doc?

  • Reusing JAXB generated classes for XSDs included in other XSDs

    Hi,
    I use xsds with jaxb in a number of related projects. To avoid duplication I've factored out commonly used elements into their own xsd in a separate project. I then include these in the xsds that need them.
    I generate classes with jaxb for each project. I'm now trying to get jaxb so far as to reuse the already generated classes for the common elements.
    For example: I have a general xsd Person.xsd for which I generate classes in common.xsd. I have another xsd Project.xsd that includes a reference to the Person element. When i let jaxb generate classes for Projects.xsd, it will also generate a project.xsd.PersonType and so on.
    Is there any way to tell JAXB to use the existing classes? I've played around with the <jxb:javaType> bindings, but I can't get it to work yet. It gives me a "bindings not used" warning and doesn't compile. Also, if this is in fact the way to go, what do I specify as the parseMethod and printMethod attributes for the javaType element?
    Thx for any help

    JAXB questions should be better directed to the users list of http://jaxb.dev.java.net/
    you should subscribe to the 'users' mailing list, then post a question there.
    Thank you!

Maybe you are looking for