1. 程式人生 > >MyEclipse 下 the method getTextContent() is undefined for the type Element

MyEclipse 下 the method getTextContent() is undefined for the type Element

在myeclipse下

        pagefield = dc.createElement("Field");
        pagefield.setAttribute("Name", "glDate");
        pagefield.setAttribute("type", "Date");
        pagefield.setTextContent(glDate);

pagefield.setTextContent(glDate);
這行程式碼編譯報錯,提示
the method getTextContent() is undefined for the type Element

原因:
應該使用jdk的rt.jar,
卻使用了xml-apis.jar的。

解決方法:
右鍵專案,java build path,order and export,調整jdk在webAppLibrary的前面,重新編譯後完事。