Escape

Top  Previous  Next

Prototype

 

strANSI:=Escape(strXML)

 

Description

 

Convert an XML string in a ANSI string

 

Parameters

 

strXML: XML string to convert.

 

Returned Value

 

strANSI: Output ANSI string

 

Note

 

None

 

Example

 

XMLFileName:='C:\Recogniform\xml\new.xml';

XMLIn:=XMLOpenDocument(XMLFilename);

if XMLIn<>0 then

begin

  //It finds root node

  Root:=XMLFindNode(XMLIn, 0,'d\p');

  //It counts all nodes

  RootChildCount:=XMLGetNodesCount(XMLIn,Root);

  for i:=0 to RootChildCount-1 do

  begin

    //It gets i-th node handle

    Child:=XMLGetNode(XMLIn, Root, i);

    //It gets node name

    NodeName:=XMLGetNodeName(XMLIn, Child);

    if NodeName='w' then

    begin

     //It gets node value and attribute

     NodeText:=XMLGetNodeText(XMLIn,Child);

     AttNodeText:=XMLGetNodeAttribute(XMLIn,Child,'l');

     //It logs node and attributes value

     ApplicationLog('Node: '+NodeText+' has following attribute '+AttNodeText);

    end

    else XMLDelNode(XMLIn,Child);

  end;

  //It gets XML document string

  StrFileXML:=XMLGetAsString(XMLIn);

  //Convert XML string

  StrConvert:=Escape(StrFileXML);

  //It logs ascii string

  ApplicationLog(StrConvert);

end;