Xing Wenwei (Chinese: 邢文偉) (died 690?[1]) was an official of the Chinese Tang dynasty, serving as a chancellor during the first reign of Emperor Ruizong and his mother Wu Zetian's Zhou dynasty.
It is not known when Xing Wenwei was born, but it was known that his family was from Chu Prefecture (滁州, roughly modern Chuzhou, Anhui), and that he, along with two other men from nearby prefectures, Gao Zigong (Chinese: 高子貢) and Pei Huaigui (Chinese: 裴懷貴), were known for their knowledge throughout the region. About 672, during the reign of Emperor Gaozong, Xing was serving as a secretary in charge of food supplies for the palace of Emperor Gaozong's crown prince Li Hong. At that time, Li Hong rarely met with his staff members, and Xing reduced the food supplies to Li Hong and submitted petitions to him, arguing that it was inappropriate for him not to meet staff members. Li Hong wrote a humble letter back to Xing, explaining that he did not meet with staff members because he was often ill and because he was often attending to Emperor Gaozong, but thanking Xing for his suggestions. Soon thereafter, Emperor Gaozong needed an imperial chronicler, and he commented, "Xing Wenwei, while serving my son, was able to use the reduction of food to get my son to correct his ways; this shows that he is an upright man." He promoted Xing to the imperial chronicler post.
Emperor Gaozong died in 683 and was succeeded by his son Li Zhe the Crown Prince (as Emperor Zhongzong) (Li Hong having predeceased his father in 675), but Emperor Gaozong's powerful wife Empress Wu (later known as Wu Zetian) retained actual power as empress dowager and regent. In spring 684, after he showed signs of independence, she deposed him and replaced him with his younger brother Li Dan the Prince of Yu (as Emperor Ruizong), but thereafter wielded power even more firmly. During her regency, Xing Wenwei was promoted to the post of Fengge Shilang (Chinese: 鳳閣侍郎) -- the deputy head of the legislative bureau of government (鳳閣, Fengge), and also served as an imperial scholar at Hongwen Pavilion (Chinese: 弘文館). In 689, he was given the designation Tong Fengge Luantai Pingzhangshi (Chinese: 同鳳閣鸞臺平章事), making him a chancellor de facto. In 690, he was made acting Neishi (Chinese: 內史) -- the head of the legislative bureau and a post considered one for a chancellor. When Empress Dowager Wu held a grand ceremony at the newly constructed imperial meeting hall (明堂, Ming Tang) later that year, she had Xing publicly recite the Xiao Jing as part of the ceremony.
Later in 690, Empress Dowager Wu had Emperor Ruizong yield the throne to her, and she took the throne as "emperor" of a new Zhou dynasty, interrupting Tang dynasty. Xing continued to serve as chancellor. However, later that year, when the chancellor Zong Qinke was accused of corruption and exiled, Xing was accused of being an associate of Zong's and demoted to be the prefect of Zhen Prefecture (珍州, roughly modern Zunyi, Guizhou). Soon after his demotion, there was an imperial messenger sent to Zhen Prefecture, and Xing, believing that the messenger must be sent to arrest him, committed suicide by hanging.