[relaxng-user] Java datatype library: value object->string conversion

Kohsuke Kawaguchi Kohsuke.Kawaguchi at Sun.COM
Wed Nov 3 11:31:06 ICT 2004


Julian Scheid wrote:
> Thanks for your reply. Is there any interest in extending the scope of 
> the datatype library API to cover code generators in addition to validators?

Code generators need substantially more than that. I can tell you that 
because I'm working on a databinding tool myself.

First there's a problem with context. Suppose you have the QName type. 
You somehow have to declare a prefix to get a string representation out 
of arbitrary QName. Your proposal doesn't seem to address that.

And even if you fix that, it's still not enough for code generators. 
They have to know how to create an instance of QName, not a string 
representation. You'd like to be able to generate something like:

	public static final QName ABC = new QName("foo","bar");

without knowing anything about the actual datatype. That's hard. As you 
see, this is far beyond just getting the string representation or 
knowing the value type.


> I think it would be a pity if code generators couldn't leverage datatype 
> libraries, or would have to jump through hoops only because of this 
> minor limitation.

I agree that it's unfortunate that code generators can't take advantage 
of pluggable datatypes. But I don't think that's because there's a 
"minor limitation" in the API.

Or are you talking about different kinds of "code generators"?


-- 
Kohsuke Kawaguchi
Sun Microsystems                   kohsuke.kawaguchi at sun.com


More information about the relaxng-user mailing list