문제

I'm trying to compile an xmlbeans jar from an xsd. The xsd was provided to me from a vendor so I cannot change it. The name attribute "CON" is causing XML beans to throw an exception as follows: Exception in thread "main" org.apache.xmlbeans.SchemaTypeLoaderException....(The system cannot find the path specified). If I change the tag attribute to say "CON1", the problem resolves so it is definately something about the string CON that it does not like. Is there a work around for this. I include a simplified version of the schema that I've been using for test purposes as a reference:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="CON">
    <xs:complexType>
        <xs:choice minOccurs="1" maxOccurs="unbounded">
            <xs:element name="TEXT" type="TEXT" minOccurs="0"  
maxOccurs="1"/>
            <xs:element name="VALUE" minOccurs="1" maxOccurs="1">
                <xs:simpleType>
                    <xs:restriction base="xs:string">
                        <xs:minLength value="2"/>
                        <xs:maxLength value="4"/>
                    </xs:restriction>
                </xs:simpleType>
            </xs:element>
        </xs:choice>
    </xs:complexType>
</xs:element>
<xs:simpleType name="TEXT">
    <xs:restriction base="xs:string">
        <xs:minLength value="0"/>
        <xs:maxLength value="1023"/>
    </xs:restriction>
</xs:simpleType>    
</xs:schema>
도움이 되었습니까?

해결책

This is a known bug in XMLBeans: XMLBEANS-352

scomp tries to create a file ...\classes\schemaorg _apache_xmlbeans\javaname\noNamespace\CONDocument\CON\VALUE.xsb This fails. The directory name CON is forbidden since CON is a reserved device name on Windows machines.

Providing a .xsdconfig file that maps the element to another name does not work. I tried.

Compiling the schema in linux and copying the resulting jar reportedly is the only solution.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top