You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Kannan Ramasamy <ra...@gmail.com> on 2011/02/15 15:32:18 UTC

Unmarshalling Error:Invalid content was found starting with element

Hi 

    In my Restful application,   I am trying to POST JSON data which i got
as response from my GET request. i pasted code sample here. is there any
problem in my XSD configuration.

XSD 
===

 <xs:element name="keyword" type="tns:keyword"/>

 <xs:complexType name="store">
    <xs:sequence>
      <xs:element name="description" type="xs:string" minOccurs="0"/>
      <xs:element name="keywords" minOccurs="0">
        <xs:complexType>
          <xs:sequence>
            <xs:element ref="tns:keyword" minOccurs="0"
maxOccurs="unbounded"/>
          </xs:sequence>
        </xs:complexType>
      </xs:element>
      <xs:element name="name" type="xs:string" />
  </xs:complexType>


  <xs:complexType name="keyword">
    <xs:sequence>
      <xs:element name="id" type="xs:long" minOccurs="0"/>
      <xs:element name="lastModified" type="xs:dateTime" minOccurs="0"/>
      <xs:element name="storeId" type="xs:long" minOccurs="0"/>
      <xs:element name="type" type="xs:string" minOccurs="0"/>
      <xs:element name="value" type="xs:string" minOccurs="0"/>
    </xs:sequence>
  </xs:complexType>



JSON INPUT
=========
{
    "store.store": {
        "store.description": "It is the world's online marketplace",
        "store.keywords": {
            "store.keyword": [
                {
                    "store.value": "amazon" 
                },
                {
                    "store.value": "anthropologie" 
                } 
            ] 
        } 
    } 
}

Following exception i am getting.

Internal Server Error: org.xml.sax.SAXParseException:
cvc-complex-type.2.4.a: Invalid content was found starting with element
'keyword'. One of '{\"http:\/\/www.sample.com\/xml\/ns\/store\":keyword}' is
expected.","ns12.statusCode":500}}   


-- 
View this message in context: http://cxf.547215.n5.nabble.com/Unmarshalling-Error-Invalid-content-was-found-starting-with-element-tp3386024p3386024.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: Unmarshalling Error:Invalid content was found starting with element

Posted by Sergey Beryozkin <sb...@gmail.com>.
It has to work with Jettison 1.3-SNAPSHOT

Sergey

On Tue, Feb 15, 2011 at 2:32 PM, Kannan Ramasamy <ra...@gmail.com>wrote:

>
> Hi
>
>    In my Restful application,   I am trying to POST JSON data which i got
> as response from my GET request. i pasted code sample here. is there any
> problem in my XSD configuration.
>
> XSD
> ===
>
>  <xs:element name="keyword" type="tns:keyword"/>
>
>  <xs:complexType name="store">
>    <xs:sequence>
>      <xs:element name="description" type="xs:string" minOccurs="0"/>
>      <xs:element name="keywords" minOccurs="0">
>        <xs:complexType>
>          <xs:sequence>
>            <xs:element ref="tns:keyword" minOccurs="0"
> maxOccurs="unbounded"/>
>          </xs:sequence>
>        </xs:complexType>
>      </xs:element>
>      <xs:element name="name" type="xs:string" />
>  </xs:complexType>
>
>
>  <xs:complexType name="keyword">
>    <xs:sequence>
>      <xs:element name="id" type="xs:long" minOccurs="0"/>
>      <xs:element name="lastModified" type="xs:dateTime" minOccurs="0"/>
>      <xs:element name="storeId" type="xs:long" minOccurs="0"/>
>      <xs:element name="type" type="xs:string" minOccurs="0"/>
>      <xs:element name="value" type="xs:string" minOccurs="0"/>
>    </xs:sequence>
>  </xs:complexType>
>
>
>
> JSON INPUT
> =========
> {
>    "store.store": {
>        "store.description": "It is the world's online marketplace",
>        "store.keywords": {
>            "store.keyword": [
>                {
>                    "store.value": "amazon"
>                },
>                {
>                    "store.value": "anthropologie"
>                }
>            ]
>        }
>    }
> }
>
> Following exception i am getting.
>
> Internal Server Error: org.xml.sax.SAXParseException:
> cvc-complex-type.2.4.a: Invalid content was found starting with element
> 'keyword'. One of '{\"http:\/\/www.sample.com\/xml\/ns\/store\":keyword}'
> is
> expected.","ns12.statusCode":500}}
>
>
> --
> View this message in context:
> http://cxf.547215.n5.nabble.com/Unmarshalling-Error-Invalid-content-was-found-starting-with-element-tp3386024p3386024.html
> Sent from the cxf-user mailing list archive at Nabble.com.
>