A xref is like a 'Insert' as it copies the entites into a BlockTableRecord
Take a look at XrefGraph Class
Here is a quick example of printing all Mtext and Dbtext to the command line of a xref that name ends with TitleBlock.dwg
[CommandMethod("XRefMtextAndDBTextValues")]
public void XRefMtextAndDBTextValues()
{
Document doc = Application.DocumentManager.MdiActiveDocument;
Database db = doc.Database;
Editor ed = doc.Editor;
using (Transaction trx = db.TransactionManager.StartTransaction())
{
BlockTable blocktable = trx.GetObject(db.BlockTableId, OpenMode.ForRead) as BlockTable;
foreach (ObjectId objId in blocktable)
{
BlockTableRecord btr = (BlockTableRecord)trx.GetObject(objId, OpenMode.ForRead);
if (btr.IsFromExternalReference && btr.PathName.EndsWith("TitleBlock.dwg"))
{
foreach (ObjectId id in btr)
{
if (id.ObjectClass == RXClass.GetClass(typeof(MText)))
{
MText txt = (MText)trx.GetObject(id, OpenMode.ForRead);
ed.WriteMessage("\n{0}", txt.Text);
}
if (id.ObjectClass == RXClass.GetClass(typeof(DBText)))
{
DBText txt = (DBText)trx.GetObject(id, OpenMode.ForRead);
ed.WriteMessage("\n{0}", txt.TextString);
}
}
}
}
trx.Commit();
}
}