A few more null guards (XElement extensions).

Lowercase lookup for type ids.