From 03b349ecce0cc6530c6b6bd2d9b0dd351b063752 Mon Sep 17 00:00:00 2001
From: Anonymus Raccoon
Date: Sun, 3 May 2020 16:00:04 +0200
Subject: [PATCH] Update README.md
---
README.md | 54 +++++++++++++++++++++++++++++++++++++++++-------------
1 file changed, 41 insertions(+), 13 deletions(-)
diff --git a/README.md b/README.md
index b643cf6..82e6cf8 100644
--- a/README.md
+++ b/README.md
@@ -2,27 +2,55 @@
An xml parser in C.
-# Dependencies
-To compile, you'll need gcc, ar rc and make.
-
-### System calls
-Open, Close, Read, Stat
-
## Build
-Simple clone the repo and use the command ``make``.
+Simple clone the repo and use the command ``make``. A statically linkable library will be created.
## Usage
Use ``xml_parse(path)`` to parse the whole xml.
Use ``xml_getnode(xml, node_name)`` to get the first node with the name you inputed.
-Use ``xml_getproperty(key)`` to get an attribute of the xml.
+Here is the full list of helper function that will allow you to simply use the data:
-## Unsuported yet
+
+```bool xml_hasproperty(node *n, const char *key);``` Check if a property is present or not (do not check the value)
+
+
+```char *xml_getproperty(node *n, const char *key);``` Return a malloced string property and parse special characters. Ex: \n will be transformed to a new line char.
+
+
+
+```char *xml_gettempprop(node *n, const char *key);``` Return a pointer to the node's raw property. Special characters are not evaluated. Warning: you should not free it.
+
+
+```char *xml_gettmpstring(node *n, const char *key, char *def);``` Same as above but if the string is not found, ``def`` is returned instead of ``NULL``
+
+
+```int xml_getintprop(node *n, const char *key);``` Return the property as a int. If the value is not found, 0 is returned.
+
+
+```int xml_getbinaprop(node *n, const char *key);``` Interpret the property as a binnary int value. If the value is not found, 0 is returned.
+
+
+```int xml_gethexaprop(node *n, const char *key);``` Interpret the property as an hexadecimal int value. If the value is not found, 0 is returned.
+
+```float xml_getfloatprop(node *n, const char *key);``` Return the property as a float. If the value is not found, 0 is returned.
+
+
+```int xml_getchildcount(node *n);``` Return the total number of childs a node has.
+
+
+```int xml_getchildcount_filtered(node *n, char *name);``` Return the number of child with the name ``name`` a node has.
+
+
+```bool xml_getbool(node *n, const char *key, bool default_value);``` Interpret the property as a boolean. If the value is not found, ``default_value`` is returned.
+
+
+
+
+And do not forget to free the parsed xml when you do not need it anymore with the function: ``void xml_destroy(node *n);``
+
+## Unsuported
Attributes with semi quotes (') instead of quotes (")
Comments
-
-String containing multiples following spaces.
-
-String containing \n, \r or \t (theses specials chars are removed)