The Court Jester

Set in medieval England, the plot concerns the struggle to restore to the throne the rightful heir, a baby with a distinguishing birthmark, the purple pimpernel on his posterior. Danny Kaye plays Hubert Hawkins, an ex-carnival entertainer who becomes minstrel to the Black Fox, a Robin Hood-type character who leads a band of rebels in the forest in support of the true infant-king.
The usurping King Roderick (Cecil Parker) wishes his daughter, Princess Gwendolyn (Angela Lansbury), to marry his neighbour, Sir Griswold of MacElwain (Robert Middleton), and to enlist Griswold's aid against the band of forest rebels. Princess Gwendolyn refuses, since she dreams of a more handsome, gallant lover, and her personal maid Griselda (Mildred Natwick), who is a witch, has predicted that her true love will arrive at the castle to court her. The Griswold marriage plan also displeases Lord Ravenhurst (Basil Rathbone), who fears that Griswold's presence may cost him his privileged position with the king.
The Black Fox orders Hawkins to carry the infant-king across the country to safety, accompanied by his captain, the maid Jean. On the journey, a romance blossoms between Hawkins and Jean. They encounter the King's new jester, "Giacomo, 'King of Jesters and Jester of Kings'" (John Carradine) on his way to the castle. They knock him out and Hawkins impersonates him, hoping to gain entry to the King's castle. He is assigned to steal the key to a secret passage into the castle, through which the Black Fox could then attack. However, Hawkins is unaware that the jester he is impersonating is also a famous assassin whom Lord Ravenhurst plans to employ to murder his rivals at court: Brockhurst, Finsdale, and Pertwee.
Upon Hawkins' arrival, Griselda hypnotizes him and changes his personality for that of a gallant, dashing lover, who sneaks into the Princess Gwendolyn's chambers and wins her affections, though he rapidly switches in and out of this personality whenever anyone (including himself) snaps their fingers. Maid Jean is captured on the road by the King's men, who have been sent to round up pretty young girls to decorate the upcoming tournament. The King meets her and takes a fancy to her. She obtains the key to the secret passage by picking his pocket, and passes it along to Hawkins, but in his hypnotized state Hawkins does not remember her or his original mission until he is freed from Griselda's spell, and thus accidentally loses the key back to the king. In order to prevent Princess Gwendolyn from being forced to marry Griswold, Griselda poisons Ravenhurst's competitors Brockhurst, Finsdale and Pertwee, who had supported the proposed match. Ravenhurst mistakenly credits Hawkins for these murders. Later, however, Ravenhurst learns that Hawkins is not in fact the jester/assassin Giacomo, but an imposter, and swiftly suspects him to be the Black Fox himself.
During the evening banquet, Sir Griswold arrives to solidify his alliance with the king. However, Gwendolyn openly declares her love for the jester, and the enraged King orders Hawkins' death. Griswold announces that, if "Giacomo" were a knight rather than a common clown, he would challenge him to mortal combat. With the intent of having the "Black Fox" get rid of Griswold, Ravenhurst counsels the King that he can get rid of the jester by making him a knight, who would then have to fight Sir Griswold and would surely be killed, thus forcing Gwendoline to marry the victor. A series of comic scenes ensues in which the king's men help Hawkins to rapidly pass through the various trials required to become a knight.
Jean uses her confidence with the king to steal back the key and send it to the forest rebels by carrier-pigeon. She also tries to save Hawkins by asking the Black Fox to substitute for him in the joust. But just before the rebels can use the secret passage, it collapses, leaving only a small crawlspace, just large enough for dwarves to pass through. The Black Fox decides to summon Hawkins' friends, a troupe of acrobatic dwarfs from Hawkins' carnival days, and sends them through the passage for a diversionary attack.
Meanwhile, in the castle, Hawkins is hastily knighted, and Griswold immediately challenges him to a joust to the death. Griselda tries to save him by poisoning one of the drinks to be used for the toast immediately before the joust, but Griswold also learns of the poison, and after a quarrel between the two combatants over who should drink which drink, the toast is cancelled. Against all odds (mostly due to a lightning bolt which magnetizes his armor), Hawkins wins the joust, but spares Griswold's life.
Ravenhurst denounces Hawkins and Maid Jean as imposters. Hawkins's dwarf friends, who have entered the castle through the secret passage, rescue him and capture the castle from the King's soldiers. During this battle, Ravenhurst attacks Hawkins with a sword. Griselda hastily enchants Hawkins again, giving him expert prowess in fencing (again switching between novice and expert at a finger-snap). Hawkins and Ravenhurst fight, and Ravenhurst is finally hurled into the sea by a catapult.
Griswold returns to defend the King, but Hawkins reveals the infant king's birthmark to him, as well as to the usurper Roderick and his few surviving soldiers. Overcome with remorse, everyone in the castle pledges allegiance to the true infant-king, and Hawkins leads everyone in one last chorus of "Life could not better be".

Question: who attacks Hawkins with a sword?
Answer: Ravenhurst; Ravenhurst