本帖最后由 apiaoz 于 2011-09-08 23:51:43 编辑

解决方案 »

  1.   


    SELECT APPENDCHILDXML (
              APPENDCHILDXML (
                 APPENDCHILDXML (
                    APPENDCHILDXML (
                       Xmltype (
                          '<?xml version="1.0" encoding="gb2312"?><Document></Document>'),
                       '/Document',
                       XMLELEMENT ("FileInfo", XMLFOREST ('z3' AS "xn",
                                                          '3321' AS "xh",
                                                          'dl' AS "yj",
                                                          'csb' AS "dw"))),
                    '/Document',
                    XMLELEMENT ("Compend",
                                Xmlattributes ('0' AS "ID", '1' AS "No"))),
                 '/Document',
                 XMLELEMENT ("Compend",
                             Xmlattributes ('1' AS "ID", '12' AS "No"))),
              '/Document/descendant::Compend[@ID=0 and @No=1]',
              XMLELEMENT ("Text",
                          Xmlattributes ('1' AS "ID", 'nn' AS "Name"),
                          'AA'))
              AS Xxml
      FROM DUAL;XXML                                                                            
    --------------------------------------------------------------------------------
    <?xml version="1.0" encoding="BIG5"?><Document><FileInfo><xn>z3</xn><xh>3321</xh
    ><yj>dl</yj><dw>csb</dw></FileInfo><Compend ID="0" No="1"><Text ID="1" Name="nn"
    >AA</Text></Compend><Compend ID="1" No="12"/></Document>  沒問題吧