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

Re: Maintainer of schema2src

7 replies
Alex Cruise
Joined: 2008-12-17,
User offline. Last seen 2 years 26 weeks ago.
Hi there!

I'm not sure I'd characterize schema2src as 'maintained' but I think the best course of action would be for you to file a bug and attach your patch to it.

If you'd like to contribute any substantial amount of code,  EPFL will want you to sign the Contributor License Agreement first to make sure there aren't any IP issues down the road.

Thanks!

-0xe1a

----- Reply message -----
From: "e.e d3si9n" <eed3si9n [at] gmail [dot] com>
Date: Wed, Jan 27, 2010 01:54
Subject: [scala-xml] Maintainer of schema2src
To: <scala-xml [at] listes [dot] epfl [dot] ch>

Hi all,

Could someone tell me who how I could send patches for tools like
schema2src?
I wanted to try the tool, but I had to fix it a little to build on scala
2.8.

Thanks,
e.e


Meredith Gregory
Joined: 2008-12-17,
User offline. Last seen 42 years 45 weeks ago.
Re: Re: Maintainer of schema2src
Dear e.e,
i'd like to try out your patch. What did you end of doing in terms of publishing it?
Best wishes,
--greg

On Wed, Jan 27, 2010 at 9:28 AM, Alex Cruise <alex [at] cluonflux [dot] com> wrote:
Hi there!

I'm not sure I'd characterize schema2src as 'maintained' but I think the best course of action would be for you to file a bug and attach your patch to it.

If you'd like to contribute any substantial amount of code,  EPFL will want you to sign the Contributor License Agreement first to make sure there aren't any IP issues down the road.

Thanks!

-0xe1a

----- Reply message -----
From: "e.e d3si9n" <eed3si9n [at] gmail [dot] com>
Date: Wed, Jan 27, 2010 01:54
Subject: [scala-xml] Maintainer of schema2src
To: <scala-xml [at] listes [dot] epfl [dot] ch>

Hi all,

Could someone tell me who how I could send patches for tools like
schema2src?
I wanted to try the tool, but I had to fix it a little to build on scala
2.8.

Thanks,
e.e





--
L.G. Meredith
Managing Partner
Biosimilarity LLC
1219 NW 83rd St
Seattle, WA 98117

+1 206.650.3740

http://biosimilarity.blogspot.com
eed3si9n
Joined: 2010-01-24,
User offline. Last seen 42 weeks 6 days ago.
Re: Re: Maintainer of schema2src
Hi greg,
I haven't published the patch to anywhere. I'll probably send it in as bug report as Alex suggested.I didn't like the code it generated for dtd, so I've been working on xsd version, which generates typed fields. Currently it's still crude and lots of things unsupported, but eventually I think that's the way to go since everythingin dtd is #PCDATA.
cheers,e.e

On Thu, Feb 4, 2010 at 4:33 PM, Meredith Gregory <lgreg [dot] meredith [at] gmail [dot] com> wrote:
Dear e.e,
i'd like to try out your patch. What did you end of doing in terms of publishing it?
Best wishes,
--greg

On Wed, Jan 27, 2010 at 9:28 AM, Alex Cruise <alex [at] cluonflux [dot] com> wrote:
Hi there!

I'm not sure I'd characterize schema2src as 'maintained' but I think the best course of action would be for you to file a bug and attach your patch to it.

If you'd like to contribute any substantial amount of code,  EPFL will want you to sign the Contributor License Agreement first to make sure there aren't any IP issues down the road.

Thanks!

-0xe1a

----- Reply message -----
From: "e.e d3si9n" <eed3si9n [at] gmail [dot] com>
Date: Wed, Jan 27, 2010 01:54
Subject: [scala-xml] Maintainer of schema2src
To: <scala-xml [at] listes [dot] epfl [dot] ch>

Hi all,

Could someone tell me who how I could send patches for tools like
schema2src?
I wanted to try the tool, but I had to fix it a little to build on scala
2.8.

Thanks,
e.e





--
L.G. Meredith
Managing Partner
Biosimilarity LLC
1219 NW 83rd St
Seattle, WA 98117

+1 206.650.3740

http://biosimilarity.blogspot.com

