Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » XML Schema Definition (XSD) » Changing an element from type= to ref=
Changing an element from type= to ref= [message #594091] Fri, 18 February 2005 19:49
Johnathan Nightingale is currently offline Johnathan NightingaleFriend
Messages: 2
Registered: July 2009
Junior Member
Hi folks,

Sorry if this is a FAQ, but my newsgroup search didn't turn up much.
Basically the situation I have is that my XSD model is loaded on a file
with a perfectly normal complexType containing several elements in a
sequence. Some of the elements use type="..." specifiers, and some are
element refs.

While interacting with our editor, our user will at various times want to
change the type on these elements, and may choose a complexType or an
element, so we need to support all four possibilities:

1) used to use type="..." now uses ref=".."
2) ref -> type
3) ref -> ref
4) type -> type

Cases 3 and 4 work fine, but cases 1 and 2 we're hitting problems. We had
assumed that, for instance for case #2, we could do something like:

element.setTypeDefinition(newType);
element.setName(newName);

and then we realised that we should probably make it:

element.setResolvedElementDeclaration(element);
element.setTypeDefinition(newType);
element.setName(newName);

just to be sure. But when this serializes, we end up with an element that
contains a name, type AND ref attributes, which is obviously bad XSD. A
similar problem strikes when we try to go the other way - nulling name and
typeDefinition, and setting the resolved element.

Is there something obvious we're missing here? We don't want to get to
the point where we first have to create a new element, remove the old one
from its particle, insert the new one, and then copy over annotations,
etc. if there's a cleaner way to make it all magically work. :)

Thanks,

Johnathan
Previous Topic:enumeration-facet of union types
Next Topic:Changing an element from type= to ref=
Goto Forum:
  


Current Time: Fri Apr 26 09:34:03 GMT 2024

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

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

Back to the top