The Xuanwu gate incidence is a rather famous incidence in China’s history. I wasn’t aware of this piece of history until recently. I started to read about the incidence from Chinese web source. The following passages were sourced from Baike sites (Chinese equivalent of Wiki pages). The original materials were rather disjointed as they were contributed by several writers.
617年，李渊在李世民支持下在太原起兵反隋并很快占领长安。618年，隋炀帝被杀之后，李渊建立唐朝，并立世子李建成为太子。据说太原起兵是李世民的谋略(mou2 lv4)，李渊曾答应他事成之后立他为太子。但天下平定后，李世民功名日盛，李渊却犹豫不决 (you2 yu4 bu4 jue2)。李建成随即联合李元吉，排挤(pai2 ji3)李世民。李渊的优柔寡断 (you rou2 gua3 duan4)，也使朝中政令相互冲突，加速了诸子的兵戎 (bing rong2) 相见。
"元"、"吉"二字，合之颇类"唐"字，故元吉自命有天子之份，觊觎 (ji4 yu2) 大位已久，建成懦弱 (nuo4 ruo4)不成事，忌惮 (ji4 dai4)者惟秦王而已。元吉欲先假建成之手除去(chu2 qu4)秦王，再除建成以自代，终宵谋画。
My translation efforts:
In year 617, Li Yuan (who would become Tang dynasty founder) with his second son( Li Shimin) in Taiyuan started an uprising and rebelled against the Sui dynasty and quickly occupied Changan. In 618, after Sui Emperor Yangdi was killed, Li Yuan established the Tang dynasty, while his eldest son Li Jiancheng became the crown prince. The establishment of the rebel army troop in Taiyuan was mainly due to contributions by Li Shimin, and Li Yuan promised to make him the crown prince if the quest became successful. Even after peace and order were restored and Li Shimin ‘s fame raised day by day, Li Huan waivered in making him the crown prince. Li Jiancheng then formed an alliance with younger brother, Li Yuanji to counter Li Shimin. The indecision by Li Huan, and also the royal court orders that were contradictory, accelerated the armed conflicts between the sons.
Li Yuan had four sons, Jiancheng, Shimin, Yuanji, Yuanba. Li Yuanba died at early age. Jiancheng was conferred King of Ying, Shimin conferred King of Qin, Yuanji conferred with King of Qi . Jiancheng, Yuanji and Li Huan’s favourite concubine (Zhang Yanxue) collaborated on profitable dubious ventures, but Li Shimin opposed them. After these events, the enmity and hatred between them became deepen. In accordance to the succession rule, Li Jiancheng would succeed when Li Yuan passed away. However, the enormous contribution made by second son Li Shimin, where he was involved in nearly all battles to claim the land for the Great Tang dynasty, and received the frequent praises and rewards from the Emperor, make Jiancheng and Yuanji envious and hate him more.
元"(yuan)、"吉"(ji) are two characters when combined somewhat resemble 唐 or Tang character, and thus Li Yuanji believed himself destined one day to be the Emperor. He passionately yearned to be one. Li Jiancheng was weak and unable to get things done, and was afraid of Li Shimin. Li Yuanji had planned to use elder brother Jiancheng to get rid of Li Shimin first, and then eventually get rid of Jiancheng himself. When Princess Pingyang died of illness, Jiancheng and Yuanji had pretext to hold a feast for important officials and relatives at the funeral wake, whereby Li Shimin was invited for a toast. The wine contained poison. Li Shimin who was open and generous by nature, merely thought that Jiancheng and Yuanji were offering apologies for past mistakes made, and thus raised his cup and drank the wine. He had a small mouthful, when a swallow flew overhead and a dropping hit his cup and dirtied his clothes. He left to change clothes and suddenly felt pain in the belly. Upon reaching home, he had loose bowel the entire night, and vomited voluminous amount of blood. He then realised that there was something fishy in the wine. Their father (the Tang Emperor Li Yuan) upon hearing this news, feared that the brothers wouldl never be able to get along with each other. The Emperor hoped to make Li Shimin (King of Qin) moved to Luoyang, where he would be the ruler the area around east Shanxi, just like the filial King Liang of Han dynasty days.
Jiancheng and Yuanji were afraid, knowing that Li Shimin was courageous and had boundless ambition. He had many able civil and military officials under him ( Zhangsun Wuji, Xu Maogong, Li Chinfeng, Fang Xuanling etc) who will one day rule the throne with him if not stopped. They planned that when Li Shimin succumbed to poison, the officers serving under Li Shimin would be sent to an expedition to fight against the Tupei (a Turkic group).
Li Jiancheng suggested to the Emperor to appoint Li Yuanji as the commander in chief in the battle against Tupei. This would merely serve as an excuse to get wield of troops serving under King of Qin (Li Shimin), and thus presenting an opportunity to eliminate Li Shimin. At the critical moment, Li Shimin decided on the fight to death (lit. back facing the river) and take the initiative against opponents. He seek audience with Li Yuan to denounce the plot against him by Li Jiancheng and Li Yuanji. The Empire then decided to enquire from the two, on the next day. Hearing that the plot has been revealed, Li Jiancheng decided to enter the palace early to compel Li Yuan to declare his position. However, the palace north gate (Xuanwu gate) watch guard officer and his subordinates have already been successfully bought and collaborated with Li Shimin.
Li Jiancheng and Li Yuanji were early on the following day with four or five hundred followers, waiting at the Xuanwu Gate. They were waiting to kill Li Shimin. Unknown to them, Li Shimin had already made preparation , his body was protected with armour . When Li Jiancheng and Li Yuanji saw Li Shimin, they shot three arrows at him, but he managed to avoid them. Li Shimin returned an arrow shot an killed Li Jiancheng. Li Yuanji ran way on seeing this, but was killed by a general with another arrow shot. This incidence is called the Xuanwu Gate incidence.