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

Julian Scheid julian at sektor37.de
Wed Nov 3 21:53:17 ICT 2004


Kohsuke Kawaguchi wrote:
> 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");

Actually I don't need this, I'd just like to generate:

      Datatype qnameDatatype = ...;
      QName abc = (QName)qnameDatatype.createValue(literal, context);

where 'literal' is some value read from an XML stream.

I assume that's because I'm ok with the generated code depending on the 
datatype library.

> 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.

For the purposes of my generator all that's missing for read access is a 
getValueType() method.

I agree that when it comes to transforming to literals the issue is 
somewhat more complex than I indicated. But isn't what's needed 
basically a registerNamespace(String uri, String prefix) method in the 
context?

Julian


More information about the relaxng-user mailing list