You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jaxme-dev@ws.apache.org by en...@upf.edu on 2005/08/16 17:38:31 UTC

string patterns

Hi all,

Does JAXME provides some check for string patterns? Or rather must be the
service developer who takes care of this?

For example, given this example:

<simpleType name="UKPostcode">
   <restriction base="ipo:Postcode">
     <pattern value="[A-Z]{2}\d\s\d[A-Z]{2}"/>
   </restriction>
 </simpleType>


Who checks that a UKPostcode string is valid?


Thanks for any help,
-Enric



---------------------------------------------------------------------
To unsubscribe, e-mail: jaxme-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: jaxme-dev-help@ws.apache.org


Re: string patterns

Posted by robert burrell donkin <rd...@apache.org>.
On Fri, 2005-08-19 at 20:51 +0200, Jochen Wiedmann wrote:
> robert burrell donkin wrote:
> 
> > i've seen *really* nasty issues with xerces runtime dependencies :-/
> 
> So do I. :-) Honestly, I do *hope* that most of these are gone by Sun's 
> decision to use the com.sun.org.apache.xerces package in Java 5. In 
> case, we can of course revert the decision.

+1

> > anyone have any good contacts over in xml?
> 
> Any time, I posted something on general@xml, I did not even get a 
> response...

that's a pity 

i met some of the xml guys at apache con so could try emailing them
directly or float the idea on (members) IRC...

- robert

Re: string patterns

Posted by Jochen Wiedmann <jo...@gmail.com>.
robert burrell donkin wrote:

> i've seen *really* nasty issues with xerces runtime dependencies :-/

So do I. :-) Honestly, I do *hope* that most of these are gone by Sun's 
decision to use the com.sun.org.apache.xerces package in Java 5. In 
case, we can of course revert the decision.


> anyone have any good contacts over in xml?

Any time, I posted something on general@xml, I did not even get a 
response...


Jochen

---------------------------------------------------------------------
To unsubscribe, e-mail: jaxme-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: jaxme-dev-help@ws.apache.org


Re: string patterns

Posted by robert burrell donkin <rd...@apache.org>.
On Thu, 2005-08-18 at 23:36 +0200, Jochen Wiedmann wrote:
> robert burrell donkin wrote:
> 
> > http://cvs.apache.org/viewcvs.cgi/xml-xerces/java/src/org/apache/xerces/impl/xpath/regex/RegularExpression.java?view=markup
> 
> Robert, that's been an excellent hint! I have added support for 
> xs:pattern to the trunk. (A unit test remains to be written, though.)
> 
> As it turned out, the class RegularExpression is not sufficient. One 
> needs a whole package with lots of classes and files. I have therefore 
> decided to implement a runtime dependency.

i've seen *really* nasty issues with xerces runtime dependencies :-/

i wonder whether it would be possible to see if we could get a separate
release of this very useful bit of code without having to depend on
xerces. it's now easy to repackage the actual classes so it might not be
too much effort.

anyone have any good contacts over in xml?

(if not, i'll give it a try...)

- robert

Re: string patterns

Posted by robert burrell donkin <rd...@apache.org>.
On Fri, 2005-08-19 at 20:55 +0200, Jochen Wiedmann wrote:
> robert burrell donkin wrote:
> 
> > i was almost tempted to dive in and implement it myself ;)
> 
> So you believe to have some months of spare time, do you? ;-)

note the almost :)

just the bits linking up to the xerces stuff based on your instructions
seemed more reasonable ;)

> > do we
> > have a list of tasks? (might be useful for attracting more hands as
> > well)
> > 
> > BTW has anyone started that maven plugin?
> 
> The list of tasks is a good idea. I'll try to keep it in mind and create 
> one, when the site is based on Maven.
> 
> For now, that come to my mind, are docs indeed (a simple chapter on 
> Unmarshalling or the JAXB customization flags would help) 

i'm doing a lot of documentation for infrastructure at the moment but
once that's done i'll move onto the jaxme stuff. i have some half done
jaxme stuff which i'll try to finish and then move onto the subjects you
suggest... 

of course, if there's anyone out there who wants to learn more about
JAXB, documentation creation is a good method and you'll have the chance
to have any misunderstanding corrected by jochen. so, feel free to jump
in here and grab some work :) 

- robert

Re: string patterns

Posted by Jochen Wiedmann <jo...@gmail.com>.
robert burrell donkin wrote:

> i was almost tempted to dive in and implement it myself ;)

