1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Donation with Paypal!!!

    Go to your paypal account and send directly donation to [email protected]

    1 month - 10 $ - Standart VIP

    6 months - 20 $- Standart VIP

    1 year - 30 $- Standart VIP

    2 years - 50 $- Standart VIP

    Gold member for life - 150 $- Standart VIP

    High Vip (Standart VIP include) group please send PM or email to [email protected] for info

    After Donation please send email to [email protected]

  3. Donation Ways 2020


    Paysend
  4. Telegram
Dismiss Notice

Donation with Paypal!!!

Go to your paypal account and send directly donation to [email protected]

1 month - 10 $ - Standart VIP

6 months - 20 $- Standart VIP

1 year - 30 $- Standart VIP

2 years - 50 $- Standart VIP

Gold member for life - 150 $- Standart VIP

High Vip (Standart VIP include) group please send PM or email to [email protected] for info

After Donation please send email to [email protected]

Dismiss Notice
For open hidden message no need write thanks, thank etc. Enough is click to like button on right side of thread.

VerySimpleXML – a lightweight Delphi XML reader and writer

Discussion in 'Delphi Components,Freeware, Open Source' started by AdminDF, May 23, 2014.

  1. AdminDF
    Online

    AdminDFAdminDF is a Verified Member Delphifan Staff Member DF Staff

    Now here comes another one: VerySimpleXML – a lightweight, one-unit XML reader/writer in under 500 600 lines of code. Use it for small well-formed XML files (like configuration files, etc.).

    hanged class name to reflect unit naming (class is now called
    TXmlVerySimple instead TVerySimpleXml)
    - it uses TStreamReader to read line by line instead of reading the
    whole file at once (this allows parsing of big xml files with little
    additional memory)
    - automatically escapes/unescapes not allowed chars (>, <, ", &), thus
    removes the most-hated "- escaping introduced in v1.0

    Some usage examples:

    Code:
    uses Xml.VerySimple;
     
    var
      Xml: TXmlVerySimple;
      Node, Child: TXmlNode;
    begin
      Xml := TXmlVerySimple.Create;
      Xml.LoadFromFile('example.xml');
      Xml.Root.Find('book', 'id', 'bk102').Find('author').Text := 'Dein, Carol';
      Node := Xml.Root.AddChild('book');
      Child := Node.AddChild('author');
      Child.Text := 'Barger, Al';
      Child.Attribute['type'] := 'topseller';
      Node.AddChild('title').SetAttribute('lang', 'en').SetText('A big View');
      Xml.SaveToFile('output.xml');
      Xml.Free;
    end;

    VerySimpleXML supports just a subset of the XML specification

    load and save from stream or file
    nodes, childs and attributes
    UTF-8 and ANSI encoding
    compact output by setting Xml.Ident := ”;
    method chaining
    “>” and “>” inside text and attribute values when wrapped in quotation marks (XML-spec requires you to transform them into < etc.)now automatically escaped with v1.1
    It does NOT support:

    CDATA, comments, etc…
    Example XML-file:

    Code:
    <?xml version="1.0" encoding="utf-8" ?>
    <catalog>
      <book id="bk101">
        <author>Gambardella, Matthew</author>
        <title/>
        <keywords />
      </book>
      <book id=bk102 lang="en">
        <author>Ralls, Kim</author>
        <title>Midnight Rain</title>
        <description>A former architect battles corporate zombies</description>
        <keywords>
          <keyword lang="es">no-muerto</keyword>
          <keyword lang=en>zombies</keyword>
        </keywords>
      </book>
      <book id="bk103">
        <author rate=">5">Corets, Eva</author>
        <title>Maeve Ascendant</title>
        <description>The collapse of a <nanotechnology> society</description>
      </book>
    </catalog>
    Download HERE
     
  2. mopkrayz
    Offline

    mopkrayz DF Junior

    RE:

    is this better than TXMLDocument ?
     
  3. AdminDF
    Online

    AdminDFAdminDF is a Verified Member Delphifan Staff Member DF Staff

    i dont know i dont try this include have just one pas file for use.
    If you wish you can try this and share result with us :D
     

Share This Page