Re: question 001
Bruno Dumon <[email protected]> 11 Feb 2003 19:15:18 +0100
| Newsgroups | gmane.editors.pollo.devel |
|---|---|
| Organization | Outerthought |
| Message-ID | <[email protected]> |
Mark, I'm sending this also to Pollo's mailing list since it may be of interest to other people wanting to get involved with Pollo (and please ask any further questions also over there). On Mon, 2003-02-10 at 23:37, Mark Ayad wrote: > Bruno > > Question 001: that numbering scheme scares me :-) > - Adding a new element is validated on a schema / DTD, such > that it shows you what new element can be added to a particular node. 'validated' is a big word for the current implementation, 'suggestions' sounds better. > Is the > DTD / Schema loaded at startup (after one has been defined) if so what > package / class handles this functionality It is loaded when opening a document. Pollo has something called a "view type configuration" which contains all information about how to handle the file, including the schema(s) to be used (see the class ViewTypeConf). There can be a number of predefined ViewTypeConf's, constructed based on the information in pollo_conf.xml. If the user selected a custom schema and display specification in the 'select view type' dialog, then a ViewTypeConf is dynamically constructed in ViewTypesDialog.getSelectedViewTypeConf() Pollo then passes this ViewTypeConf as an argument to the constructor of EditorPanelImpl. In this constructor, the method createSchemaChain() is called on the ViewTypeConf. The word 'chain' is used because actually multiple schema's could be used together (such as when there's a HTML document containing SVG, or as WSDL document containing XML Schema, ...). Anyhow, for each schema in the chain, the method SchemaConfItem.createSchema() will be called, which will then ask the factory for a particular type of schemas to create the schema. Depending on the implementation, that factory may 'cache' the schema and return the same instance multiple times. For the MSV-supported schemas (which are all of them except Pollo's own simple schema format), the factory class is called 'MsvSchemaFactory', and the actual implementation class is called 'MsvSchema'. The actual loading of the schema then happens in the MsvSchema.init() method. Note that Pollo will do 2 things with the schema: - it holds a reference to the schema model created by MSV, which is used for actual validation. - it builds a simple structure that for each element holds the list of child elements and attributes it can have. This structure is used to fill the element selection lists and the attribute panel. This thus happens purely based on the name of the element, and not some smarter mechanism. Hope this helps, Bruno -- Bruno Dumon http://outerthought.org/ Outerthought - Open Source, Java & XML Competence Support Center [email protected] ------------------------------------------------------- This SF.NET email is sponsored by: SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See! http://www.vasoftware.com