You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@xmlbeans.apache.org by Cezar Andrei <ce...@oracle.com> on 2011/02/02 19:19:21 UTC

Re: Tips for debugging XML beans - newbie

Nicholas,

Did you try error.getObjectLocation()? Do you have any more details
about the error?

Cezar



On Fri, 2011-01-28 at 15:48 +0100, Nicholas W wrote:
> Hi All,
>  I am having some trouble unmarshalling data generated by a remote
> REST web service (for which I have the XSD.
> 
> I have set
> 
> log4j.logger.org.apache.xmlbeans = DEBUG
> 
> in log4j.properties
> 
> and I am using code like:
> 
> XmlOptions xmloptions = new XmlOptions();
> 		 ArrayList errorList = new ArrayList();
> 		 xmloptions.setErrorListener(errorList);
> 
> FindObjectsResponseDocument f =
> FindObjectsResponseDocument.Factory.parse(xmlresult,xmloptions);
> 
> boolean valid = f.validate();
> if (!valid) {
> 			   for (int i = 0; i < errorList.size(); i++)
> 			      {
> 			          XmlError error = (XmlError)errorList.get(i);
> 			
> 			          System.out.println("\n");
> 			          System.out.println("Message: " + error.getMessage() + "\n");
> 			          System.out.println("Location of invalid XML: " +
> 			              error.getCursorLocation().xmlText() + "\n");
> 			      }
> 		}
> 
> To find out whats going on.
> 
> However. Elements are null when they should not be, nothing is
> reported in the logging and the errorList is empty.
> 
> I would be greatful if you could point me to some resources to show
> how to debug XMLBeans unmarshalling.
> 
> Thanks a lot
> Regards,
> Nicholas W.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
> For additional commands, e-mail: user-help@xmlbeans.apache.org
> 



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


[ANN]VTD-XML 2.10

Posted by jimmy Zhang <jz...@ximpleware.com>.
VTD-XML 2.10 is now released. It can be downloaded at https://sourceforge.net/projects/vtd-xml/files/vtd-xml/ximpleware_2.10/.
This release includes a number of new features and enhancement.

* The core API of VTD-XML has been expanded. Users can now perform cut/paste/insert on an empty element.
* This release also adds the support of deeper location cache support for parsing and indexing. This feature is useful for application performance tuning for
processing various XML documents.
* The java version also added support for processing zip and gzip files. Direct processing of httpURL based XML is enhanced.
* Extended Java version now support Iso-8859-10~16 encoding.
* A full featured C++ port is released.
* C version of VTD-XML now make use of thread local storage to achieve thread safety for multi-threaded application.
* There are also a number of bugs fixed. Special thanks to Jozef Aerts, John Sillers, Chris Tornau and a number of other users for input and suggestions

Re: Tips for debugging XML beans - newbie

Posted by raminf <ra...@barcap.com>.
Hi Jacob,
Could you elaborate on your comments and perhaps provide a pseudo example to
better understand your point.

Hi Cezar,
did you find a resolution to your issue. If so, can you share it with us.

In my case, we have a long xsd with many definitions. The issue sporatically
occurs in production where the generated xml becomes invalid (against the
schema). In code, checking something like:

if(mytype instanceof MYXMLBEANSUBTYPE) 

fails eventhough mytype is in fact a MYXMLBEANSUBTYPE. Instead, it appears
to be a generic supertype.

Also, at times some new elements are inserted in the wrong places which
makes the generated xml invalid.

Regards,
Ramin


What does the schema look like? Are the elements and/or anyType?
The majority of times I've hit a similar issue it has to do with an
incorrect namespace or incorrect type.
In the case of incorrect type, it was usually my error using XXDocument when
I needed XXType.
HTH,
-jacobd

-- 
View this message in context: http://old.nabble.com/Tips-for-debugging-XML-beans---newbie-tp30787605p32600801.html
Sent from the Xml Beans - User mailing list archive at Nabble.com.


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


Re: Tips for debugging XML beans - newbie

Posted by Jacob Danner <ja...@gmail.com>.
What does the schema look like? Are the elements and/or anyType?
The majority of times I've hit a similar issue it has to do with an
incorrect namespace or incorrect type.
In the case of incorrect type, it was usually my error using XXDocument when
I needed XXType.
HTH,
-jacobd

On Thu, Feb 3, 2011 at 6:19 AM, Nicholas W <44...@log1.net> wrote:

> Hi Cezar,
>  Thanks for your reply. errorList is empty, so there are no error
> objects...
>
> Regards,
> Nicholas W.
>
> On Wed, Feb 2, 2011 at 7:19 PM, Cezar Andrei <ce...@oracle.com>
> wrote:
> > Nicholas,
> >
> > Did you try error.getObjectLocation()? Do you have any more details
> > about the error?
> >
> > Cezar
> >
> >
> >
> > On Fri, 2011-01-28 at 15:48 +0100, Nicholas W wrote:
> >> Hi All,
> >>  I am having some trouble unmarshalling data generated by a remote
> >> REST web service (for which I have the XSD.
> >>
> >> I have set
> >>
> >> log4j.logger.org.apache.xmlbeans = DEBUG
> >>
> >> in log4j.properties
> >>
> >> and I am using code like:
> >>
> >> XmlOptions xmloptions = new XmlOptions();
> >>                ArrayList errorList = new ArrayList();
> >>                xmloptions.setErrorListener(errorList);
> >>
> >> FindObjectsResponseDocument f =
> >> FindObjectsResponseDocument.Factory.parse(xmlresult,xmloptions);
> >>
> >> boolean valid = f.validate();
> >> if (!valid) {
> >>                          for (int i = 0; i < errorList.size(); i++)
> >>                             {
> >>                                 XmlError error =
> (XmlError)errorList.get(i);
> >>
> >>                                 System.out.println("\n");
> >>                                 System.out.println("Message: " +
> error.getMessage() + "\n");
> >>                                 System.out.println("Location of invalid
> XML: " +
> >>                                     error.getCursorLocation().xmlText()
> + "\n");
> >>                             }
> >>               }
> >>
> >> To find out whats going on.
> >>
> >> However. Elements are null when they should not be, nothing is
> >> reported in the logging and the errorList is empty.
> >>
> >> I would be greatful if you could point me to some resources to show
> >> how to debug XMLBeans unmarshalling.
> >>
> >> Thanks a lot
> >> Regards,
> >> Nicholas W.
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
> >> For additional commands, e-mail: user-help@xmlbeans.apache.org
> >>
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
> > For additional commands, e-mail: user-help@xmlbeans.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
> For additional commands, e-mail: user-help@xmlbeans.apache.org
>
>

Re: Tips for debugging XML beans - newbie

Posted by Nicholas W <44...@log1.net>.
Hi Cezar,
 Thanks for your reply. errorList is empty, so there are no error objects...

Regards,
Nicholas W.

On Wed, Feb 2, 2011 at 7:19 PM, Cezar Andrei <ce...@oracle.com> wrote:
> Nicholas,
>
> Did you try error.getObjectLocation()? Do you have any more details
> about the error?
>
> Cezar
>
>
>
> On Fri, 2011-01-28 at 15:48 +0100, Nicholas W wrote:
>> Hi All,
>>  I am having some trouble unmarshalling data generated by a remote
>> REST web service (for which I have the XSD.
>>
>> I have set
>>
>> log4j.logger.org.apache.xmlbeans = DEBUG
>>
>> in log4j.properties
>>
>> and I am using code like:
>>
>> XmlOptions xmloptions = new XmlOptions();
>>                ArrayList errorList = new ArrayList();
>>                xmloptions.setErrorListener(errorList);
>>
>> FindObjectsResponseDocument f =
>> FindObjectsResponseDocument.Factory.parse(xmlresult,xmloptions);
>>
>> boolean valid = f.validate();
>> if (!valid) {
>>                          for (int i = 0; i < errorList.size(); i++)
>>                             {
>>                                 XmlError error = (XmlError)errorList.get(i);
>>
>>                                 System.out.println("\n");
>>                                 System.out.println("Message: " + error.getMessage() + "\n");
>>                                 System.out.println("Location of invalid XML: " +
>>                                     error.getCursorLocation().xmlText() + "\n");
>>                             }
>>               }
>>
>> To find out whats going on.
>>
>> However. Elements are null when they should not be, nothing is
>> reported in the logging and the errorList is empty.
>>
>> I would be greatful if you could point me to some resources to show
>> how to debug XMLBeans unmarshalling.
>>
>> Thanks a lot
>> Regards,
>> Nicholas W.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
>> For additional commands, e-mail: user-help@xmlbeans.apache.org
>>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
> For additional commands, e-mail: user-help@xmlbeans.apache.org
>
>

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