Christopher Elkins wrote:
> 
> Brett McLaughlin [[EMAIL PROTECTED]] wrote:
> > >     private static final String ATTRIBUTE_PKEY = "PKey";
> >
> > I am fundamentally against constants like this being put in compiled
> > code.  I would say put these in a properties file... in other words, if
> > we decide that we want to rename "PKey" "PrimaryKey" it is a trivial
> > change, not a code one.
> >
> I agree - definitely first-draft code.
> 
> > >     private ClassMap currentClassMap;
> > >     private AttributeMap currentAttributeMap;
> > >     private ColumnMap currentColumnMap;
> > >     private TableMap currentTableMap;
> > >     private Vector classMaps;
> >
> > I know this may not be your final work, but we need to JavaDoc
> > _everything_ we do.
> >
> I know, I know. Bad me. In my defense, I whipped this class out _extremely_
> quickly because I wanted to get the ball rolling on this.
> 
> > You should consider taking in a URI as well, as the filename may be read
> > from a properties file.
> >
> Agreed. Also, (obviously) the parser class name won't be hard-coded. :)
> 
> > >
> > >     public void startElement(String name, AttributeList atts)
> > >         throws SAXException
> > >     {
> > >         if (name.equals(ELEMENT_CLASSMAP)) {
> > >             ClassMap classMap = new ClassMap(atts.getValue(ATTRIBUTE_NAME));
> > >             currentClassMap = classMap;
> >
> > I see what you are doing here, but you are assuming that all the
> > required elements and attributes are present.  If not in production,
> > this is certainly not a given in development.  You might want to turn on
> > validation, as well (See my note above).
> >
> In my initial code I was checking for valid values. (I must have removed it
> without realizing.)
> 
> On a related note: if users write their XML docs to the schema and we write
> code to the schema, why wouldn't we want to turn on parser validation and
> enforce the contract between the mapping doc and the schema? Is it because
> the schema may not always be accessible (to the end-user and/or developer)?
> I've never understood why you would go to the trouble of creating a schema (or
> a DTD) if you weren't going to require valid XML docs. Just wondering.

I said to do that... did you miss that?
You should consider turning on validation if a property in the props
file is set:

         
((Configurable)parser).setFeature("http://xml.org/sax/features/validation",
useValidation /*[true or false]*/);

> 
> >
> > All in all, though, a very good start.
> >
> > -Brett
> >
> Thanks! I also have to thank Hannes Wallnofer, because I used some of his
> XML-RPC code as a model.
> 
> --
> Christopher Elkins
> 
> ------------------------------------------------------------
> To subscribe:        [EMAIL PROTECTED]
> To unsubscribe:      [EMAIL PROTECTED]
> Problems?:           [EMAIL PROTECTED]


------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Problems?:           [EMAIL PROTECTED]

Reply via email to