All Projects → mdbs99 → xavier

mdbs99 / xavier

Licence: MIT license
Xavier is a small object-oriented XML library for Lazarus and Delphi

Programming Languages

pascal
1382 projects
C++
36643 projects - #6 most used programming language

Projects that are alternatives of or similar to xavier

TLightFileStream
Implements a lightweight, high-performance, non-allocating advanced-record-based wrapper around the SysUtils file handling routines as an alternative to Classes.TFileStream.
Stars: ✭ 21 (-44.74%)
Mutual labels:  lazarus, freepascal, object-pascal
fano
Pascal web application framework
Stars: ✭ 90 (+136.84%)
Mutual labels:  freepascal, object-pascal
Axes-Armour-Ale
A fantasy, ASCII dungeon crawler for Windows, Linux & OSX
Stars: ✭ 22 (-42.11%)
Mutual labels:  lazarus, freepascal
bcrypt
BCrypt is a password hashing function
Stars: ✭ 138 (+263.16%)
Mutual labels:  lazarus, freepascal
brookframework
Microframework which helps to develop web Pascal applications.
Stars: ✭ 161 (+323.68%)
Mutual labels:  lazarus, freepascal
torokernel
This repository contains the source code of the unikernel toro
Stars: ✭ 107 (+181.58%)
Mutual labels:  lazarus, freepascal
setup-lazarus
Set up your GitHub Actions workflow with a specific version of Lazarus
Stars: ✭ 29 (-23.68%)
Mutual labels:  lazarus, freepascal
PospoliteView
Pospolite View aims to be a simple HTML viewer engine fully made in Free Pascal.
Stars: ✭ 29 (-23.68%)
Mutual labels:  lazarus, freepascal
ShellRemoteBot
Shell remote control from telegram (SSH/terminal emulator)
Stars: ✭ 28 (-26.32%)
Mutual labels:  lazarus, freepascal
deskew
Deskew is a command line tool for deskewing scanned text documents. It uses Hough transform to detect "text lines" in the image. As an output, you get an image rotated so that the lines are horizontal.
Stars: ✭ 127 (+234.21%)
Mutual labels:  lazarus, object-pascal
QQWry
Delphi interface for QQWry IP database
Stars: ✭ 14 (-63.16%)
Mutual labels:  lazarus, freepascal
sizectrl
TSizeCtrl v8.2
Stars: ✭ 16 (-57.89%)
Mutual labels:  lazarus, freepascal
VALIS
Vote ALlocating Immune System, an immune-inspired classification algorithm
Stars: ✭ 21 (-44.74%)
Mutual labels:  lazarus, freepascal
DfmExtractor
Small command line utility which allows you to extract DFM, LFM and FRM forms from executable files compiled by Delphi, Lazarus and CodeTyphon.
Stars: ✭ 22 (-42.11%)
Mutual labels:  lazarus, freepascal
fp-telegram
Wrapper classes library for telegram bots API (FreePascal)
Stars: ✭ 59 (+55.26%)
Mutual labels:  lazarus, freepascal
WebView4Delphi
WebView4Delphi is an open source project created by Salvador Díaz Fau to embed Chromium-based browsers in applications made with Delphi or Lazarus/FPC for Windows.
Stars: ✭ 157 (+313.16%)
Mutual labels:  lazarus, freepascal
fano
Pascal web application framework
Stars: ✭ 21 (-44.74%)
Mutual labels:  freepascal, object-pascal
Ascension
A metaheuristic optimization framework
Stars: ✭ 24 (-36.84%)
Mutual labels:  lazarus, freepascal
Bauglir-WebSocket-2
Copy of https://code.google.com/archive/p/bauglir-websocket/
Stars: ✭ 15 (-60.53%)
Mutual labels:  lazarus, freepascal
brook-telegram
Telegram plugin for brookframework
Stars: ✭ 23 (-39.47%)
Mutual labels:  lazarus, freepascal

