users@jaxb.java.net

Re: Cycle Exception

From: Kohsuke Kawaguchi <Kohsuke.Kawaguchi_at_Sun.COM>
Date: Mon, 03 Mar 2003 07:14:34 -0800

> I am getting a Validation Exception that says "the content tree forms a
> cycle". What does this error mean?

It means the object graph you asked the marshaller to marshal has a
cyclic reference. Consider the schema like the following (let's use DTD
just to make it concise):

    <!ELEMENT foo (foo?)>

You'll get

    interface Foo {
        Foo getFoo();
    }

If you do:

    Foo foo = of.createFoo();
    foo.setFoo(foo);

Then you'll see this is impossible to marshal "foo" back into XML. This
is what caused the cycle error you are seeing.


regards,
--
Kohsuke KAWAGUCHI                  408-276-7063 (x17063)
Sun Microsystems                   kohsuke.kawaguchi_at_sun.com