Eclipse xdebug检查SimpleXMLElement

时间:2015-06-29 14:51:17

标签: eclipse simplexml xdebug

我正在使用xDebug和eclipse。当我使用simplexml_load_string加载有效的XML字符串时,如下所示:

public partial class ThisAddIn
{
    private void ThisAddIn_Startup(object sender, System.EventArgs e)
    {
        Application.ItemSend += new Outlook.ApplicationEvents_11_ItemSendEventHandler(Application_ItemSend);
    }

    void Application_ItemSend(object Item, ref bool Cancel)
    {

        Outlook.MailItem mail = Item as Outlook.MailItem;

        var atts = mail.Attachments;

        foreach (Outlook.Attachment attachment in atts)
        {
            MessageBox.Show(attachment.PathName); // the PathName is null !
        }
    }

    private void ThisAddIn_Shutdown(object sender, System.EventArgs e)
    {

    }
}

我似乎无法检查SimpleXMLElement变量。当我深入研究变量时,没有任何显示。在下面的屏幕截图中,我尝试深入研究$ responseXML,但没有显示:

eclipse debugger variables tab

我绝对可以访问我知道的变量:

$responseXml = simplexml_load_string($response);

以下是我的xdebug设置。

xdebug settings

有什么想法吗?

1 个答案:

答案 0 :(得分:1)

这是因为SimpleXMLElement有一些内部序列化方法。 print_r和var_dump将产生相同的结果。 调试它的最佳方法是使用以下命令将其转换为字符串:

$responseXml->asXML()