Meredith Gregory
Joined: 2008-12-17,
User offline. Last seen 42 years 45 weeks ago.
Re: Re: Maintainer of schema2src
Dear e.e,
(You wouldn't be related to a poet would you?)
Sounds good. Would you like me to send you a test case .xsd that i have some interest in? ;-)
Best wishes,
--greg

On Thu, Feb 4, 2010 at 1:46 PM, e.e d3si9n <eed3si9n [at] gmail [dot] com> wrote:
Hi greg,
I haven't published the patch to anywhere. I'll probably send it in as bug report as Alex suggested.I didn't like the code it generated for dtd, so I've been working on xsd version, which generates typed fields. Currently it's still crude and lots of things unsupported, but eventually I think that's the way to go since everythingin dtd is #PCDATA.
cheers,e.e

On Thu, Feb 4, 2010 at 4:33 PM, Meredith Gregory <lgreg [dot] meredith [at] gmail [dot] com> wrote:
Dear e.e,
i'd like to try out your patch. What did you end of doing in terms of publishing it?
Best wishes,
--greg

On Wed, Jan 27, 2010 at 9:28 AM, Alex Cruise <alex [at] cluonflux [dot] com> wrote:
Hi there!

I'm not sure I'd characterize schema2src as 'maintained' but I think the best course of action would be for you to file a bug and attach your patch to it.

If you'd like to contribute any substantial amount of code,  EPFL will want you to sign the Contributor License Agreement first to make sure there aren't any IP issues down the road.

Thanks!

-0xe1a

----- Reply message -----
From: "e.e d3si9n" <eed3si9n [at] gmail [dot] com>
Date: Wed, Jan 27, 2010 01:54
Subject: [scala-xml] Maintainer of schema2src
To: <scala-xml [at] listes [dot] epfl [dot] ch>

Hi all,

Could someone tell me who how I could send patches for tools like
schema2src?
I wanted to try the tool, but I had to fix it a little to build on scala
2.8.

Thanks,
e.e





--
L.G. Meredith
Managing Partner
Biosimilarity LLC
1219 NW 83rd St
Seattle, WA 98117

+1 206.650.3740

http://biosimilarity.blogspot.com




--
L.G. Meredith
Managing Partner
Biosimilarity LLC
1219 NW 83rd St
Seattle, WA 98117

+1 206.650.3740

