This page is no longer maintained — Please continue to the home page at www.scala-lang.org

ANN: scalaxb 0.0.3 is released

6 replies
eed3si9n
Joined: 2010-01-24,
User offline. Last seen 42 weeks 6 days ago.
Hi all,
I'd like to sheepishly announce some updates to scalaxb.
- Implements options to pick different package names for namespaces. - Implements support for <any>, <anyAttribute>, and mixed content. - Implements round trip from XML document to case class object, and back to XML document.
The following code demonstrates a round trip:
    val subject = <foo xmlns="urn:example:ipo"       xmlns:ipo="urn:example:ipo">        foo<Choice2>2</Choice2>bar</foo>    val obj = Element3.fromXML(subject)    val document = obj.toXML(null, "foo", subject.scope)
Further information is available at http://scalaxb.org.GitHub repo is at http://github.com/eed3si9n/scalaxb.
Thanks,e.e
Robby Pelssers
Joined: 2010-03-20,
User offline. Last seen 42 years 45 weeks ago.
RE: [scala-announce] ANN: scalaxb 0.0.3 is released
1024x768 Clean false false false EN-US X-NONE X-NONE MicrosoftInternetExplorer4 /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-qformat:yes; mso-style-parent:""; mso-padding-alt:0cm 5.4pt 0cm 5.4pt; mso-para-margin:0cm; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-hansi-font-family:Calibri;}

I have one question about converting dates and datetimes.

 

At the moment you take advantage of implicit conversion to RichString for node.text.  But RichString doesn’t have a method like

 

RichString.toDate(format: String)

RichString.toDateTime(format:String)

 

 

And it would also be helpful to have a RichDate and RichDateTime if they had a print method which would convert them to an XmlDateTime or XmlDate String.

 

Are there any plans to make this part of Scala core?

 

Cheers,

Robby Pelssers

From: e.e [mailto:eed3si9n [at] gmail [dot] com]
Sent: Friday, April 02, 2010 2:31 AM
To: scala-xml [at] listes [dot] epfl [dot] ch; scala-announce [at] listes [dot] epfl [dot] ch
Subject: [scala-announce] ANN: scalaxb 0.0.3 is released

 

Hi all,

 

I'd like to sheepishly announce some updates to scalaxb.

 

- Implements options to pick different package names for namespaces. 

- Implements support for <any>, <anyAttribute>, and mixed content.

- Implements round trip from XML document to case class object, and back to XML document.

 

The following code demonstrates a round trip:

 

    val subject = <foo xmlns="urn:example:ipo"

      xmlns:ipo="urn:example:ipo">

        foo<Choice2>2</Choice2>bar</foo>

    val obj = Element3.fromXML(subject)

    val document = obj.toXML(null, "foo", subject.scope)

 

Further information is available at http://scalaxb.org.

GitHub repo is at http://github.com/eed3si9n/scalaxb.

 

Thanks,

e.e

 

eed3si9n
Joined: 2010-01-24,
User offline. Last seen 42 weeks 6 days ago.
Re: [scala-announce] ANN: scalaxb 0.0.3 is released
Hi Robby,
> Are there any plans to make this part of Scala core?
I'm not involved in the core library development, so I don't know about the plans on date handling.At the moment, I don't think Scala even has a class to express time point, time zone, or time span, so once those things are in the language like Int, you might see toXXX methods.
I think Date API has been problematic in Java for a while and there's been an on going process called JSR 310 to fix it. See http://www.infoq.com/news/2010/03/jsr-310 for more details.Maybe after the dust settles, it would be nice to have date and time built into Scala natively. In the mean time, the show must go on, so I use java.util.Calendar (java.xml.datatype.XMLGregorianCalendar) to bind dateTime as jaxb does. I've pushed the conversion code to a Helper class so the parsing looks like this:
  org.scalaxb.rt.Helper.toCalendar((node \ "birthday").text)
I am open to any suggestions.
Cheers,e.e

On Fri, Apr 2, 2010 at 3:55 AM, Robby Pelssers <robby [dot] pelssers [at] ciber [dot] com> wrote:

I have one question about converting dates and datetimes.

 

At the moment you take advantage of implicit conversion to RichString for node.text.  But RichString doesn’t have a method like

 

RichString.toDate(format: String)

RichString.toDateTime(format:String)

 

 

And it would also be helpful to have a RichDate and RichDateTime if they had a print method which would convert them to an XmlDateTime or XmlDate String.

 

Are there any plans to make this part of Scala core?

 

Cheers,

Robby Pelssers

From: e.e [mailto:eed3si9n [at] gmail [dot] com]
Sent: Friday, April 02, 2010 2:31 AM
To: scala-xml [at] listes [dot] epfl [dot] ch; scala-announce [at] listes [dot] epfl [dot] ch
Subject: [scala-announce] ANN: scalaxb 0.0.3 is released

 

Hi all,

 

I'd like to sheepishly announce some updates to scalaxb.

 

- Implements options to pick different package names for namespaces. 

- Implements support for <any>, <anyAttribute>, and mixed content.

- Implements round trip from XML document to case class object, and back to XML document.

 

The following code demonstrates a round trip:

 

    val subject = <foo xmlns="urn:example:ipo"

      xmlns:ipo="urn:example:ipo">

        foo<Choice2>2</Choice2>bar</foo>

    val obj = Element3.fromXML(subject)

    val document = obj.toXML(null, "foo", subject.scope)

 

Further information is available at http://scalaxb.org.

GitHub repo is at http://github.com/eed3si9n/scalaxb.

 

Thanks,

e.e

 


eed3si9n
Joined: 2010-01-24,
User offline. Last seen 42 weeks 6 days ago.
Re: [scala-announce] ANN: scalaxb 0.0.3 is released
Hi Robby,
> Are there any plans to make this part of Scala core?
I'm not involved in the core library development, so I don't know about the plans on date handling.At the moment, I don't think Scala even has a class to express time point, time zone, or time span, so once those things are in the language like Int, you might see toXXX methods.
I think Date API has been problematic in Java for a while and there's been an on going process called JSR 310 to fix it. See http://www.infoq.com/news/2010/03/jsr-310 for more details.Maybe after the dust settles, it would be nice to have date and time built into Scala natively. In the mean time, the show must go on, so I use java.util.Calendar (java.xml.datatype.XMLGregorianCalendar) to bind dateTime as jaxb does. I've pushed the conversion code to a Helper class so the parsing looks like this:
  org.scalaxb.rt.Helper.toCalendar((node \ "birthday").text)
I am open to any suggestions.
Cheers,e.e

On Fri, Apr 2, 2010 at 3:55 AM, Robby Pelssers <robby [dot] pelssers [at] ciber [dot] com> wrote:

I have one question about converting dates and datetimes.

 

At the moment you take advantage of implicit conversion to RichString for node.text.  But RichString doesn’t have a method like

 

RichString.toDate(format: String)

RichString.toDateTime(format:String)

 

 

And it would also be helpful to have a RichDate and RichDateTime if they had a print method which would convert them to an XmlDateTime or XmlDate String.

 

Are there any plans to make this part of Scala core?

 

Cheers,

Robby Pelssers

From: e.e [mailto:eed3si9n [at] gmail [dot] com]
Sent: Friday, April 02, 2010 2:31 AM
To: scala-xml [at] listes [dot] epfl [dot] ch; scala-announce [at] listes [dot] epfl [dot] ch
Subject: [scala-announce] ANN: scalaxb 0.0.3 is released

 

Hi all,

 

I'd like to sheepishly announce some updates to scalaxb.

 

- Implements options to pick different package names for namespaces. 

- Implements support for <any>, <anyAttribute>, and mixed content.

- Implements round trip from XML document to case class object, and back to XML document.

 

The following code demonstrates a round trip:

 

    val subject = <foo xmlns="urn:example:ipo"

      xmlns:ipo="urn:example:ipo">

        foo<Choice2>2</Choice2>bar</foo>

    val obj = Element3.fromXML(subject)

    val document = obj.toXML(null, "foo", subject.scope)

 

