Interesting discussion on this back in July on the soapbuilders forum.

BTW, this raises another issue with nesting. Consider the following:

<s:Envelope>
<s:Body>
<m:doSomething>
<p1 href="#b" />
<p2 href="#b" />
</m:doSomething>
<b id="b">
    <c id="c">
        <d href="#c">
    </c>
</b>
</s:Body>
</e:Envelope>

This should be illegal because item "d" is referring to item "c", and the
latter is not defined at the root level!

Because of this nesting issue, supporting serialization of cycles is a bit
tricky. One must flag every block that is used from anywhere else, and ensure
that block appears at the root level. Is there some way to adorn the HREF tag
to force the XML parser to look for the referent in a specific location or
block?

All this silliness seems to be caused by the fact that the XML standard was
defined to make it easier to resolve references, by forcing them all to be at
the root level. It seems the universe would be a happier place if XML didn't
restrict the location of HREF referents. Of course, this happier universe
would need XML parsers that were smarter about where to find the referents but
it seems a small price to pay.

I'll have to try out the Axis SOAP implementation and look at the XML it
generates. I'm curious how it handles cycles. Does it detect nesting and break
them down accordingly? Or does it have some other solution? I'll know soon. .
.

-----Original Message-----
From: Simon Fell [mailto:[EMAIL PROTECTED]]
Sent: Thursday, September 20, 2001 20:17
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Re: XML parser & cyclical reference question


yes, that's legal. i don't see any problem with href's refering to
themselves [either directly or indirectly].

Issues to do with handling multi-ref's has been discussed on the
soapbuilders mailing list a number of times
http://groups.yahoo.com/group/soapbuilders/

Cheers
Simon

On Thu, 20 Sep 2001 19:59:37 -0700, in soap you wrote:

>Yes, you hit the nail right on the head. The second example is exactly what
>I'm doing. And sometimes it works  =)
>
>If it's true that this is illegal, then it would seem impossible to serialize
>a cyclical reference. . . unless. . . what about the following example:
>
><s:Envelope>
><s:Body>
><m:doSomething>
><p1 href="#b" />
><p2 href="#b" />
></m:doSomething>
><b id="b">
>    <c href="#b" />
></b>
></s:Body>
></e:Envelope>
>
>If this is legal, then the best approach might be to serialize everything
>inside the root (parameters and return values) as an href. Then serialize the
>actual data outside.
>
>But this will work only if the serialized data outside the root, can use
hrefs
>that refer to itself.
>
>Will that work? Do you know a good reference that discusses these issues?
>
>Thanks a bunch,
>
>-----Original Message-----
>From: Simon Fell [mailto:[EMAIL PROTECTED]]
>Sent: Thursday, September 20, 2001 18:22
>To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
>Subject: Re: XML parser & cyclical reference question
>
>
>Independent elements in SOAP [the one's that have id's] need to be
>serialized outside of the main serialization root, e.g. they can not
>be inlined, e.g.
>
><s:Envelope>
><s:Body>
><m:doSomething>
><p1 href="#b" />
><p2 href="#b" />
></m:doSomething>
><b id="b">5</b>
></s:Body>
></e:Envelope>
>
>is correct, whilst this is not,
>
><s:Envelope>
><s:Body>
><m:doSomething>
><p1 id="b">5</p1>
><p2 href="#b" />
></m:doSomething>
></s:Body>
></e:Envelope>
>
>from your description it sounds like you are generating the bottom
>example.
>
>Cheers
>Simon
>
>On Thu, 20 Sep 2001 15:29:23 -0700, in soap you wrote:
>
>>Hi all,
>>
>>My Apache SOAP v 2.2 is installed & working with Jetty 3.0.6. I'm trying to
>get data structures with cyclical references to marshal correctly. I've
>modified the Apache SOAP source code to do this as follows:
>>
>>1. Every XML data item has a unique ID for it, whether or not this is
needed.
>>2. BeanSerializer detects duplicate objects or cycles, and in either case
>generates an HREF XML tag to refer to the original item, instead of
>serializing the item again.
>>
>>The XML it generates appears to always be valid, and sometimes it works.
When
>it does not work, the process that is unmarshalling the data (sometimes the
>client, sometimes the server) complains that the XML HREF reference refers to
>an ID tag that is "not defined" -- despite the fact that this tag is always
>defined somewhere in the XML message.
>>
>>In other words, the unmarshaller sometimes matches the HREF to the ID and
>successfully generates the objects. But other times, the unmarshaller
>complains that it can't find the item to which the HREF refers (even though
it
>does exist in the XML message).
>>
>>In every case, I can look at the XML and see that the HREF tag always has a
>matching ID tag, even when the parser says it couldn't be found.
>>
>>I'm wondering if there is some kind of namespace issue that might prevent
the
>HREF tags from matching back to the ID tags to which they refer. In other
>words, even though the HREF string is unique and exactly matches the ID
>string, some kind of namespace issue prevents the parser from matching them
>up.
>>
>>This is probably a simple XML issue but I'm kinda new to XML so if anyone
can
>help point me in the right direction regarding HREF and ID, I would
appreciate
>it.
>>
>>Thanks,
>>
>>Michael R. Clements
>>[EMAIL PROTECTED]
>>Some find truth in beauty, others find beauty in truth.
>


Reply via email to