xml reader
1.0.2
A instalação é feita usando a linha de comando boss install :
boss install viniciussanchez/xml-readerSe você optar por instalar manualmente, basta adicionar as seguintes pastas ao seu projeto, no projeto> Opções> Compilador de Recursos> Diretórios e Condicionais> Inclua Caminho de Pesquisa de Arquivos
../xml-reader/src
uses Xml.Reader; var
LXmlReader: IXmlReader;
begin
LXmlReader := TXmlReader.New.LoadFromFile( ' C:xmlnfe.xml ' );
end ; var
LXmlReader: IXmlReader;
begin
LXmlReader := TXmlReader.New.LoadFromString( ' my xml here! ' );
end ; begin
Result := LXmlReader.Version;
end ; begin
Result := LXmlReader.Encoding;
end ; var
LMainNode: IXmlNode;
begin
LMainNode := LXmlReader.Node;
end ; var
LNode: IXmlNode;
begin
for LNode in LMainNode.Nodes do
// my code here!
end ; var
LAttribute: IXmlAttribute;
begin
for LAttribute in LMainNode.Attributes do
// my code here!
end ; var
LElement: IXmlElement;
begin
for LElement in LMainNode.Elements do
// my code here!
end ; var
LNode: IXmlNode;
LElement: IXmlElement;
LAttribute: IXmlAttribute;
begin
// get the name of a node
LNode. Name ;
// check if the node has an attribute
LNode.ContainsAttribute( ' attribute name ' );
// check if the node has a node
LNode.ContainsNode( ' node name ' );
// check if the node has an element
LNode.ContainsElement( ' element name ' );
// get the value of an attribute from a node
LNode.GetAttribute( ' attribute name ' );
// get a node from a node
LNode.GetNode( ' node name ' );
// get the element of a node
LNode.GetElement( ' element name ' );
// get the attributes of a node
LNode.Attributes;
// get the elements of a node
LNode.Elements;
// get the nodes of a node
LNode.Nodes;
// get the name of an element
LElement. Name ;
// get the value of an element
LElement. Value ;
// get the value in string format from an element
LElement.AsString;
// get the value in integer format of an element
LElement.AsInteger;
// get the name of an attribute
LAttribute. Name ;
// get the value of an attribute
LAttribute. Value ;
// get the value in string format of an attribute
LAttribute.AsString;
// get the value in integer format of an attribute
LAttribute.AsInteger;
end ; XML Reader é um software gratuito e de código aberto licenciado sob a licença do MIT.