Further information is available at http://scalaxb.org.

GitHub repo is at http://github.com/eed3si9n/scalaxb.

 

Thanks,

e.e

 


Robert Wills
Joined: 2009-03-04,
User offline. Last seen 32 weeks 4 days ago.
Re: Re: [scala-announce] ANN: scalaxb 0.0.3 is released

I think that jodatime (http://joda-time.sourceforge.net/) does alot of
what you want here. It's mentioned in that infoq article.

On Fri, Apr 2, 2010 at 2:00 PM, e.e wrote:
> At the moment, I don't think Scala even has a class to express time point,
> time zone, or time span,
I think Jodatime's Instant and Period classes cover time points and time spans.
DateTime contains timezone info.

> See http://www.infoq.com/news/2010/03/jsr-310 for more details.
> Maybe after the dust settles, it would be nice to have date and time built
> into Scala natively.
> In the mean time, the show must go on, so I use java.util.Calendar

Surely one nice thing about the scala world is that we don't have to
wait for jsrs? :-)

-Rob

eed3si9n
Joined: 2010-01-24,
User offline. Last seen 42 weeks 6 days ago.
Re: Re: [scala-announce] ANN: scalaxb 0.0.3 is released
You are right about the joda-time, but I think it is being updated in response to the JSR process.If scalaxb generated joda-time code, then it'll force its users to link against joda-time,which I didn't really want to do. Maybe it could be one of the command line options in the future to use joda-time.
> Surely one nice thing about the scala world is that we don't have to wait for jsrs? :-)That's true, but one thing we can learn from Java is that once anything gets into the native library, it's very difficult to change it.
Cheers,e.e
On Fri, Apr 2, 2010 at 9:57 AM, Robert Wills <wrwills [at] gmail [dot] com> wrote:
I think that jodatime (http://joda-time.sourceforge.net/) does alot of
what you want here.  It's mentioned in that infoq article.

On Fri, Apr 2, 2010 at 2:00 PM, e.e <eed3si9n [at] gmail [dot] com> wrote:
> At the moment, I don't think Scala even has a class to express time point,
> time zone, or time span,
I think Jodatime's Instant and Period classes cover time points and time spans.
DateTime contains timezone info.

> See http://www.infoq.com/news/2010/03/jsr-310 for more details.
> Maybe after the dust settles, it would be nice to have date and time built
> into Scala natively.
> In the mean time, the show must go on, so I use java.util.Calendar

Surely one nice thing about the scala world is that we don't have to
wait for jsrs? :-)

-Rob

eed3si9n
Joined: 2010-01-24,
User offline. Last seen 42 weeks 6 days ago.
Re: Re: [scala-announce] ANN: scalaxb 0.0.3 is released
You are right about the joda-time, but I think it is being updated in response to the JSR process.If scalaxb generated joda-time code, then it'll force its users to link against joda-time,which I didn't really want to do. Maybe it could be one of the command line options in the future to use joda-time.
> Surely one nice thing about the scala world is that we don't have to wait for jsrs? :-)That's true, but one thing we can learn from Java is that once anything gets into the native library, it's very difficult to change it.
Cheers,e.e
On Fri, Apr 2, 2010 at 9:57 AM, Robert Wills <wrwills [at] gmail [dot] com> wrote:
I think that jodatime (http://joda-time.sourceforge.net/) does alot of
what you want here.  It's mentioned in that infoq article.

On Fri, Apr 2, 2010 at 2:00 PM, e.e <eed3si9n [at] gmail [dot] com> wrote:
> At the moment, I don't think Scala even has a class to express time point,
> time zone, or time span,
I think Jodatime's Instant and Period classes cover time points and time spans.
DateTime contains timezone info.

> See http://www.infoq.com/news/2010/03/jsr-310 for more details.
> Maybe after the dust settles, it would be nice to have date and time built
> into Scala natively.
> In the mean time, the show must go on, so I use java.util.Calendar

Surely one nice thing about the scala world is that we don't have to
wait for jsrs? :-)

-Rob

Copyright © 2012 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland