#xml #roblox #dom #rbxlx #rbxmx


Implementation of Roblox's XML file formats, rbxlx and rbxmx

24 releases

0.12.4 Jun 13, 2022
0.12.3 Oct 11, 2021
0.12.2 Jul 19, 2021
0.12.0-alpha.3 Mar 9, 2021
0.6.0 Mar 27, 2019

#101 in Games

Download history 41/week @ 2022-12-01 141/week @ 2022-12-08 83/week @ 2022-12-15 97/week @ 2022-12-22 89/week @ 2022-12-29 99/week @ 2023-01-05 98/week @ 2023-01-12 91/week @ 2023-01-19 108/week @ 2023-01-26 78/week @ 2023-02-02 84/week @ 2023-02-09 146/week @ 2023-02-16 93/week @ 2023-02-23 102/week @ 2023-03-02 79/week @ 2023-03-09 39/week @ 2023-03-16

347 downloads per month
Used in 4 crates

MIT license

4.5K SLoC


rbx_xml on crates.io rbx_xml docs

More details about this crate are available on the rbx-dom GitHub.

Implementation of Roblox's XML model formats, rbxmx and rbxlx for the rbx-dom ecosystem.


rbx_xml aims to support all property types from rbx_dom_weak.

Some properties serialize with different names in XML than the names exposed via Roblox's API dump or via the Lua API. In those cases, rbx_xml keeps a mapping that needs to be kept up to date. These cases are pretty uncommon, so that table is small.


Configurable Roblox XML place/model format (rbxmx and rbxlx) serializer and deserializer.

rbx_xml uses the rbx_dom_weak crate as its DOM.

This crate implements most of the format and is driven by an up-to-date reflection database.


To decode a place or model, use a method like from_reader_default if you're reading from a file, or from_str_default if you already have a string. These methods also have variants like from_str that let you pass in custom options.

use rbx_dom_weak::types::Variant;

let model_file = r#"
<roblox version="4">
    <Item class="NumberValue" referent="RBX3B3D9D3DB43D4E6793B190B081E0A886">
            <string name="Name">My NumberValue</string>
            <double name="Value">12345</double>

let model = rbx_xml::from_str_default(model_file)?;

let data_model = model.root();
let number_value_ref = data_model.children()[0];
let number_value = model.get_by_ref(number_value_ref).unwrap();

# Ok::<(), Box<dyn std::error::Error>>(())

If you're decoding from a file, you'll want to do your own I/O buffering, like with BufReader:

use std::{

let file = BufReader::new(File::open("place.rbxlx")?);
let place = rbx_xml::from_reader_default(file)?;
# Ok::<(), Box<dyn std::error::Error>>(())

Note that the WeakDom instance returned by the rbx_xml decode methods will have a root instance with the class name DataModel. This is great for deserializing a place, but kind of strange for deserializing a model.

Because models can have multiple instances at the top level, rbx_xml can't just return an WeakDom with your single instance at the top. Instead, the crate instead always creates a top-level DataModel instance which is pretty close to free.


To serialize an existing WeakDom instance, use methods like to_writer_default or to_writer.

For example, to re-save the place file we loaded above:

use std::{
use rbx_dom_weak::{WeakDom, InstanceBuilder};

let place = WeakDom::new(InstanceBuilder::new("DataModel"));

// A Roblox place file contains all of its top-level instances.
let top_level_refs = place.root().children();

// Just like when reading a place file, we should buffer our I/O.
let file = BufWriter::new(File::create("place-2.rbxlx")?);

rbx_xml::to_writer_default(file, &place, top_level_refs)?;
# Ok::<(), Box<dyn std::error::Error>>(())


rbx_xml exposes no useful configuration yet, but there are methods that accept DecodeOptions and EncodeOptions that will be useful when it does.


~96K SLoC