This questions is related to this thread regarding the use of XML combinator which is part of the Google’s Scala gdata client library found here
-
In the code posted, there was no parameter for elem(“segment”…) Wouldn’t this cause compiler to complain something like “could not find implicit value for parameter ns: (String, String)”
-
How do you generate XML elements without each tag having a name space prefix added. For example, the code I generated looks like:
<yt:entry xmlns:yt="http://gdata.youtube.com/schemas/2007"> <yt:title type="TextType">MyTitle</yt:title> <yt:summary>My Summary</yt:summary> </yt:entry>
But I don’t want each tag to have the namespace prefix!! How do I use the combinator to generate such XML.
Here is what my pickler looks like:
def pickler: Pickler[YtPlaylist] = {
(wrap (elem("entry",
elem("title", text ~ attr("type", text))
~ elem("summary", text))(Uris.ytNs))
(YtPlaylist.apply)
({p => new ~(p.title, p.titleType) ~ p.summary}))
}
case class YtPlaylist(title: String, titleType: String, summary: String)
The example I found on the web doesn’t specify the namespace, but without it I always gets compilation error. How do I generate XML elements without namespace??
Yes, you will need to define a namespace. Use the
nullprefix to define the default namespace: