|
Re: XML files with missing namespace/schema [message #879668 is a reply to message #879460] |
Thu, 31 May 2012 15:58 |
Konstantin Komissarchik Messages: 1077 Registered: July 2009 |
Senior Member |
|
|
Quote:Sapphire is unable to open this model and the editor just shows edit part. The problem is that in my multi-page editor (masterdetails and source) the user can't even edit in the source or continue.
The editor should definitely not fail to open. I tried your scenario with contacts sample:
The editor opens. I can see source and contacts pages. Performing any edit operation on the form page pops up a yes/no dialog:
"This file appears to be malformed. Do you want a fresh start?"
If user selects yes, the editor buffer contents are replaced with the correct root element. If user selects no, they can correct the problem in the source view.
This is all working as intended.
Quote:Is there a way to let sapphire model know that if the binding-path matches but the namespace and schema locations are null the defaults could be used in their absence?
You should be able to achieve something similar via @CustomXmlRootBinding. Once root element is established with either a namespace or no namespace, the rest of the XML binding can be declarative as Sapphire infers namespace from parent element unless explicitly specified. Note that if there is no namespace and schema, Sapphire will not be able to order elements correctly, so edits performed in this state may violate schema's ordering constraints.
- Konstantin
[Updated on: Thu, 31 May 2012 15:58] Report message to a moderator
|
|
|
Re: XML files with missing namespace/schema [message #882757 is a reply to message #879668] |
Thu, 07 June 2012 06:04 |
Greg Amerson Messages: 119 Registered: March 2010 |
Senior Member |
|
|
Hey Konstantin,
Thanks for trying this with contacts. I see the same behavior but for my model I wasn't seeing this behavior. After tracing through the creation of the model for both contacts database and my own portlet model, I see the problem. In my portlet model there was a @InitialValue(...) on one of the properties. So during the elementImpl instantiation when the initial value is getting processed it can't parse the xml file correctly and fails with a "Corrupted XML resource" exception.
So it turns out that when this portlet model was authored, I didn't understand sapphire as well as I do now and I know that @DefaultValue is the proper annotation to use, initial value is not what I want here. When I switched to @DefaultValue(...), then I don't see this issue anymore and I see the same behavior as with this contacts database.
[Updated on: Thu, 07 June 2012 06:06] Report message to a moderator
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03900 seconds