http://biosimilarity.blogspot.com
eed3si9n
Joined: 2010-01-24,
User offline. Last seen 42 weeks 6 days ago.
Re: Re: Maintainer of schema2src
Hi greg,
The bug report is created (http://lampsvn.epfl.ch/trac/scala/ticket/3023), and I've also started agithub repository to work on the xsd feature (http://github.com/eed3si9n/schema2src). The generated code looks kind of like this:
case class USAddress(  name: String,  street: String,  city: String,  state: String,  zip: BigDecimal) extends DataModel { }
object USAddress {  def fromXML(node: scala.xml.Node) =    USAddress((node \ "name").text,      (node \ "street").text,      (node \ "city").text,       (node \ "state").text,      BigDecimal((node \ "zip").text))     def fromSequence(sequence: scala.xml.NodeSeq) =    for (node <- sequence.toList)       yield fromXML(node)}
case class PurchaseOrderType(  shipTo: USAddress,  billTo: USAddress,  comment: String,  items: Items) extends DataModel { }
object PurchaseOrderType {  def fromXML(node: scala.xml.Node) =    PurchaseOrderType(USAddress.fromXML((node \ "shipTo").head),      USAddress.fromXML((node \ "billTo").head),       (node \ "comment").text,      Items.fromXML((node \ "items").head))     def fromSequence(sequence: scala.xml.NodeSeq) =    for (node <- sequence.toList)       yield fromXML(node)}
Not sure what's the best practice for binding XML in scala, but I think using plain case classes is more lightweight than extending scala.xml.Node. You're welcome to send me xsd. (and no, no relation with the poet)
cheers,e.e

On Thu, Feb 4, 2010 at 8:52 PM, Meredith Gregory <lgreg [dot] meredith [at] gmail [dot] com> wrote:
Dear e.e,
(You wouldn't be related to a poet would you?)
Sounds good. Would you like me to send you a test case .xsd that i have some interest in? ;-)
Best wishes,
--greg

On Thu, Feb 4, 2010 at 1:46 PM, e.e d3si9n <eed3si9n [at] gmail [dot] com> wrote:
Hi greg,
I haven't published the patch to anywhere. I'll probably send it in as bug report as Alex suggested.I didn't like the code it generated for dtd, so I've been working on xsd version, which generates typed fields. Currently it's still crude and lots of things unsupported, but eventually I think that's the way to go since everythingin dtd is #PCDATA.
cheers,e.e

On Thu, Feb 4, 2010 at 4:33 PM, Meredith Gregory <lgreg [dot] meredith [at] gmail [dot] com> wrote:
Dear e.e,
i'd like to try out your patch. What did you end of doing in terms of publishing it?
Best wishes,
--greg

On Wed, Jan 27, 2010 at 9:28 AM, Alex Cruise <alex [at] cluonflux [dot] com> wrote:
Hi there!

I'm not sure I'd characterize schema2src as 'maintained' but I think the best course of action would be for you to file a bug and attach your patch to it.

If you'd like to contribute any substantial amount of code,  EPFL will want you to sign the Contributor License Agreement first to make sure there aren't any IP issues down the road.

Thanks!

-0xe1a

----- Reply message -----
From: "e.e d3si9n" <eed3si9n [at] gmail [dot] com>
Date: Wed, Jan 27, 2010 01:54
Subject: [scala-xml] Maintainer of schema2src
To: <scala-xml [at] listes [dot] epfl [dot] ch>

Hi all,

Could someone tell me who how I could send patches for tools like
schema2src?
I wanted to try the tool, but I had to fix it a little to build on scala
2.8.

Thanks,
e.e





--
L.G. Meredith
Managing Partner
Biosimilarity LLC
1219 NW 83rd St
Seattle, WA 98117

+1 206.650.3740

http://biosimilarity.blogspot.com




--
L.G. Meredith
Managing Partner
Biosimilarity LLC
1219 NW 83rd St
Seattle, WA 98117

+1 206.650.3740

http://biosimilarity.blogspot.com

eed3si9n
Joined: 2010-01-24,
User offline. Last seen 42 weeks 6 days ago.
Re: Maintainer of schema2src
Hi greg and xml list,
Attached is the output from running schema2src on WhiteRabbit.xsd locally. Still not perfect, but I've made some headway into handling type/element/super class naming conflicts, and option groups handling.
SiteShape is a good example where you have all three type, element, and trait:
case class SiteShapeType(SiteShape: SiteShape) extends DataModel with SiteShapable { }
object SiteShapeType {   def fromXML(node: scala.xml.Node): SiteShapeType =    SiteShapeType(SiteShape.fromXML((node \ "SiteShape").head))  }
trait SiteShapable extends ParamsPropOption {   val SiteShape: SiteShape;}
object SiteShapable {  def fromXML(node: scala.xml.Node): SiteShapable = {    val typeName = (node \ "@{http://www.w3.org/2001/XMLSchema-instance}type").text         val withoutNS = typeName.drop(typeName.indexOf(":") + 1)        withoutNS match {       case "SendProp" => SendProp.fromXML(node)      case "GuardedProp" => GuardedProp.fromXML(node)       case _ => SiteShapeType.fromXML(node)    }  } }
case class SiteShape(arg1: DataShapeOption) extends DataModel with DataShapeOption { }
object SiteShape {  def fromXML(node: scala.xml.Node): SiteShape =    SiteShape(DataShapeOption.fromXML(node.child.filter(_.isInstanceOf[scala.xml.Elem])(0)))  }
Choice groups are expressed as traits as I wrote last time:

trait CollectedExtensionOption
object CollectedExtensionOption {  def fromXML(node: scala.xml.Node): CollectedExtensionOption = node.label match {     case "Mixed" => Mixed.fromXML(node)    case "Selected" => SwitchedType.fromXML(node)     case "Engaged" => Engaged.fromXML(node)    case "Carried" => CoSynchedType.fromXML(node)     case "Served" => Served.fromXML(node)    case "Varied" => ProcessIdent.fromXML(node)     case "Emptied" => EmptyElement.fromXML(node)    case "Stated" => RiskType.fromXML(node)         case _ => throw new Exception("Unsupported element: " + node.label + ": " +  node.toString)   }}
Each "particle" case class is aware of the trait by means of "with":
case class Mixed(arg1: MixedOption) extends DataModel with CollectedExtensionOption { }
object Mixed {  def fromXML(node: scala.xml.Node): Mixed =     Mixed(MixedOption.fromXML(node.child.filter(_.isInstanceOf[scala.xml.Elem])(0))) }
Remaining todo item is cardinality (minOccurs/maxOccurs) of the content model like choice group.Any comments or suggestions are welcomed.Code is available http://github.com/eed3si9n/schema2src
cheers,e.e
Meredith Gregory
Joined: 2008-12-17,
User offline. Last seen 42 years 45 weeks ago.
Re: Maintainer of schema2src
Dear e.e,
This looks very promising. Can you send along the way you invoke this from schema2src? i've been running a modified version of the test path, but there must be a better way...
Best wishes,
--greg

On Thu, Feb 18, 2010 at 8:56 PM, e.e d3si9n <eed3si9n [at] gmail [dot] com> wrote:
Hi greg and xml list,
Attached is the output from running schema2src on WhiteRabbit.xsd locally. Still not perfect, but I've made some headway into handling type/element/super class naming conflicts, and option groups handling.
SiteShape is a good example where you have all three type, element, and trait:
case class SiteShapeType(SiteShape: SiteShape) extends DataModel with SiteShapable { }
object SiteShapeType {   def fromXML(node: scala.xml.Node): SiteShapeType =    SiteShapeType(SiteShape.fromXML((node \ "SiteShape").head))  }
trait SiteShapable extends ParamsPropOption {   val SiteShape: SiteShape;}
object SiteShapable {  def fromXML(node: scala.xml.Node): SiteShapable = {    val typeName = (node \ "@{http://www.w3.org/2001/XMLSchema-instance}type").text         val withoutNS = typeName.drop(typeName.indexOf(":") + 1)        withoutNS match {       case "SendProp" => SendProp.fromXML(node)      case "GuardedProp" => GuardedProp.fromXML(node)       case _ => SiteShapeType.fromXML(node)    }  } }
case class SiteShape(arg1: DataShapeOption) extends DataModel with DataShapeOption { }
object SiteShape {  def fromXML(node: scala.xml.Node): SiteShape =    SiteShape(DataShapeOption.fromXML(node.child.filter(_.isInstanceOf[scala.xml.Elem])(0)))  }
Choice groups are expressed as traits as I wrote last time:

trait CollectedExtensionOption
object CollectedExtensionOption {  def fromXML(node: scala.xml.Node): CollectedExtensionOption = node.label match {     case "Mixed" => Mixed.fromXML(node)    case "Selected" => SwitchedType.fromXML(node)     case "Engaged" => Engaged.fromXML(node)    case "Carried" => CoSynchedType.fromXML(node)     case "Served" => Served.fromXML(node)    case "Varied" => ProcessIdent.fromXML(node)     case "Emptied" => EmptyElement.fromXML(node)    case "Stated" => RiskType.fromXML(node)         case _ => throw new Exception("Unsupported element: " + node.label + ": " +  node.toString)   }}
Each "particle" case class is aware of the trait by means of "with":
case class Mixed(arg1: MixedOption) extends DataModel with CollectedExtensionOption { }
object Mixed {  def fromXML(node: scala.xml.Node): Mixed =     Mixed(MixedOption.fromXML(node.child.filter(_.isInstanceOf[scala.xml.Elem])(0))) }
Remaining todo item is cardinality (minOccurs/maxOccurs) of the content model like choice group.Any comments or suggestions are welcomed.Code is available http://github.com/eed3si9n/schema2src
cheers,e.e



--
L.G. Meredith
Managing Partner
Biosimilarity LLC
1219 NW 83rd St
Seattle, WA 98117

+1 206.650.3740

http://biosimilarity.blogspot.com
eed3si9n
Joined: 2010-01-24,
User offline. Last seen 42 weeks 6 days ago.
Re: Maintainer of schema2src
Hi greg,
I generated it by running "ant test," which invokes the following task:    <schema2src>       <arg value="xsd"/>      <arg value="-d"/><arg value="${test.dir}"/>       <arg value="-p"/><arg value="whiterabbit"/>      <arg value="${basedir}/tests/whiterabbit.xsd"/>       <arg value="whiterabbit"/>    </schema2src>
which translates to$ schema2src xsd -d tests/tmp -p whiterabbit tests/whiterabbit.xsd whiterabbit
Here's what I did to deploy the program:$ sudo cp ~/work/schema2src/dist/bin/schema2src* /opt/local/share/scala/bin/ $ sudo chmod a+x /opt/local/share/scala/bin/schema2src$ sudo cp ~/work/schema2src/dist/lib/schema2src.jar /opt/local/share/scala/lib/
cheers,e.e
On Fri, Feb 19, 2010 at 10:49 AM, Meredith Gregory <lgreg [dot] meredith [at] gmail [dot] com> wrote:
Dear e.e,
This looks very promising. Can you send along the way you invoke this from schema2src? i've been running a modified version of the test path, but there must be a better way...
Best wishes,
--greg

On Thu, Feb 18, 2010 at 8:56 PM, e.e d3si9n <eed3si9n [at] gmail [dot] com> wrote:
Hi greg and xml list,
Attached is the output from running schema2src on WhiteRabbit.xsd locally. Still not perfect, but I've made some headway into handling type/element/super class naming conflicts, and option groups handling.
SiteShape is a good example where you have all three type, element, and trait:
case class SiteShapeType(SiteShape: SiteShape) extends DataModel with SiteShapable { }
object SiteShapeType {   def fromXML(node: scala.xml.Node): SiteShapeType =    SiteShapeType(SiteShape.fromXML((node \ "SiteShape").head))  }
trait SiteShapable extends ParamsPropOption {   val SiteShape: SiteShape;}
object SiteShapable {  def fromXML(node: scala.xml.Node): SiteShapable = {    val typeName = (node \ "@{http://www.w3.org/2001/XMLSchema-instance}type").text         val withoutNS = typeName.drop(typeName.indexOf(":") + 1)        withoutNS match {       case "SendProp" => SendProp.fromXML(node)      case "GuardedProp" => GuardedProp.fromXML(node)       case _ => SiteShapeType.fromXML(node)    }  } }
case class SiteShape(arg1: DataShapeOption) extends DataModel with DataShapeOption { }
object SiteShape {  def fromXML(node: scala.xml.Node): SiteShape =    SiteShape(DataShapeOption.fromXML(node.child.filter(_.isInstanceOf[scala.xml.Elem])(0)))  }
Choice groups are expressed as traits as I wrote last time:

trait CollectedExtensionOption
object CollectedExtensionOption {  def fromXML(node: scala.xml.Node): CollectedExtensionOption = node.label match {     case "Mixed" => Mixed.fromXML(node)    case "Selected" => SwitchedType.fromXML(node)     case "Engaged" => Engaged.fromXML(node)    case "Carried" => CoSynchedType.fromXML(node)     case "Served" => Served.fromXML(node)    case "Varied" => ProcessIdent.fromXML(node)     case "Emptied" => EmptyElement.fromXML(node)    case "Stated" => RiskType.fromXML(node)         case _ => throw new Exception("Unsupported element: " + node.label + ": " +  node.toString)   }}
Each "particle" case class is aware of the trait by means of "with":
case class Mixed(arg1: MixedOption) extends DataModel with CollectedExtensionOption { }
object Mixed {  def fromXML(node: scala.xml.Node): Mixed =     Mixed(MixedOption.fromXML(node.child.filter(_.isInstanceOf[scala.xml.Elem])(0))) }
Remaining todo item is cardinality (minOccurs/maxOccurs) of the content model like choice group.Any comments or suggestions are welcomed.Code is available http://github.com/eed3si9n/schema2src
cheers,e.e



--
L.G. Meredith
Managing Partner
Biosimilarity LLC
1219 NW 83rd St
Seattle, WA 98117

+1 206.650.3740

http://biosimilarity.blogspot.com

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