You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@xmlbeans.apache.org by Fernando Gomes Bernardino <fe...@gvt.com.br> on 2007/04/24 15:56:57 UTC

Parse error - simple

Hello!

I think this is a simple error but I'm new to XSD and XmlBeans.

I have a XML generated by an Oracle SP:

<?xml version = '1.0' encoding = 'iso-8859-1'?>
<parametropacote>
   <parametros num="1">
      <row_id>1-HXCWOK</row_id>
      <nome_pacote>Franquia Unique 600</nome_pacote>
      <num_min_endereco>1</num_min_endereco>
      <num_max_endereco>1</num_max_endereco>
      <num_min_is_voz>1</num_min_is_voz>
      <num_max_is_voz>2</num_max_is_voz>
      <num_min_is_dados>1</num_min_is_dados>
      <num_max_is_dados>1</num_max_is_dados>
      <num_min_is_webline>1</num_min_is_webline>
      <num_max_is_webline>1</num_max_is_webline>
      <num_min_localidade>1</num_min_localidade>
      <num_max_localidade>1</num_max_localidade>
      <num_min_is_voip>0</num_min_is_voip>
      <num_max_is_voip>0</num_max_is_voip>
      <coexiste_is_dados_webline>Não</coexiste_is_dados_webline>
   </parametros>
   .....
</parametropacote>

I've compiled my XMLBeans with this XSD:

<?xml version="1.0" encoding="iso-8859-1"?>
<xsd:schema
	xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
	xmlns:local="http://www.gvt.com/store"
	elementFormDefault="qualified"
	targetNamespace="http://www.gvt.com/store" >
	<xsd:element name="parametropacote" type="local:parametropacote" />
	<xsd:complexType name="parametropacote" >
		<xsd:sequence>
			<xsd:element name="parametros" type="local:parametros" minOccurs="1" maxOccurs="unbounded" />
		</xsd:sequence>
	</xsd:complexType>
	<xsd:complexType name="parametros" >
		<xsd:sequence>
			<xsd:element name="row_id" type="xsd:string" minOccurs="0" maxOccurs="1" nillable="true" />
			<xsd:element name="nome_pacote" type="xsd:string" minOccurs="0" maxOccurs="1" nillable="true" />
			<xsd:element name="num_min_endereco" type="xsd:int" minOccurs="0" maxOccurs="1" nillable="true" />
			<xsd:element name="num_max_endereco" type="xsd:int" minOccurs="0" maxOccurs="1" nillable="true" />
			<xsd:element name="num_min_is_voz" type="xsd:int" minOccurs="0" maxOccurs="1" nillable="true" />
			<xsd:element name="num_max_is_voz" type="xsd:int" minOccurs="0" maxOccurs="1" nillable="true" />
			<xsd:element name="num_min_is_dados" type="xsd:int" minOccurs="0" maxOccurs="1" nillable="true" />
			<xsd:element name="num_max_is_dados" type="xsd:int" minOccurs="0" maxOccurs="1" nillable="true" />
			<xsd:element name="num_min_is_webline" type="xsd:int" minOccurs="0" maxOccurs="1" nillable="true" />
			<xsd:element name="num_max_is_webline" type="xsd:int" minOccurs="0" maxOccurs="1" nillable="true" />
			<xsd:element name="num_min_is_voip" type="xsd:int" minOccurs="0" maxOccurs="1" nillable="true" />
			<xsd:element name="num_max_is_voip" type="xsd:int" minOccurs="0" maxOccurs="1" nillable="true" />
			<xsd:element name="coexiste_is_dados_webline" type="xsd:string" minOccurs="0" maxOccurs="1" nillable="true" />
		</xsd:sequence>
		<xsd:attribute name="num" type="xsd:int" use="required" />
	</xsd:complexType>
</xsd:schema>

On  ParametropacoteDocument.Factory.parse(xml); I got the error:
07/04/23 16:40:57 org.apache.xmlbeans.XmlException: error: The document is not a parametropacote@http://www.gvt.com/store: document element namespace mismatch expected "http://www.gvt.com/store" got ""

Thanks for any help!

--
Fernando Bernardino

RE: Parse error - simple

Posted by Radu Preotiuc-Pietro <ra...@bea.com>.
Also give XmlOptions.setLoadSubstituteNamespaces a try; see the JavaDoc of that method for an explanation.

Radu 

-----Original Message-----
From: Jacob Danner [mailto:jacob.danner@gmail.com] 
Sent: Tuesday, April 24, 2007 7:44 AM
To: user@xmlbeans.apache.org
Subject: Re: Parse error - simple

Hi Fernando,
The problem is that the instance you have created with the Oracle JSP is does not match the namespace of the element you have defined in the schema definition.
Your XSD has the following defined,
targetNamespace="http://www.gvt.com/store" > which means any instances of types in the schema should be defined by <type xmlns="http://www.gvt.com/store" ... />

In your case, I think the change should be something like this
OLD:
 <parametropacote>
NEW:
<parametropacote xmlns="http://www.gvt.com/store"> Best of Luck, -Jacob Danner


On 4/24/07, Fernando Gomes Bernardino <fe...@gvt.com.br> wrote:
>
>
>
> Hello!
>
> I think this is a simple error but I'm new to XSD and XmlBeans.
>
> I have a XML generated by an Oracle SP:
>
> <?xml version = '1.0' encoding = 'iso-8859-1'?> <parametropacote>
>    <parametros num="1">
>       <row_id>1-HXCWOK</row_id>
>       <nome_pacote>Franquia Unique 600</nome_pacote>
>       <num_min_endereco>1</num_min_endereco>
>       <num_max_endereco>1</num_max_endereco>
>       <num_min_is_voz>1</num_min_is_voz>
>       <num_max_is_voz>2</num_max_is_voz>
>       <num_min_is_dados>1</num_min_is_dados>
>       <num_max_is_dados>1</num_max_is_dados>
>       <num_min_is_webline>1</num_min_is_webline>
>       <num_max_is_webline>1</num_max_is_webline>
>       <num_min_localidade>1</num_min_localidade>
>       <num_max_localidade>1</num_max_localidade>
>       <num_min_is_voip>0</num_min_is_voip>
>       <num_max_is_voip>0</num_max_is_voip>
>
> <coexiste_is_dados_webline>Não</coexiste_is_dados_webline>
>    </parametros>
>    .....
> </parametropacote>
>
> I've compiled my XMLBeans with this XSD:
>
> <?xml version="1.0" encoding="iso-8859-1"?> <xsd:schema
>         xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>         xmlns:local="http://www.gvt.com/store"
>         elementFormDefault="qualified"
>         targetNamespace="http://www.gvt.com/store" >
>         <xsd:element name="parametropacote" type="local:parametropacote" />
>         <xsd:complexType name="parametropacote" >
>                 <xsd:sequence>
>                         <xsd:element name="parametros"
> type="local:parametros" minOccurs="1" maxOccurs="unbounded" />
>                 </xsd:sequence>
>         </xsd:complexType>
>         <xsd:complexType name="parametros" >
>                 <xsd:sequence>
>                         <xsd:element name="row_id" type="xsd:string"
> minOccurs="0" maxOccurs="1" nillable="true" />
>                         <xsd:element name="nome_pacote" type="xsd:string"
> minOccurs="0" maxOccurs="1" nillable="true" />
>
>                         <xsd:element name="num_min_endereco" type="xsd:int"
> minOccurs="0" maxOccurs="1" nillable="true" />
>
>                         <xsd:element name="num_max_endereco" type="xsd:int"
> minOccurs="0" maxOccurs="1" nillable="true" />
>
>                         <xsd:element name="num_min_is_voz" type="xsd:int"
> minOccurs="0" maxOccurs="1" nillable="true" />
>
>                         <xsd:element name="num_max_is_voz" type="xsd:int"
> minOccurs="0" maxOccurs="1" nillable="true" />
>
>                         <xsd:element name="num_min_is_dados" type="xsd:int"
> minOccurs="0" maxOccurs="1" nillable="true" />
>
>                         <xsd:element name="num_max_is_dados" type="xsd:int"
> minOccurs="0" maxOccurs="1" nillable="true" />
>
>                         <xsd:element name="num_min_is_webline"
> type="xsd:int" minOccurs="0" maxOccurs="1" nillable="true" />
>
>                         <xsd:element name="num_max_is_webline"
> type="xsd:int" minOccurs="0" maxOccurs="1" nillable="true" />
>
>                         <xsd:element name="num_min_is_voip" type="xsd:int"
> minOccurs="0" maxOccurs="1" nillable="true" />
>
>                         <xsd:element name="num_max_is_voip" type="xsd:int"
> minOccurs="0" maxOccurs="1" nillable="true" />
>
>                         <xsd:element
> name="coexiste_is_dados_webline" type="xsd:string"
> minOccurs="0" maxOccurs="1" nillable="true" />
>
>                 </xsd:sequence>
>                 <xsd:attribute name="num" type="xsd:int" use="required" />
>         </xsd:complexType>
> </xsd:schema>
>
> On  ParametropacoteDocument.Factory.parse(xml); I got the
> error:
> 07/04/23 16:40:57 org.apache.xmlbeans.XmlException: error:
> The document is not a parametropacote@http://www.gvt.com/store: 
> document element namespace mismatch expected "http://www.gvt.com/store" got ""
>
> Thanks for any help!
>
> --
> Fernando Bernardino

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: user-help@xmlbeans.apache.org


Notice:  This email message, together with any attachments, may contain information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated entities,  that may be confidential,  proprietary,  copyrighted  and/or legally privileged, and is intended solely for the use of the individual or entity named in this message. If you are not the intended recipient, and have received this message in error, please immediately return this by email and then delete it.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: user-help@xmlbeans.apache.org


Re: Parse error - simple

Posted by Jacob Danner <ja...@gmail.com>.
Hi Fernando,
The problem is that the instance you have created with the Oracle JSP
is does not match the namespace of the element you have defined in the
schema definition.
Your XSD has the following defined,
targetNamespace="http://www.gvt.com/store" >
which means any instances of types in the schema should be defined by
<type xmlns="http://www.gvt.com/store" ... />

In your case, I think the change should be something like this
OLD:
 <parametropacote>
NEW:
<parametropacote xmlns="http://www.gvt.com/store">
Best of Luck,
-Jacob Danner


On 4/24/07, Fernando Gomes Bernardino <fe...@gvt.com.br> wrote:
>
>
>
> Hello!
>
> I think this is a simple error but I'm new to XSD and XmlBeans.
>
> I have a XML generated by an Oracle SP:
>
> <?xml version = '1.0' encoding = 'iso-8859-1'?>
> <parametropacote>
>    <parametros num="1">
>       <row_id>1-HXCWOK</row_id>
>       <nome_pacote>Franquia Unique 600</nome_pacote>
>       <num_min_endereco>1</num_min_endereco>
>       <num_max_endereco>1</num_max_endereco>
>       <num_min_is_voz>1</num_min_is_voz>
>       <num_max_is_voz>2</num_max_is_voz>
>       <num_min_is_dados>1</num_min_is_dados>
>       <num_max_is_dados>1</num_max_is_dados>
>       <num_min_is_webline>1</num_min_is_webline>
>       <num_max_is_webline>1</num_max_is_webline>
>       <num_min_localidade>1</num_min_localidade>
>       <num_max_localidade>1</num_max_localidade>
>       <num_min_is_voip>0</num_min_is_voip>
>       <num_max_is_voip>0</num_max_is_voip>
>
> <coexiste_is_dados_webline>Não</coexiste_is_dados_webline>
>    </parametros>
>    .....
> </parametropacote>
>
> I've compiled my XMLBeans with this XSD:
>
> <?xml version="1.0" encoding="iso-8859-1"?>
> <xsd:schema
>         xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>         xmlns:local="http://www.gvt.com/store"
>         elementFormDefault="qualified"
>         targetNamespace="http://www.gvt.com/store" >
>         <xsd:element name="parametropacote" type="local:parametropacote" />
>         <xsd:complexType name="parametropacote" >
>                 <xsd:sequence>
>                         <xsd:element name="parametros"
> type="local:parametros" minOccurs="1" maxOccurs="unbounded" />
>                 </xsd:sequence>
>         </xsd:complexType>
>         <xsd:complexType name="parametros" >
>                 <xsd:sequence>
>                         <xsd:element name="row_id" type="xsd:string"
> minOccurs="0" maxOccurs="1" nillable="true" />
>                         <xsd:element name="nome_pacote" type="xsd:string"
> minOccurs="0" maxOccurs="1" nillable="true" />
>
>                         <xsd:element name="num_min_endereco" type="xsd:int"
> minOccurs="0" maxOccurs="1" nillable="true" />
>
>                         <xsd:element name="num_max_endereco" type="xsd:int"
> minOccurs="0" maxOccurs="1" nillable="true" />
>
>                         <xsd:element name="num_min_is_voz" type="xsd:int"
> minOccurs="0" maxOccurs="1" nillable="true" />
>
>                         <xsd:element name="num_max_is_voz" type="xsd:int"
> minOccurs="0" maxOccurs="1" nillable="true" />
>
>                         <xsd:element name="num_min_is_dados" type="xsd:int"
> minOccurs="0" maxOccurs="1" nillable="true" />
>
>                         <xsd:element name="num_max_is_dados" type="xsd:int"
> minOccurs="0" maxOccurs="1" nillable="true" />
>
>                         <xsd:element name="num_min_is_webline"
> type="xsd:int" minOccurs="0" maxOccurs="1" nillable="true" />
>
>                         <xsd:element name="num_max_is_webline"
> type="xsd:int" minOccurs="0" maxOccurs="1" nillable="true" />
>
>                         <xsd:element name="num_min_is_voip" type="xsd:int"
> minOccurs="0" maxOccurs="1" nillable="true" />
>
>                         <xsd:element name="num_max_is_voip" type="xsd:int"
> minOccurs="0" maxOccurs="1" nillable="true" />
>
>                         <xsd:element
> name="coexiste_is_dados_webline" type="xsd:string"
> minOccurs="0" maxOccurs="1" nillable="true" />
>
>                 </xsd:sequence>
>                 <xsd:attribute name="num" type="xsd:int" use="required" />
>         </xsd:complexType>
> </xsd:schema>
>
> On  ParametropacoteDocument.Factory.parse(xml); I got the
> error:
> 07/04/23 16:40:57 org.apache.xmlbeans.XmlException: error:
> The document is not a parametropacote@http://www.gvt.com/store: document
> element namespace mismatch expected "http://www.gvt.com/store" got ""
>
> Thanks for any help!
>
> --
> Fernando Bernardino

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: user-help@xmlbeans.apache.org