Essentially, yEd determines the size of labels by quering the Java platform for the width and height of the label's text when rendered with the label's font.
However, other properties such as label Insets and Size policy also factor into the actual label width and height.
Unfortunately, XGML is a fairly simple format that does not store insets or size policies. Thus the best you can do is creating a java.awt.Font corresponding to the data in XGML's LabelGraphics section and using Java's font measuring utilities to determine the width and height of your label's text while assuming default values for insets and size policy. This means that you cannot accurately calculate label width/height in some cases like e.g. group node labels whose size usually depends on the width of the corresponding group node.
Consequently, a much better approach would be parsing GraphML instead of XGML. GraphML actually stores the label's width and height, thus width/height calculations are not necessary at all. Of course, GraphML is much more complex than XGML, but the reason for the additional complexity is the fact that GraphML stores a lot more information than XGML.
Please note, since label width and height usually depend on the font used for rendering the label and font measuring and rendering is highly operating system dependent, the values for width/height of a label may differ in GraphML files that were created e.g. on Windows and Linux even though all "primary" label properties (i.e. text, insets, size policy) are the same.