I am trying to unmarshall an XML document into a JaxME generated object,
I believe I have the Java code correct.

Basically when I try and unmarshall the xml document I get an exception
-

Exception in thread "main" javax.xml.bind.UnmarshalException:
JM_EVENT_UNEXPECTED_CHILD_ELEMENT: Unexpected element:
'{http://exist-db.org/collection-config/1.0}index'
        at
org.apache.ws.jaxme.impl.JMUnmarshallerImpl.unmarshal(JMUnmarshallerImpl.java:97)
        at testjaxme.main(testjaxme.java:42)
Caused by:
org.xml.sax.SAXParseException: JM_EVENT_UNEXPECTED_CHILD_ELEMENT:
Unexpected element: '{http://exist-db.org/collection-config/1.0}index'

However if I change my XML (see below) so that <index> becomes <index
xmlns=""> then I dont get any exceptions, but I dont understand why I
should need to define a xmlns on the index element, nor do I want to!

What am I doing wrong?



XML
===
<?xml version="1.0" encoding="UTF-8"?>
<collection xmlns="http://exist-db.org/collection-config/1.0";>
    <index>
        <fulltext default="all" attributes="false" alphanum="false">
            <include path="/category/@name"/>
        </fulltext>
    </index>
</collection>


XML Schema
==========
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema  xmlns="http://exist-db.org/collection-config/1.0";
targetNamespace="http://exist-db.org/collection-config/1.0";
elementFormDefault="qualified" xml:lang="en" version="1.0"
xmlns:xs="http://www.w3.org/2001/XMLSchema";>
    <xs:element name="collection">
        <xs:complexType>
            <xs:sequence>
                <xs:element name="index">
                    <xs:complexType>
                        <xs:sequence>
                            <xs:element name="fulltext">
                                <xs:complexType>
                                    <xs:sequence>
                                        <xs:element name="exclude"
minOccurs="0" maxOccurs="unbounded">
                                            <xs:complexType>
                                                <xs:attribute
name="path" type="xs:string" use="required"/>    
                                            </xs:complexType>
                                        </xs:element>
                                        <xs:element name="include"
minOccurs="0" maxOccurs="unbounded">
                                            <xs:complexType>
                                                <xs:attribute
name="path" type="xs:string" use="required"/>
                                            </xs:complexType>
                                        </xs:element>
                                    </xs:sequence>
                                    <xs:attribute name="default"
use="required">
                                        <xs:simpleType>
                                            <xs:restriction
base="xs:string">
                                                <xs:enumeration
value="all"/>
                                                <xs:enumeration
value="none"/>
                                            </xs:restriction>
                                        </xs:simpleType>
                                    </xs:attribute>
                                    <xs:attribute name="attributes"
type="xs:boolean" use="required"/>
                                    <xs:attribute name="alphanum"
type="xs:boolean" use="required"/>
                                </xs:complexType>
                            </xs:element>
                            <xs:element name="create" minOccurs="0"
maxOccurs="unbounded">
                                <xs:complexType>
                                    <xs:attribute name="path"
type="xs:string" use="required"/>
                                    <xs:attribute name="type"
type="xs:string" use="required"/>
                                </xs:complexType>
                            </xs:element>
                        </xs:sequence>
                    </xs:complexType>
                </xs:element>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
</xs:schema>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to