So you believe to have some months of spare time, do you? ;-)


> do we
> have a list of tasks? (might be useful for attracting more hands as
> well)
> 
> BTW has anyone started that maven plugin?

The list of tasks is a good idea. I'll try to keep it in mind and create 
one, when the site is based on Maven.

For now, that come to my mind, are docs indeed (a simple chapter on 
Unmarshalling or the JAXB customization flags would help) and the 
external schema bindings. (I do believe, that these could be implemented 
by some kind of transformation on the schema, based on the binding 
definitions.)


Jochen

---------------------------------------------------------------------
To unsubscribe, e-mail: jaxme-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: jaxme-dev-help@ws.apache.org


Re: string patterns

Posted by robert burrell donkin <rd...@apache.org>.
On Thu, 2005-08-18 at 23:36 +0200, Jochen Wiedmann wrote:
> robert burrell donkin wrote:
> 
> > http://cvs.apache.org/viewcvs.cgi/xml-xerces/java/src/org/apache/xerces/impl/xpath/regex/RegularExpression.java?view=markup
> 
> Robert, that's been an excellent hint! I have added support for 
> xs:pattern to the trunk. (A unit test remains to be written, though.)

i was almost tempted to dive in and implement it myself ;)

i've been wondering recently whether there's any more that i can do to
help push jaxme forward. i tend to find it hard to finish long term work
(that tutorial is still half finished and the betwixt integration
stalled) since stuff tends to blow up elsewhere and grab my attention
but might be able to manage some smaller bits from time to time. do we
have a list of tasks? (might be useful for attracting more hands as
well)

BTW has anyone started that maven plugin?

- robert

Re: string patterns

Posted by Jochen Wiedmann <jo...@gmail.com>.
robert burrell donkin wrote:

> http://cvs.apache.org/viewcvs.cgi/xml-xerces/java/src/org/apache/xerces/impl/xpath/regex/RegularExpression.java?view=markup

Robert, that's been an excellent hint! I have added support for 
xs:pattern to the trunk. (A unit test remains to be written, though.)

As it turned out, the class RegularExpression is not sufficient. One 
needs a whole package with lots of classes and files. I have therefore 
decided to implement a runtime dependency.


Regards,

Jochen

---------------------------------------------------------------------
To unsubscribe, e-mail: jaxme-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: jaxme-dev-help@ws.apache.org


Re: string patterns.. and other constructs.

Posted by Jochen Wiedmann <jo...@gmail.com>.
enric.jaen@upf.edu wrote:

> Please let me ask another question. In your opinion, do you know of any XSD
> construct where it's impossible to generate an automatic java mapping? in other
> words, is there any situation which inevitably requires a manual XML parsing? 
> (I am assuming an RPC-style of web services)

The more generic an XML document is, the less suitable it is for 
mappings. (XML-RPC is, btw., not dynamic and could easily be implemented 
with JAXB/JaxMe.)

Note, that even with generic documents, it is frequently possible to map 
at least parts of the document.

Jochen

---------------------------------------------------------------------
To unsubscribe, e-mail: jaxme-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: jaxme-dev-help@ws.apache.org


Re: string patterns.. and other constructs.

Posted by en...@upf.edu.
Hi,
Thank you for your answers,

Please let me ask another question. In your opinion, do you know of any XSD
construct where it's impossible to generate an automatic java mapping? in other
words, is there any situation which inevitably requires a manual XML parsing? 
(I am assuming an RPC-style of web services)


I would appreciate any help.

Regards,

-Enric


Missatge citat per robert burrell donkin <rd...@apache.org>:

> On Wed, 2005-08-17 at 21:19 +0200, Jochen Wiedmann wrote:
> > robert burrell donkin wrote:
> > 
> > > use the compliant regular expression engine developed for xerces?
> > 
> > Do you have a pointer? I don't know what it is exactly.
> 
>
http://cvs.apache.org/viewcvs.cgi/xml-xerces/java/src/org/apache/xerces/impl/xpath/regex/RegularExpression.java?view=markup
> 
> > > probably better to copy the source across and repackage than add a
> > > dependency to a single class.
> > 
> > There's always the shear between maintaining sources and adding 
> > dependencies - but if it's one class indeed, I'd agree with you.
> 
> it's a xerces internal utility. requiring a particular version of xerces
> can cause troubles for users and so (in this case) it would probably be
> better to copy the source. i've done this for one or two similar classes
> and IMHO it's important to retain the authorship and to add a note about
> it's derivation from xerces. if any bugs are found in our version, then
> any fixes should be submitted back to xerces.
> 
> - robert
> 
> 






