 It is Aarne-Thompson type 310, the Maiden in the Tower.A version of the tale also appears in "A Book of Witches", by Ruth Manning-Sanders.Italo Calvino included a variant Prezzemolina in his "Italian Folktales".