Added very basic XML support using libxml2. (0.35.0)
This commit is contained in:
parent
ecf64d6ac2
commit
e65756226d
17 changed files with 436 additions and 3 deletions
27
examples/xml_class_example.fun
Normal file
27
examples/xml_class_example.fun
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
/*
|
||||
* This file is part of the Fun programming language.
|
||||
* https://fun-lang.xyz/
|
||||
*
|
||||
* Copyright 2025 Johannes Findeisen <you@hanez.org>
|
||||
* Licensed under the terms of the Apache-2.0 license.
|
||||
* https://opensource.org/license/apache-2-0
|
||||
*
|
||||
* Added: 2025-12-09
|
||||
*/
|
||||
|
||||
// Example using the stdlib XML class wrapper
|
||||
|
||||
include <io/xml.fun>
|
||||
|
||||
xml = XML()
|
||||
doc = xml.from_file("./examples/data/example.xml")
|
||||
print("doc handle:")
|
||||
print(doc)
|
||||
if (doc == 0)
|
||||
print("Failed to load XML file")
|
||||
else
|
||||
root = xml.root(doc)
|
||||
print("root name:")
|
||||
print(xml.name(root))
|
||||
print("root text:")
|
||||
print(xml.text(root))
|
||||
Loading…
Add table
Add a link
Reference in a new issue