banxitan

          統(tǒng)計

          留言簿(2)

          閱讀排行榜

          評論排行榜

          xmlbeans dom level 3 not implemented

          今天在用XmlBeans解析XML DOC時,遇到“xmlbeans dom level 3 not implemented”的解決辦法!

          問題產(chǎn)生的原因:
              1、由于在生成的XML結(jié)構(gòu)中插入了一些未在XSD中定義的節(jié)點,那么這些節(jié)點無法用XMLBeans所采用的對象的方法獲取,只能采用DOM的方式來處理,但在處理的過程中報“xmlbeans dom level 3 not implemented”

          //
          實例化一個文檔構(gòu)建器工廠
          DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
          factory.setNamespaceAware(true);
          //通過文檔構(gòu)建器工廠獲取一個文檔構(gòu)建器
          DocumentBuilder builder = factory.newDocumentBuilder();
          //通過文檔通過文檔構(gòu)建器構(gòu)建一個文檔實例
          AssertionDocument assertionDoc = AssertionDocument.Factory.parse(new File(”xml/assertion.xml”), loadOptions);

          Document doc = builder.parse(new InputSource(new StringReader(assertionDoc.toString())));
          doc.getDocumentElement().setIdAttribute(”AssertionID”, true);


          posted on 2009-04-14 10:11 MikyTan 閱讀(825) 評論(0)  編輯  收藏 所屬分類: JAVA

          主站蜘蛛池模板: 新源县| 大名县| 开远市| 长子县| 马边| 临武县| 门源| 琼海市| 七台河市| 巴塘县| 芜湖县| 广宁县| 谢通门县| 抚远县| 安达市| 攀枝花市| 布尔津县| 黄骅市| 延庆县| 淮阳县| 镇平县| 沙洋县| 白城市| 介休市| 贵南县| 凌云县| 武平县| 广河县| 崇阳县| 虎林市| 巫溪县| 平湖市| 彭阳县| 天长市| 北碚区| 台中县| 通化市| 云阳县| 大化| 明光市| 常德市|