error: cannot find symbol when call JAXB class'

2019-03-05 04:04发布

I have an XSD schema with a mistake - in one method first symbol in utf-8 'с'

<xsd:attribute name="сreationDate" type="xsd:dateTime" use="required">

I generate Java classes from this XSD. But when I call this method in project for example:

quittanceType.setСreationDate(stringToXMLGregorianCalendar(new Date));

My project does not compile and I get error:

error: cannot find symbol

    quittanceType.setСreationDate(stringToXMLGregorianCalendar(paymentsToCharge.getCreationDateStr()));
                     ^
  symbol:   method setСreationDate(XMLGregorianCalendar)
  location: variable quittanceType of type QuittanceType

But on Macbook this project compiles successfully. What should I do? Everything seems to be normal encodings.

1条回答
爷、活的狠高调
2楼-- · 2019-03-05 04:34

You should better specify the Java property name using binding file.

<jaxb:bindings
    version="1.0"
    xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" 
    xmlns:xs="http://www.w3.org/2001/XMLSchema">

    <jaxb:bindings 
        schemaLocation=".../myschema.xsd" 
        node="/xs:schema">

        <jaxb:bindings node="xs:complexType[@name='SomeType']/xs:attribute[@name='сreationDate']">
            <jaxb:property name="creationDate"/>
        </jaxb:bindings>
    </jaxb:bindings>

</jaxb:bindings>

I'd also notified the schema authors - in case they would want to correct this.

查看更多
登录 后发表回答