---------------------------------------------------------------------
To unsubscribe, e-mail: jaxme-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: jaxme-dev-help@ws.apache.org


Re: string patterns

Posted by robert burrell donkin <rd...@apache.org>.
On Wed, 2005-08-17 at 21:19 +0200, Jochen Wiedmann wrote:
> robert burrell donkin wrote:
> 
> > use the compliant regular expression engine developed for xerces?
> 
> Do you have a pointer? I don't know what it is exactly.

http://cvs.apache.org/viewcvs.cgi/xml-xerces/java/src/org/apache/xerces/impl/xpath/regex/RegularExpression.java?view=markup

> > probably better to copy the source across and repackage than add a
> > dependency to a single class.
> 
> There's always the shear between maintaining sources and adding 
> dependencies - but if it's one class indeed, I'd agree with you.

it's a xerces internal utility. requiring a particular version of xerces
can cause troubles for users and so (in this case) it would probably be
better to copy the source. i've done this for one or two similar classes
and IMHO it's important to retain the authorship and to add a note about
it's derivation from xerces. if any bugs are found in our version, then
any fixes should be submitted back to xerces.

- robert

Re: string patterns

Posted by Jochen Wiedmann <jo...@gmail.com>.
robert burrell donkin wrote:

> use the compliant regular expression engine developed for xerces?

Do you have a pointer? I don't know what it is exactly.

> probably better to copy the source across and repackage than add a
> dependency to a single class.

There's always the shear between maintaining sources and adding 
dependencies - but if it's one class indeed, I'd agree with you.


Jochen

---------------------------------------------------------------------
To unsubscribe, e-mail: jaxme-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: jaxme-dev-help@ws.apache.org


Re: string patterns

Posted by robert burrell donkin <rd...@apache.org>.
On Tue, 2005-08-16 at 23:47 +0200, Jochen Wiedmann wrote:
> enric.jaen@upf.edu wrote:
> 
> > Does JAXME provides some check for string patterns? Or rather must be the
> > service developer who takes care of this?
> 
> Currently it doesn't. It should, though, because the JAXB specification 
> requires that patterns are being checked.
> 
> > <simpleType name="UKPostcode">
> >    <restriction base="ipo:Postcode">
> >      <pattern value="[A-Z]{2}\d\s\d[A-Z]{2}"/>
> >    </restriction>
> >  </simpleType>
> > 
> > 
> > Who checks that a UKPostcode string is valid?
> 
> Adding this check is basically trivial: It would be sufficient, to add a 
> method "getPattern()" to the class AtomicTypeSG (much like the same 
> classes "getMaxLength()" and add an application of the pattern to the 
> class StringSG (again, roughly comparable to the already existing check
> for maxLength.)
> 
> The main problem here is, that these patterns are almost definitely 
> different from Java regular expressions. In other words, if you could 
> supply a converter of xs patterns to regular expressions, the remaining 
> work would be 15 minutes work. Any ideas?

use the compliant regular expression engine developed for xerces?

probably better to copy the source across and repackage than add a
dependency to a single class.

- robert

Re: string patterns

Posted by Jochen Wiedmann <jo...@gmail.com>.
enric.jaen@upf.edu wrote:

> Does JAXME provides some check for string patterns? Or rather must be the
> service developer who takes care of this?

Currently it doesn't. It should, though, because the JAXB specification 
requires that patterns are being checked.

> <simpleType name="UKPostcode">
>    <restriction base="ipo:Postcode">
>      <pattern value="[A-Z]{2}\d\s\d[A-Z]{2}"/>
>    </restriction>
>  </simpleType>
> 
> 
> Who checks that a UKPostcode string is valid?

Adding this check is basically trivial: It would be sufficient, to add a 
method "getPattern()" to the class AtomicTypeSG (much like the same 
classes "getMaxLength()" and add an application of the pattern to the 
class StringSG (again, roughly comparable to the already existing check
for maxLength.)

The main problem here is, that these patterns are almost definitely 
different from Java regular expressions. In other words, if you could 
supply a converter of xs patterns to regular expressions, the remaining 
work would be 15 minutes work. Any ideas?


Jochen

---------------------------------------------------------------------
To unsubscribe, e-mail: jaxme-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: jaxme-dev-help@ws.apache.org