BEIJING — In a crowded Chinese neighborhood, she suffered the loneliest of deaths.

She was trapped and forgotten in a broken elevator of her apartment building for more than a month before her body was discovered last week. She had a hand pressed against the door, some accounts said.

But now this death in Xi’an — the northwestern city famed for its ancient entombed terra-cotta warriors — has stirred protest and a nationwide roar of anger by people furious that lax building management can turn trivial acts, like riding an elevator, into fatal traps, news reports and Internet accounts said on Monday.

Hundreds of residents in the Gaoling District of the city, where the woman died confined between the 10th and 11th floors of her apartment building, gathered to rally last week, according to photographs and accounts on Chinese websites. Other pictures were said to be of the police, some in riot gear, lined up against the crowd.