Altova Mailing List Archives


RE: [xml-dev] Mixed content in data-binding (Was: Re: [xml-dev] Interesting pair of comments (was: ...))

From: "Michael Kay" <mike@--------.--->
To: "'Pete Cordell'" <petexmldev@--------------.--->,"'Paul Downey'" <paul.downey@----------.--->
Date: 7/15/2005 9:22:00 AM
nly interested in.
> 
> Being guilty of being a code-head (and a binding one at that 
> - can it get 
> worse!), I'm keen to know how you'd like us to make a better 
> fist of it. 
> One way of binding the example of "<p>This is <strong>very</strong> 
> important</p>" might be to have a class structure that (with 
> any unused 
> elements ignored) looks like:-
> 
>     class p
>     {
>         string cdata1;        // = "This is "
>         class strong strong;
>         string cdata2;        // = " important"
>     };

That seems to handle the specific example and not the class of all possible
instances (which hasn't been defined here).

If I was modelling this data in Java I would use a List of Objects each of
which is either a String or a StrongElement or an EmphElement or one of the
various other things that's allowed to appear. Alternatively I might use a
TextNode rather than a String, if I want to hold information other than its
content.

Of course Java (even Java 5) wouldn't give me any strong typing on that.

Michael Kay

Disclaimer

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.