Serializable::inspect
to show more useful information
serialization :: serialization_core
Abstract services to serialize Nit objects to different formatscore :: union_find
union–find algorithm using an efficient disjoint-set data structure
# Simple XML validity checker using the `dom` module
module checker is example
import dom
# Check arguments
if args.length != 1 then
print_error "Usage: checker xml_file"
exit 2
end
var path = args.first
if not path.file_exists then
print_error "Path '{path}' does not exist"
exit 3
end
# Read file
var content = path.to_path.read_all
# Parse XML
var xml = content.to_xml
# Check for errors
if xml isa XMLError then
print_error "XML file at '{path}' is invalid:"
print_error xml.message
var loc = xml.location
if loc != null then print_error loc
exit 1
else
print "XML file at '{path}' is valid"
end
lib/dom/examples/checker.nit:11,1--43,3