Host of Tag

So there are two ways since you are potentially dealing with two conditions. Either the tag is tagging an element in a host file or a linked file. To get the element being tagged that is in the host file just use this code:

elementId = tag.TaggedLocalElementId

and then you can use the returned value to select the element:

element = doc.GetElement(elementId)

Now if you are dealing with linked models and you want the element from a linked model do this:

linkelementId= tag.TaggedElementId

and then again to get the element:

element = linkedDoc.GetElement(linkelementId)

To read text value from the tag just do:

tag.TagText

This should do.