I also noticed that in Android Open Source Code here they have directly typecasted xmlNodePtr to xmlDtdPtr. Is this possible? If yes, we can get ExternalID and SystemID from xmlDtdPtr.
Curious to know that since xmlDtdPtr and xmlNodePtr and two different structs with different members, during the cast, how does compiler initialise members like ExternalID, SystemID, notations, elements etc. which are not present in xmlNodePtr?
For DTD nodes, the struct is actually an xmlDtd whose address is then cast to an xmlNodePtr. So you’re just casting back to the original type. Some members like type are in the same position, so they can be accessed regardless of type.