|
|
|
Re: How to copy XSDSchema object [message #604264 is a reply to message #77985] |
Thu, 02 July 2009 10:56 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) |
Ed Merks![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=ed.merks%40gmail.com) Messages: 33196 Registered: July 2009 |
Senior Member |
|
|
Marcin,
Comments below.
Marcin Cylke wrote:
> Hello
>
> What I'm trying to achieve is create a class extending XSDSchema and
> put some convenience functions in it.
That sounds like a bad idea.
> I want to have my own interface to XSDSchema object. This part is
> done, but I have a hard time loading content into such object.
> Normaly I would do:
> XSDParser xsdParser1 = new XSDParser(null);
You should load schemas using an XSDResourceImpl, not this way.
> xsdParser1.parse(uri);
> XSDSchema schm = xsdParser1.getSchema();
>
> But since I want to pack that schema into my own object how should I
> do this?
You should not want to do that. It's a bad idea and you already see
why. You can't ensure that the rest of the framework will create
instances of your derived class.
>
> I tried extending XSDParser to return my object when getSchema() is
> called, but it just doesn't work - it returns empty XSDSchema.
>
> It would suffice to copy one schema to another, since my object is
> XSDSchema object on steroids ;-)
Even the XML Schema specification makes the schema definition final, so
again, it's a really bad idea.
>
> Do you have any ideas about this kind of problem?
Yes, avoid it completely. Put your convenience functions in a
convenient separate class.
>
> Marcin
>
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
|
Powered by
FUDForum. Page generated in 0.04094 seconds