[jdom-interest] Extending JDOM classes

Simon Harris Haruki_Zaemon at hotmail.com
Sun Aug 13 20:06:39 PDT 2000


Thanks for your comments.

Processing the schema as XML was my fall-back position if I could find no
other way of doing it. As a first cut, I would most likely not not support
abstract types, etc. I was thinking of a SchemaDocument class, where I could
pass in a qualified element or attribute name, Eg. "applicant/dateOfBirth"
for an element or "applicant.dateOfBirth" for an attribute and have it
return the appropriate SchemaElement or SchemaAttribute.

I already have a basic example working. However instead of a text name, I
use an ElementRef which is like the Swing TreePath.

----- Original Message -----
From: "Brett McLaughlin" <brett.mclaughlin at lutris.com>
To: "Simon Harris" <Haruki_Zaemon at hotmail.com>
Cc: "JDOM Interest" <jdom-interest at jdom.org>
Sent: Monday, August 14, 2000 12:51 PM
Subject: Re: [jdom-interest] Extending JDOM classes


>
>
> Simon Harris wrote:
> >
> > I don't really need data-binding. I just want access to the data-type
> > information. I have no classes to bind to. In fact I don't even no what
the
> > document represents. All I know for example, is there are two elements
name
> > "applicant/age" and "document/submissiondate" and I wish to compare the
text
> > values based on their data-type. Ie. in this case the schema tells me
> > (somehow) that they are both dates. Therefore I would convert them to
dates
> > before perforing the comparison.
>
> OK. But I guess my point is that you are still using that information in
> a specific context; the trouble, particularly with XML Schema (which is
> also one of its strong points) is that an XML Schema is an XML document.
> And an XML document can /look/ like a schema, simply by virtue of the
> root element (schema) or the namespace definitions. If we added this
> type derivation, where reading a schema results in the ability to use
> type-specific methods, we have two big problems:
>
> 1) We could be assigning meaning (XML Schema meaning) to a non-schema
> document, or an XML Schema that is being used differntly (such as not to
> express constraints for an XML document, but to represent, for example,
> an indexing system, where the data types represent field types for a
> GUI, rather than actual data typing in Java).
>
> 2) We add a significant amount of processing to the JDOM API for a
> fairly small set of uses. Most users will use XML Schema as they use
> DTDs - to validate, and nothing else. Direct access to the schema
> grammar in those cases is rarely needed or desired, instead just an "OK,
> it conforms", or a list of errors. In this case, we have significantly
> complicated the API for a relatively small use-case.
>
> I would not be objectionable to something like org.jdom.schema or
> something which is a set of additional JDOM classes that deal with XML
> Schema specifically. I wouldn't mind seeing the same thing for DTDs, for
> that matter. Eventually, we may want to allow creation and access to
> these through JDOM structures that extend or amplify the core. In your
> case, something like that makes the most sense - perhaps extending
> Element, you would have SchemaElement, SchemaAttribute, etc. These are
> actual objects that correspond to the allowed types in an XML Schema and
> can easily be used (like the rest of JDOM). So maybe something like:
>
>   SchemaElement constraint = new SchemaElement("elementName",
> "dataType");
>   constraint.setMinInclusive(0);
>   constraint.setMaxOccurs(SchemaElement.UNBOUNDED);
>
> It would be very cool, and could also serve your needs.
>
> Thoughts? I don't have cycles to work on it, but I'd support anyone who
> did ;-)
>
> -Brett
>
> >
> > Cheers,
> >
> > Simon.
> >
> > ----- Original Message -----
> > From: "Brett McLaughlin" <brett.mclaughlin at lutris.com>
> > To: "Simon Harris" <Haruki_Zaemon at hotmail.com>
> > Sent: Monday, August 14, 2000 11:57 AM
> > Subject: Re: [jdom-interest] Extending JDOM classes
> >
> > >
> > >
> > > Simon Harris wrote:
> > > >
> > > > I'm really interested in what data-type the schema says the text
should
> > be.
> > > > I'm building a "rules" engine and I'd like to know if the data-type
was
> > > > "decimal" or "string", etc. so that I can perform the appropriate
> > equals(),
> > > > lessThan(), greaterThan(), etc. I haven't found any information
anywhere
> > on
> > > > the 'Net indicating that this information is available via even the
DOM
> > or
> > > > SAX. In simple terms I'm trying to have access to the Element
> > definition.
> > >
> > > You're talking about data binding, something more than simply parsing
> > > the content of an XML document. Check out my articles on the subject
> > > here:
> > >
> > >
http://www-4.ibm.com/software/developer/library/data-binding1/?dwzone=xml
> > >
http://www-4.ibm.com/software/developer/library/data-binding2/?dwzone=xml
> > >
> > > The general case, which JDOM is about, is not really somewhere I see
> > > this being needed, or even appropriate - it tries to apply context to
a
> > > specific XML document (including a schema). A straight API (which JDOM
> > > is) shouldn't apply context, as it enforces rules on other users who
may
> > > not want that same context. However, data binding is by definition the
> > > specific context of reading these sorts of rules, so it may serve your
> > > needs.
> > >
> > > -Brett
> > >
> > > >
> > > > Thanks for your help,
> > > >
> > > > Simon.
> > > >
> > > > ----- Original Message -----
> > > > From: "Jason Hunter" <jhunter at collab.net>
> > > > To: "Simon Harris" <Haruki_Zaemon at hotmail.com>
> > > > Cc: "JDOM Interest" <jdom-interest at jdom.org>
> > > > Sent: Monday, August 14, 2000 10:57 AM
> > > > Subject: Re: [jdom-interest] Extending JDOM classes
> > > >
> > > > > > P.S. Did you noticed my question regarding access to data type
> > > > > > information from the schema.
> > > > >
> > > > > Yes, were you asking for getIntValue() kind of methods, or
something
> > > > > else?
> > > > >
> > > > > -jh-
> > > > >
> > > > _______________________________________________
> > > > To control your jdom-interest membership:
> > > >
> >
http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhos
> > t.com
> > >
> > > --
> > > Brett McLaughlin, Enhydra Strategist
> > > Lutris Technologies, Inc.
> > > 1200 Pacific Avenue, Suite 300
> > > Santa Cruz, CA 95060 USA
> > > http://www.lutris.com
> > > http://www.enhydra.org
> > >
>
> --
> Brett McLaughlin, Enhydra Strategist
> Lutris Technologies, Inc.
> 1200 Pacific Avenue, Suite 300
> Santa Cruz, CA 95060 USA
> http://www.lutris.com
> http://www.enhydra.org
> _______________________________________________
> To control your jdom-interest membership:
>
http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhos
t.com
>



More information about the jdom-interest mailing list