Thread safety
Moxml is thread-safe when used properly. Each instance maintains its own state and can be used safely in concurrent operations:
class XmlProcessor
def initialize
@mutex = Mutex.new
@context = Moxml.new
end
def process(xml)
@mutex.synchronize do
doc = @context.parse(xml)
# Modify document
doc.to_xml
end
end
end