Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » option to prohibit mixed contents
option to prohibit mixed contents [message #528449] Tue, 20 April 2010 14:53 Go to next message
Henrik Rentz-Reichert is currently offline Henrik Rentz-ReichertFriend
Messages: 261
Registered: July 2009
Senior Member
Hi,

is it possible to prohibit mixed contents when reading XML? Is there
maybe an option to control this behavior?

In my situation I have an editor which exposes a sub-tree of the model
as plain XML text. The allowed elements are sort of a subset of XHTML.
But the top level elements are paragraph items.

For validation and conversion I transform this text using the
XMLResourceImpl of my model to create model elements from text and vice
versa. (To have a valid model against the schema I add extra XML
surrounding my text.)

Now a valid text is e.g.

"<p>Some text</p><p>More text</p>"

but mixed contents on the top level like

"text <p>more text</p> and even more"

or

"some text"

should be forbidden.

Currently this sort of text is valid but dropped.

Any hints?

Thanks,
Henrik
Re: option to prohibit mixed contents [message #528462 is a reply to message #528449] Tue, 20 April 2010 15:27 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
Henrik,

You'll need to specialize how XMLHandler.characters deals with this case.


Henrik Rentz-Reichert wrote:
> Hi,
>
> is it possible to prohibit mixed contents when reading XML? Is there
> maybe an option to control this behavior?
>
> In my situation I have an editor which exposes a sub-tree of the model
> as plain XML text. The allowed elements are sort of a subset of XHTML.
> But the top level elements are paragraph items.
>
> For validation and conversion I transform this text using the
> XMLResourceImpl of my model to create model elements from text and vice
> versa. (To have a valid model against the schema I add extra XML
> surrounding my text.)
>
> Now a valid text is e.g.
>
> "<p>Some text</p><p>More text</p>"
>
> but mixed contents on the top level like
>
> "text <p>more text</p> and even more"
>
> or
>
> "some text"
>
> should be forbidden.
>
> Currently this sort of text is valid but dropped.
>
> Any hints?
>
> Thanks,
> Henrik
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:Archive serialization performance
Next Topic:EMF Compare
Goto Forum:
  


Current Time: Thu Apr 25 00:15:21 GMT 2024

Powered by FUDForum. Page generated in 0.03573 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top