You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jaxme-dev@ws.apache.org by giangnn <gi...@yahoo.com> on 2008/01/18 10:32:41 UTC

JM_EVENT_UNEXPECTED_CHILD_ELEMENT: Unexpected element

Hello,

I'm new to Jaxme. I'm trying the following example:

XSD content

<?xml version="1.0"?>

<schema xmlns = "http://www.w3.org/2001/XMLSchema"
        xmlns:exp="http://example.org/sample/"
        targetNamespace="http://example.org/sample/"
        elementFormDefault="qualified">

   <complexType name="Address">
      <sequence>
         <element name="name" type="string"/>
         <element name="doorNumber" type="short"/>
         <element name="street" type="string"/>
         <element name="city" type="string"/>
      </sequence>
   </complexType>


  <complexType name="USAddress">
    <complexContent>
     <extension base="exp:Address">
       <sequence>
          <element name="state" type="string"/>
       </sequence>
     </extension>
    </complexContent>
  </complexType>

  <element name="myAddress" type="exp:Address"/>

</schema>

XML content:
<?xml version="1.0"?>
<myAddress xmlns = "http://example.org/sample/"
           xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation = "http://example.org/sample sample.xsd"
		   xmlns:exp="http://example.org/sample/"
		   xsi:type="exp:USAddress">
    <name>James Bond</name>
    <doorNumber>123</doorNumber>
    <street>XYZ street</street>
    <city>ABC</city>
    <state>CA</state>
</myAddress>

The compiler can generate source files, but at runtime, I got
JM_EVENT_UNEXPECTED_CHILD_ELEMENT: Unexpected element:
'{http://example.org/sample/}state'.

My intention is that I purposely require the supertype (Address) in XSD file
but specify subtype (USAddress) in XML file. Is there something wrong with
Jaxme in this case, or is it unacceptable to have such XML?

Thanks in advance
-- 
View this message in context: http://www.nabble.com/JM_EVENT_UNEXPECTED_CHILD_ELEMENT%3A-Unexpected-element-tp14948037p14948037.html
Sent from the JaxMe - Dev mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: jaxme-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: jaxme-dev-help@ws.apache.org


Re: JM_EVENT_UNEXPECTED_CHILD_ELEMENT: Unexpected element

Posted by giangnn <gi...@yahoo.com>.
Hi,

Can you please elaborate further? Is it a valid feature which is not
supported by Jaxme, or am I writing the invalid XML file?

Thank you very much




Jochen Wiedmann wrote:
> 
>>                    xsi:type="exp:USAddress">
> 
> xsi:type is not supported. Therefore, your XML fragment is treated as
> an instance of exp:Address, where the "state" element is indeed
> invalid.
> 
> Jochen
> 
> 
> -- 
> Look, that's why there's rules, understand? So that you think before
> you break 'em.
> 
>     -- (Terry Pratchett, Thief of Time)
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jaxme-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail: jaxme-dev-help@ws.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/JM_EVENT_UNEXPECTED_CHILD_ELEMENT%3A-Unexpected-element-tp14948037p14949694.html
Sent from the JaxMe - Dev mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: jaxme-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: jaxme-dev-help@ws.apache.org


Re: JM_EVENT_UNEXPECTED_CHILD_ELEMENT: Unexpected element

Posted by Jochen Wiedmann <jo...@gmail.com>.
>                    xsi:type="exp:USAddress">

xsi:type is not supported. Therefore, your XML fragment is treated as
an instance of exp:Address, where the "state" element is indeed
invalid.

Jochen


-- 
Look, that's why there's rules, understand? So that you think before
you break 'em.

    -- (Terry Pratchett, Thief of Time)

---------------------------------------------------------------------
To unsubscribe, e-mail: jaxme-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: jaxme-dev-help@ws.apache.org