0

I am writing a function like this:

def contractXML[T](element:T):Elem = {
      element match {
        case element:Contract => <element> ABC </element>
    ......

How do I make the tag take in the element value from the parameter passed to contractXML function rather than just literally print just

<element> 

?

Currently, it gives the error:

not found: value <
5
  • I don't understand the question. What do you refer to with "tag"? If I take <element> ABC </element>, this is legal Scala code and compiles fine, so if you get not found: value <, you must be doing something different from what you pasted above... Commented Dec 9, 2013 at 11:27
  • I do not want it to take the string 'element' literally. I want it to take the value of the element and make an XML tag out of it. Commented Dec 9, 2013 at 11:30
  • You will to specify type Contract actually is. Does it convert to a string? Commented Dec 9, 2013 at 12:01
  • I think I got what I was looking for.link Thanks anyway :) Commented Dec 9, 2013 at 15:35
  • Okay, so [This was what I was looking for][1] [1]: stackoverflow.com/questions/2530907/… Commented Dec 9, 2013 at 15:37

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.