Forums Register Login

Non-Deterministic XML Explanation

+Pie Number of slices to send: Send
Hello mates,

I'm not sure whether this sort of question is allowed here - if it is not, apologies and please close this topic down.

I'm studying for the OCJWS and I've stumbled into this paragraph whilst reading the excellent Service Design Pattern book:

Another problem with Extension Points pertains to the problem of nondeterminism. This occurs when an XML processor (i.e., client, service, or validating XML parser) can’t figure out when a document or document fragment terminates. A complex type may, for example, define a sequence of elements that contains an optional telephone number element followed by an Extension Point. If the client sends the telephone number, the processor can’t know if that should be the last element or if the wildcard content in the extension might follow.



I'm having a bad time to understand the statements above. May you please help me through?

If I have a XML with the following structure:



The XSD could say: "xs:complex type contact details has a sequece of xs:string element called telephone followed by xs:any" (I'm not going to dare to scribble a XSD from the top of my head - for the sake of the example, I think the plan English description will do)

I honestly cannot see why the XML processor won't be able to identify when the contactDetails is over. The telephone element is followed by a contactDetails closing tag.

Can someone please help me to understand that problem?

If someone is interested in the text, the full paragraph says:

Another problem with Extension Points pertains to the problem of nondeterminism. This occurs when an XML processor (i.e., client, service, or validating XML parser) can’t figure out when a document or document fragment terminates. A complex type may, for example, define a sequence of elements that contains an optional telephone number element followed by an Extension Point. If the client sends the telephone number, the processor can’t know if that should be the last element or if the wildcard content in the extension might follow. One solution is to make everything that precedes the extension a required element, but this fundamentally alters the rules for how data is exchanged. The parties could instead identify the extension as being a required element and mark it off with Sentry Elements [Obasanjo] that surround the extension and act as delimiters.
This means that the sender must always provide an extension, but the contents of it may be left blank. While this solves the problem of nondeterminism, the party receiving this structure still has no way to predict what it might find



Cheers.
Replace the word "snake" with "danger noodle" in all tiny ads.
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 1173 times.
Similar Threads
java.io.IOException: Type {http://lang.java}Exception is referenced but not defined.
Question about the SAX Parser
Ensure child element cannot exist without parent Using Xsd
Error while unmarshalling xml
XML Notes - I
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 06:58:39.