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

xml : unique elements?

1 reply
Michael Fortin 2
Joined: 2010-08-29,
User offline. Last seen 42 years 45 weeks ago.

Hello,

I have this class where I'm generating an ivy configuration file. This version works except if I add the conf="" attribute to the dependency element like , it seems to automatically filter out duplicates. So without it, I get 12+ dependencies, with it, I only get three because there are three unique conf values. Is this the desired behavior? How can I make sure all of the dependencies will be included?

PS. Oddly, if I change the name of conf to cx, it outputs all dependencies, but obviously i can't run it in ivy.

thx,
Mike

/// class
class IvyXml(config:WebAppConfig) {

val ivy =

*,!sources,!javadoc" defaultconf="default">
{for(dp <- config.dependencies) yield

}

def saveToFile(path:String) = {
println("ivy: " + ivy)
XML.save(path, ivy, "UTF-8", true, null)
}
}

Alex Cruise
Joined: 2008-12-17,
User offline. Last seen 2 years 26 weeks ago.
Re: xml : unique elements?


On Tue, Sep 7, 2010 at 5:44 PM, Michael Fortin <mikee@m410.us> wrote:
Hello,

I have this class where I'm generating an ivy configuration file.  This version works except if I add the conf="" attribute to the dependency element like <dependency org={dp.org.get} name={dp.name.get} rev={dp.rev.get} conf={dp.conf.get} />, it seems to automatically filter out duplicates.  So without it, I get 12+ dependencies, with it, I only get three because there are three unique conf values.  Is this the desired behavior?   How can I make sure all of the dependencies will be included?

 ...  
 
 <dependencies defaultconfmapping="*->*,!sources,!javadoc" defaultconf="default">
   {for(dp <- config.dependencies) yield
   <dependency org={dp.org.get} name={dp.name.get} rev={dp.rev.get} />
   }
 </dependencies> 
 
... 
 

What's the type of config.dependencies?  If it's a Set, and if Elem.hashCode is buggy (I haven't looked at it yet), you might see this kind of behaviour.
-0xe1a

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