0

I've got a set of XSD schema files I'm generating Java classes from:

http://xmlgw.companieshouse.gov.uk/v1-0/schema/Egov_ch.xsd

http://xmlgw.companieshouse.gov.uk/v1-0/schema/forms/ReturnofAllotmentShares-v3-0.xsd

http://xmlgw.companieshouse.gov.uk/v1-0/schema/forms/FormSubmission-v2-11.xsd

These come together to form a single XML document I need to submit to the Companies House XML Gateway. Right now, the XML files generated from the Java files generated by xjc from these schemas do not include schemaLocation or other schema-related information. By following this answer I'm able to add a top-level schemaLocation to the <GovTalkMessage> element, but not to the others (e.g. <FormSubmission> and <ReturnofAllotmentShares>.

Is there a way I can do this, or to set it at Java-class generation time?

EDIT: Error returned when I remove one of the schemaLocation attributes (if I include it, it returns successfully)

<GovTalkErrors>
    <Error>
        <RaisedBy>CH_XML_Gateway</RaisedBy>
        <Number>100</Number>
        <Type>fatal</Type>
        <Text>XML failed schema validation: Invalid XML: Unknown element 'ReturnofAllotmentShares'  line 36 column 86</Text>
        <Location></Location>
    </Error>
</GovTalkErrors>

My understanding is that without the schemaLocation attribute, the parser doesn't know what specific document we're referring to here. Each document (maybe 20 of them) is it's own XML schema.

Rowan Marshall
  • 141
  • 1
  • 5

0 Answers0