<commit_before># document

docstr = """
<?xml version="1.0" encoding="UTF-8"?>
<bookstore>
  <book category="COOKING" tag="first">
    <title lang="en">Everyday Italian</title>
    <author><NAME></author>
    <year>2005</year>
    <price>30.00</price>
  </book>
  <book category="CHILDREN">
    <title lang="en">Harry Potter</title>
    <author><NAME></author>
    <year>2005</year>
    <price>29.99</price>
  </book><?PI description?>
</bookstore>
"""

for xdoc = (parse_string(docstr),
            parse_file(joinpath(dirname(@__FILE__), "ex1.xml")),
            parse_file(joinpath(dirname(@__FILE__), "ex1.xml"), C_NULL, 64), # 64 == XML_PARSE_NOWARNING
            parse_file(joinpath(dirname(@__FILE__), "ex1.xml"), "UTF-8", 64))

@test version(xdoc) == "1.0"
@test encoding(xdoc) == "UTF-8"
@test standalone(xdoc) == -2


# root node

xroot = root(xdoc)

@test isa(xroot, XMLElement)
@test is_elementnode(xroot)
@test name(xroot) == "bookstore"
@test nodetype(xroot) == 1
@test !has_attributes(xroot)
@test has_children(xroot)

ras = collect(attributes(xroot))
@test isempty(ras)
<commit_msg>dirname(@__FILE__) can be replaced with just @__DIR__<commit_after># document

docstr = """
<?xml version="1.0" encoding="UTF-8"?>
<bookstore>
  <book category="COOKING" tag="first">
    <title lang="en">Everyday Italian</title>
    <author><NAME></author>
    <year>2005</year>
    <price>30.00</price>
  </book>
  <book category="CHILDREN">
    <title lang="en">Harry Potter</title>
    <author><NAME></author>
    <year>2005</year>
    <price>29.99</price>
  </book><?PI description?>
</bookstore>
"""

for xdoc = (parse_string(docstr),
            parse_file(joinpath(@__DIR__, "ex1.xml")),
            parse_file(joinpath(@__DIR__, "ex1.xml"), C_NULL, 64), # 64 == XML_PARSE_NOWARNING
            parse_file(joinpath(@__DIR__, "ex1.xml"), "UTF-8", 64))

@test version(xdoc) == "1.0"
@test encoding(xdoc) == "UTF-8"
@test standalone(xdoc) == -2


# root node

xroot = root(xdoc)

@test isa(xroot, XMLElement)
@test is_elementnode(xroot)
@test name(xroot) == "bookstore"
@test nodetype(xroot) == 1
@test !has_attributes(xroot)
@test has_children(xroot)

ras = collect(attributes(xroot))
@test isempty(ras)

{'fraction_non_alphanumeric': 0.19293478260869565, 'fraction_numerical': 0.030797101449275364, 'mean_word_length': 4.564231738035264, 'pattern_counts': {'":': 0, '<': 55, '<?xml version=': 2, '>': 55, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 8}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2302441', 'n_tokens_mistral': 875, 'n_tokens_neox': 834, 'n_words': 156}