diff --git a/Cargo.lock b/Cargo.lock
index 7275495..fd51f0b 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -330,6 +330,12 @@ dependencies = [
"versioning",
]
+[[package]]
+name = "simple_xml_serialize"
+version = "0.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2f8896c3696f051907ae5e59f0c2d9fb9f7521c29d636e4a1ea4ff0e4e5aac15"
+
[[package]]
name = "std"
version = "0.1.0"
@@ -478,3 +484,17 @@ version = "0.1.0"
dependencies = [
"logos",
]
+
+[[package]]
+name = "xml-builder"
+version = "0.5.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "efc4f1a86af7800dfc4056c7833648ea4515ae21502060b5c98114d828f5333b"
+
+[[package]]
+name = "xml_tests"
+version = "0.1.0"
+dependencies = [
+ "simple_xml_serialize",
+ "xml-builder",
+]
diff --git a/Cargo.toml b/Cargo.toml
index a0bd7ae..be75e02 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -35,7 +35,7 @@ members = [
"programs/table_view",
"programs/undelete",
"programs/wat2wasm",
-
+ "programs/xml_tests",
"programs/std_test",
]
diff --git a/libraries/exi/assets/sample.xml b/libraries/exi/assets/sample.xml
new file mode 100644
index 0000000..2071b5b
--- /dev/null
+++ b/libraries/exi/assets/sample.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/libraries/exi/src/lib.rs b/libraries/exi/src/lib.rs
index ba6b7dc..6321314 100644
--- a/libraries/exi/src/lib.rs
+++ b/libraries/exi/src/lib.rs
@@ -56,3 +56,32 @@ pub struct ExiHeader {
}
pub struct ExiDocument {}
+impl ExiDocument {
+ pub fn new_from_xml(xml_string: String) -> Self {
+ println!("{}", xml_string);
+ Self {}
+ }
+}
+
+#[cfg(unix)]
+mod unix {
+ use std::{
+ fs::{self, File},
+ io::Read,
+ path::Path,
+ };
+
+ use crate::ExiDocument;
+ fn parse_exi_from_file(path: &Path) -> ExiDocument {
+ let file_contents = fs::read_to_string(path).unwrap();
+
+ ExiDocument::new_from_xml(file_contents)
+ // ExiDocument {}
+ }
+ #[test]
+ fn test_xml_to_exi() {
+ parse_exi_from_file(Path::new(
+ "/home/able/Projects/ableos_userland/libraries/exi/assets/sample.xml",
+ ));
+ }
+}
diff --git a/programs/xml_tests/Cargo.toml b/programs/xml_tests/Cargo.toml
new file mode 100644
index 0000000..fe19e03
--- /dev/null
+++ b/programs/xml_tests/Cargo.toml
@@ -0,0 +1,10 @@
+[package]
+name = "xml_tests"
+version = "0.1.0"
+edition = "2021"
+
+# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
+
+[dependencies]
+simple_xml_serialize = "*"
+xml-builder = "0.5.2"
diff --git a/programs/xml_tests/src/main.rs b/programs/xml_tests/src/main.rs
new file mode 100644
index 0000000..fabbe05
--- /dev/null
+++ b/programs/xml_tests/src/main.rs
@@ -0,0 +1,28 @@
+// use simple_xml_serialize::XMLElement;
+
+// fn main() {
+// let mut ele = XMLElement::new("mouse");
+
+// println!("{}", ele);
+// }
+
+use xml_builder::{XMLBuilder, XMLElement, XMLVersion};
+
+fn main() {
+ let mut xml = XMLBuilder::new()
+ .version(XMLVersion::XML1_1)
+ .encoding("UTF-8".into())
+ .build();
+
+ let mut mouse = XMLElement::new("mouse");
+ mouse.add_attribute("x", "8");
+ mouse.add_attribute("y", "0");
+ mouse.add_attribute("y_change", "-1");
+ mouse.add_attribute("x_change", "1");
+
+ xml.set_root_element(mouse);
+
+ let mut writer: Vec = Vec::new();
+ xml.generate(&mut writer).unwrap();
+ println!("{}", String::from_utf8_lossy(&writer));
+}