Xavier

License Hits-of-Code

Xavier is a small XML library, object-oriented, and cross-platform that simplifies the work with XML files and streams using XPath.

ATTENTION: We're still in a very early alpha version, the API may and will change frequently. Please, use it at your own risk, until we release version 1.0.

Table of Contents

Overview

This API is being written in Free Pascal and Lazarus. However, it is also compatible with Delphi.

Most XML libraries are very complex. Each class has so many methods that could be hard to use and understand them. These implementations are very procedural too.

The main goal is to replace common procedural code, which could have so many conditionals and variables, to a declarative and object-oriented code to work more easily with XML.

The code follows a restrict rules about naming and style, as prefixes and suffixes, to help programmers to find the correct class or method to do the job quickly.

Installing

Clone the repository in some directory in your computer.

Dependencies

Internally, this project uses the built-in XML library for each compiler.

Besides that, we are using other libraries:

  • James — is a collection of classes and interfaces for truly object-oriented projects.
  • mORMot — client-server ORM SOA MVC framework for Delphi 6 up to latest Delphi and FPC

On Lazarus

It has been tested using these versions:

  • FPC 3.1.1 revision 40491
  • Lazarus 2.1.0 revision 59757

To install on Lazarus:

  • Make sure that you have JamesLib.lpk, and mormot_base.lpk available - see dependencies
  • Open the package in /pkg/XavierLib.lpk
  • Compile it
  • That's all.

The IDE will be aware about XavierLib Package to use in any project.

Considering <xavier> as the path where you have saved the sources, your project must include these paths:

On Delphi

Considering <xavier> as the path where you have saved the sources, you must include these paths in your project:

  • Search Path <xavier>\src;<xavier>\src\delphi

Getting Started

You can find some examples to use Xavier in its own source. Just take a look into Xavier*Tests units.

Additionally, below you can find the basics to start.

Take this XML for all examples below:

<?xml version="1.0" encoding="UTF-8"?>
<root>
  <foo a1="f1" a2="f2">
    <value>foo</value>
  </foo>
  <bar a1="b1" a2="b2">
    <value>bar</value>
  </bar>
</root>

Find a Node

If you want to find the value child node of foo node, do this:

var
  pack: IXMLPack;
  n: IXMLNode;
begin
  pack := TXMLPack.Create(
    TDataFile.Create('file.xml').Ref.Stream
  );
  n := pack.Node('/root/foo/value');
  ShowMessage(n.Text); // "foo"
end.

In fact, we don't need variables pack or n. Just call directly:

begin
  ShowMessage(
    TXMLPack.Create(
      TDataFile.Create('file.xml').Ref.Stream
    )
    .Ref
    .Node('/root/foo/value')
    .Text
  ); // "foo"
end.

Add Node

You can add a node easily doing this:

// add a new node: name="item" value="a"
begin
  TXMLPack.Create(TDataFile.Create('file.xml').Ref.Stream)
    .Ref
    .Node('/root')
    .Add('item')
    .Text('a')
end;

Childs Count

You can count how many childs a node have doing this:

// How many childs
begin
  TXMLPack.Create(TDataFile.Create('file.xml').Ref.Stream)
    .Ref
    .Node('/root')
    .Childs
    .Count
end;

Find Attribute

You can find any attribute by name doing this:

// Find by name "id"
begin
  TXMLPack.Create(TDataFile.Create('file.xml').Ref.Stream)
    .Ref
    .Node('/root')
    .Attrs
    .Item('id')
end;

Add Attribute

Adding an attribute is quite easy too:

// Add an attribute: name="foo" value="bar"
begin
  TXMLPack.Create(TDataFile.Create('file.xml').Ref.Stream)
    .Ref
    .Node('/root')
    .Attrs
    .Add('foo', 'bar')
end;

License (MIT)

This project is released under MIT license. See LICENSE.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].