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

i can haz scala xml???

4 replies
Meredith Gregory
Joined: 2008-12-17,
User offline. Last seen 42 years 45 weeks ago.
Sir and Dame Scalahads,

i was attempting to do something really simple-minded with scala.xml._ and it didn't perform according to Burak's tutorial. So, any clues about the following would be greatly appreciated.

  • When i type the following into Scala version 2.7.2.final repl, it all works
scala> scala.xml.Elem(null,"fu",null,scala.xml.TopScope,scala.xml.Elem(null,"bar",null,scala.xml.TopScope,scala.xml.Text("5")))
res9: scala.xml.Elem = <fu><bar>5</bar></fu>

scala>
  • But when i attempt to compile a similar expression in Scala version 2.7.3, it doesn't.
[WARNING] /Users/lgm/work/src/projex/bobj/dspace/src/main/scala/com/sap/dspace/model/othello/render.scala:26: error: type mismatch;
[WARNING]  found   : scala.xml.TopScope.type (with underlying type object scala.xml.TopScope)
[WARNING]  required: scala.xml.MetaData
[WARNING]       TopScope,
[WARNING]       ^
  • Where do i go to see the new api?
It would be cooler if i could do something like
<{computeTag(context)}>{computeTagContents(context)}</{computeTag(context}>

but i think that might be a parsing nightmare and so i'm guessing this isn't supported. i'd love to know if i'm wrong.

Best wishes,

--greg

--
L.G. Meredith
Managing Partner
Biosimilarity LLC
806 55th St NE
Seattle, WA 98105

+1 206.650.3740

http://biosimilarity.blogspot.com
David Pollak
Joined: 2008-12-16,
User offline. Last seen 42 years 45 weeks ago.
Re: i can haz scala xml???
scala> <fu><bar>5</bar></fu>res0: scala.xml.Elem = <fu><bar>5</bar></fu>
scala> <fu>{(1 to 3).map(i => <item>{i}</item>)}</fu> res1: scala.xml.Elem = <fu><item>1</item><item>2</item><item>3</item></fu>
Does that give you what you want (XML literals are part of the language)
On Wed, Mar 4, 2009 at 1:10 PM, Meredith Gregory <lgreg.meredith@gmail.com> wrote:
Sir and Dame Scalahads,

i was attempting to do something really simple-minded with scala.xml._ and it didn't perform according to Burak's tutorial. So, any clues about the following would be greatly appreciated.

  • When i type the following into Scala version 2.7.2.final repl, it all works
scala> scala.xml.Elem(null,"fu",null,scala.xml.TopScope,scala.xml.Elem(null,"bar",null,scala.xml.TopScope,scala.xml.Text("5")))
res9: scala.xml.Elem = <fu><bar>5</bar></fu>

scala>
  • But when i attempt to compile a similar expression in Scala version 2.7.3, it doesn't.
[WARNING] /Users/lgm/work/src/projex/bobj/dspace/src/main/scala/com/sap/dspace/model/othello/render.scala:26: error: type mismatch;
[WARNING]  found   : scala.xml.TopScope.type (with underlying type object scala.xml.TopScope)
[WARNING]  required: scala.xml.MetaData
[WARNING]       TopScope,
[WARNING]       ^
  • Where do i go to see the new api?
It would be cooler if i could do something like
<{computeTag(context)}>{computeTagContents(context)}</{computeTag(context}>

but i think that might be a parsing nightmare and so i'm guessing this isn't supported. i'd love to know if i'm wrong.

Best wishes,

--greg

--
L.G. Meredith
Managing Partner
Biosimilarity LLC
806 55th St NE
Seattle, WA 98105

+1 206.650.3740

http://biosimilarity.blogspot.com



--
Lift, the simply functional web framework http://liftweb.net
Beginning Scala http://www.apress.com/book/view/1430219890
Follow me: http://twitter.com/dpp
Git some: http://github.com/dpp
Meredith Gregory
Joined: 2008-12-17,
User offline. Last seen 42 years 45 weeks ago.
Re: i can haz scala xml???
David,

Thanks, but not quite. Unfortunately, i do not know the name of the tag. i have to compute it. So, your soln won't work. As i mentioned in my email, the following

<{computeTag(context)}>{computeTagContents(context)}</{computeTag(context}>   is a scheme for what i'd like to do, but it's probably too hard to make work.

Best wishes,

--greg

On Wed, Mar 4, 2009 at 1:13 PM, David Pollak <feeder.of.the.bears@gmail.com> wrote:
scala> <fu><bar>5</bar></fu>res0: scala.xml.Elem = <fu><bar>5</bar></fu>
scala> <fu>{(1 to 3).map(i => <item>{i}</item>)}</fu> res1: scala.xml.Elem = <fu><item>1</item><item>2</item><item>3</item></fu>
Does that give you what you want (XML literals are part of the language)
On Wed, Mar 4, 2009 at 1:10 PM, Meredith Gregory <lgreg.meredith@gmail.com> wrote:
Sir and Dame Scalahads,

i was attempting to do something really simple-minded with scala.xml._ and it didn't perform according to Burak's tutorial. So, any clues about the following would be greatly appreciated.

  • When i type the following into Scala version 2.7.2.final repl, it all works
scala> scala.xml.Elem(null,"fu",null,scala.xml.TopScope,scala.xml.Elem(null,"bar",null,scala.xml.TopScope,scala.xml.Text("5")))
res9: scala.xml.Elem = <fu><bar>5</bar></fu>

scala>
  • But when i attempt to compile a similar expression in Scala version 2.7.3, it doesn't.
[WARNING] /Users/lgm/work/src/projex/bobj/dspace/src/main/scala/com/sap/dspace/model/othello/render.scala:26: error: type mismatch;
[WARNING]  found   : scala.xml.TopScope.type (with underlying type object scala.xml.TopScope)
[WARNING]  required: scala.xml.MetaData
[WARNING]       TopScope,
[WARNING]       ^
  • Where do i go to see the new api?
It would be cooler if i could do something like
<{computeTag(context)}>{computeTagContents(context)}</{computeTag(context}>

but i think that might be a parsing nightmare and so i'm guessing this isn't supported. i'd love to know if i'm wrong.

Best wishes,

--greg

--
L.G. Meredith
Managing Partner
Biosimilarity LLC
806 55th St NE
Seattle, WA 98105

+1 206.650.3740

http://biosimilarity.blogspot.com



--
Lift, the simply functional web framework http://liftweb.net
Beginning Scala http://www.apress.com/book/view/1430219890
Follow me: http://twitter.com/dpp
Git some: http://github.com/dpp



--
L.G. Meredith
Managing Partner
Biosimilarity LLC
806 55th St NE
Seattle, WA 98105

+1 206.650.3740

http://biosimilarity.blogspot.com
David Pollak
Joined: 2008-12-16,
User offline. Last seen 42 years 45 weeks ago.
Re: i can haz scala xml???


On Wed, Mar 4, 2009 at 1:16 PM, Meredith Gregory <lgreg.meredith@gmail.com> wrote:
David,

Thanks, but not quite. Unfortunately, i do not know the name of the tag. i have to compute it. So, your soln won't work. As i mentioned in my email, the following

<{computeTag(context)}>{computeTagContents(context)}</{computeTag(context}>   is a scheme for what i'd like to do, but it's probably too hard to make work.


Sorry for being dense about your question.

If you want to send me your file directly, I think I know what's going on (I think it's an import related issue...)
 


Best wishes,

--greg- Show quoted text -

On Wed, Mar 4, 2009 at 1:13 PM, David Pollak <feeder.of.the.bears@gmail.com> wrote:
scala> <fu><bar>5</bar></fu>res0: scala.xml.Elem = <fu><bar>5</bar></fu>
scala> <fu>{(1 to 3).map(i => <item>{i}</item>)}</fu> res1: scala.xml.Elem = <fu><item>1</item><item>2</item><item>3</item></fu>
Does that give you what you want (XML literals are part of the language)
On Wed, Mar 4, 2009 at 1:10 PM, Meredith Gregory <lgreg.meredith@gmail.com> wrote:
Sir and Dame Scalahads,

i was attempting to do something really simple-minded with scala.xml._ and it didn't perform according to Burak's tutorial. So, any clues about the following would be greatly appreciated.

  • When i type the following into Scala version 2.7.2.final repl, it all works
scala> scala.xml.Elem(null,"fu",null,scala.xml.TopScope,scala.xml.Elem(null,"bar",null,scala.xml.TopScope,scala.xml.Text("5")))
res9: scala.xml.Elem = <fu><bar>5</bar></fu>

scala>
  • But when i attempt to compile a similar expression in Scala version 2.7.3, it doesn't.
[WARNING] /Users/lgm/work/src/projex/bobj/dspace/src/main/scala/com/sap/dspace/model/othello/render.scala:26: error: type mismatch;
[WARNING]  found   : scala.xml.TopScope.type (with underlying type object scala.xml.TopScope)
[WARNING]  required: scala.xml.MetaData
[WARNING]       TopScope,
[WARNING]       ^
  • Where do i go to see the new api?
It would be cooler if i could do something like
<{computeTag(context)}>{computeTagContents(context)}</{computeTag(context}>

but i think that might be a parsing nightmare and so i'm guessing this isn't supported. i'd love to know if i'm wrong.

Best wishes,

--greg

--
L.G. Meredith
Managing Partner
Biosimilarity LLC
806 55th St NE
Seattle, WA 98105

+1 206.650.3740

http://biosimilarity.blogspot.com



--
Lift, the simply functional web framework http://liftweb.net
Beginning Scala http://www.apress.com/book/view/1430219890
Follow me: http://twitter.com/dpp
Git some: http://github.com/dpp



--
L.G. Meredith
Managing Partner
Biosimilarity LLC
806 55th St NE
Seattle, WA 98105

+1 206.650.3740

http://biosimilarity.blogspot.com



--
Lift, the simply functional web framework http://liftweb.net
Beginning Scala http://www.apress.com/book/view/1430219890
Follow me: http://twitter.com/dpp
Git some: http://github.com/dpp
Meredith Gregory
Joined: 2008-12-17,
User offline. Last seen 42 years 45 weeks ago.
Re: i can haz scala xml???
David,

Thanks for the attention to the problem. i resolved the issue. There was a missing param in my programmatic call: cut-n-pasto.

Best wishes,

--greg

On Wed, Mar 4, 2009 at 2:03 PM, David Pollak <feeder.of.the.bears@gmail.com> wrote:


On Wed, Mar 4, 2009 at 1:16 PM, Meredith Gregory <lgreg.meredith@gmail.com> wrote:
David,

Thanks, but not quite. Unfortunately, i do not know the name of the tag. i have to compute it. So, your soln won't work. As i mentioned in my email, the following

<{computeTag(context)}>{computeTagContents(context)}</{computeTag(context}>   is a scheme for what i'd like to do, but it's probably too hard to make work.


Sorry for being dense about your question.

If you want to send me your file directly, I think I know what's going on (I think it's an import related issue...)
 


Best wishes,

--greg- Show quoted text -

On Wed, Mar 4, 2009 at 1:13 PM, David Pollak <feeder.of.the.bears@gmail.com> wrote:
scala> <fu><bar>5</bar></fu>res0: scala.xml.Elem = <fu><bar>5</bar></fu>
scala> <fu>{(1 to 3).map(i => <item>{i}</item>)}</fu> res1: scala.xml.Elem = <fu><item>1</item><item>2</item><item>3</item></fu>
Does that give you what you want (XML literals are part of the language)
On Wed, Mar 4, 2009 at 1:10 PM, Meredith Gregory <lgreg.meredith@gmail.com> wrote:
Sir and Dame Scalahads,

i was attempting to do something really simple-minded with scala.xml._ and it didn't perform according to Burak's tutorial. So, any clues about the following would be greatly appreciated.

  • When i type the following into Scala version 2.7.2.final repl, it all works
scala> scala.xml.Elem(null,"fu",null,scala.xml.TopScope,scala.xml.Elem(null,"bar",null,scala.xml.TopScope,scala.xml.Text("5")))
res9: scala.xml.Elem = <fu><bar>5</bar></fu>

scala>
  • But when i attempt to compile a similar expression in Scala version 2.7.3, it doesn't.
[WARNING] /Users/lgm/work/src/projex/bobj/dspace/src/main/scala/com/sap/dspace/model/othello/render.scala:26: error: type mismatch;
[WARNING]  found   : scala.xml.TopScope.type (with underlying type object scala.xml.TopScope)
[WARNING]  required: scala.xml.MetaData
[WARNING]       TopScope,
[WARNING]       ^
  • Where do i go to see the new api?
It would be cooler if i could do something like
<{computeTag(context)}>{computeTagContents(context)}</{computeTag(context}>

but i think that might be a parsing nightmare and so i'm guessing this isn't supported. i'd love to know if i'm wrong.

Best wishes,

--greg

--
L.G. Meredith
Managing Partner
Biosimilarity LLC
806 55th St NE
Seattle, WA 98105

+1 206.650.3740

http://biosimilarity.blogspot.com



--
Lift, the simply functional web framework http://liftweb.net
Beginning Scala http://www.apress.com/book/view/1430219890
Follow me: http://twitter.com/dpp
Git some: http://github.com/dpp



--
L.G. Meredith
Managing Partner
Biosimilarity LLC
806 55th St NE
Seattle, WA 98105

+1 206.650.3740

http://biosimilarity.blogspot.com



--
Lift, the simply functional web framework http://liftweb.net
Beginning Scala http://www.apress.com/book/view/1430219890
Follow me: http://twitter.com/dpp
Git some: http://github.com/dpp



--
L.G. Meredith
Managing Partner
Biosimilarity LLC
806 55th St NE
Seattle, WA 98105

+1 206.650.3740

http://biosimilarity.blogspot.com

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