users@jaxb.java.net

unmarshalling - turn off validation to prevent unexpected element exception

From: Jouhal, CJ <cjouhal_at_half.com>
Date: Mon, 15 Dec 2003 10:37:07 -0500

Hi,
  I am using jaxb to interact with a third party API. The schemas are not defined but I created my own from sample xml. Everything works fine until the code encounters an element(s) that was/were not defined in my created schema. Its elements that I don't care about or need but since it is a third party API, I cannot control what is returned. They can add an element without notifying me.

  Is there a way to ignore uknown elements?

  I tried the following:
                unmarshaller.setValidating(false);

  but that didn't work.. still got the following exception:

                javax.xml.bind.UnmarshalException: Unexpected element {}: xyzElement

  The xml is not unmarshalled into an object (the object returned is null)

  Is there some simple method call or setup code that I am missing or is this not possible?

  Must I have a full encompassing schema with all elements defined?

Thanx,
CJ

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
For additional commands, e-mail: users-help_at_jaxb.dev.java.net