He was a government minister and court advisor to Marquis Wen of Wei (reigned 445–396 BC) during the Warring States period of ancient China.
[1] Although the earlier statesman Sunshu Ao is credited as China's first hydraulic engineer (damming a river to create a large irrigation reservoir), Ximen Bao is nonetheless credited as the first engineer in China to create a large canal irrigation system.
Ultimately though, the purpose of this enormous project of engineering was to irrigate a large agricultural region of Henei (in the left lower Yellow River basin) by providing it with a natural contour canal.
Due to several setbacks (including some temporary local resistance to corvee labor service) it was not fully completed until a century later, during the time of Wen's grandson, King Xiang (襄王) (r. 319–296 BC).
To Ximen's surprise, instead of naming the flooding as their biggest challenge, locals told him it was the high taxes they had to pay for providing a bride for Hebo, the River God - it was severely draining their finance and for those who have young daughters, lived in fear.
The cabal heavily taxed the county, used a small portion of the money to arrange for the bridal ceremony and divided the rest for themselves.
In honor of the Zhang River diversion project, the local populace made a popular song about it, as recorded in the historical work of the later Han dynasty historian Ban Gu.