IXMLNodeList中的命名空间

时间:2013-01-31 01:07:45

标签: delphi delphi-xe2

我需要为节点添加前缀,但是在接口中定义的IXMLNodeList中还添加了NameSpace,并且需要在所有节点上使用前缀

  if Length(cds_Partes.FieldByName('Nota').AsString) > 0 then
     Nota.Add( cds_Partes.FieldByName('Nota').AsString);
   OtrosCargos .Add.Codigo := 'V6';
   OtrosCargos.Items[0].Monto :=  cds_Traslado.FieldByName('Importe').AsString;

接口

 function Get_Proyecto: IXMLFactura_proyecto;
 function Get_Nota: IXMLNotasList;
 function Get_CargosCreditos: IXMLFactura_cargosCreditosList;
 function Get_OtrosCargos: IXMLFactura_otrosCargosList;
 .........

function Getfactura(Doc: IXMLDocument): IXMLFactura;
 begin
  Result := Doc.GetDocBinding('PPY:factura', TXMLFactura, TargetNamespace) as    IXMLFactura;
end;

function Loadfactura(const FileName: string): IXMLFactura;
begin
 Result := LoadXMLDocument(FileName).GetDocBinding('PPY:factura', TXMLFactura,  TargetNamespace) as IXMLFactura;
end;

function Newfactura: IXMLFactura;
 begin
  Result := NewXMLDocument.GetDocBinding('PPY:factura', TXMLFactura, TargetNamespace) as IXMLFactura;
end;    

结果

 <PPY:destino codigo="8476" nombre="PLANTA DE MOTORES 4 CILINDROS - SALTILLO"/>

 <nota xmlns="http://www.dfdchryslerdemexico.com.mx/Addenda  /PPY">Addenda de  Prueba</nota>

 <otrosCargos xmlns="http://www.dfdchryslerdemexico.com.mx/Addenda/PPY" codigo="V6" monto="1373.93"/>

前缀存在于目标节点中,而不是节点NOTA和OTROSCARGOS,

在什么时候添加了NameSpace?

非常坦克

0 个答案:

没有答案