The Eastmure king courted her for gold,
And the Westmure king for fee,
The king of Onore for womanheid,
And for her fair beautie.
is Child Ballad
Shortly after the king and queen marry for love, the king is attacked — by rebellious nobles or a rival in love. The king is killed. The queen is told that if she is pregnant with a daughter, she will be allowed to live, but a son will be killed.
In advanced pregnancy, she gets her guards drunk and flees, giving birth to a son in a pigsty. Wise William finds her, and she begs him to exchange his newborn daughter for her son. When the boy is growing up, Wise William tells him of his family. He kills the killer, frees his mother, and marries the girl he was substituted for.
Francis Child's variants found here