java配置文件,dtd如何给xml标签的属性赋默认值,我想知道dom4j一类的解析器底层如何实现的

举个例子,下文的xml,是如何拿到 flag=true的默认值的,java底层是怎么实现的

<?xml version="1.0" encoding="utf-8"?>

<!DOCTYPE shopping [
<!ELEMENT book (name,price,count,comment)>
<!ELEMENT name (#PCDATA)>
<!ELEMENT price (#PCDATA)>
<!ELEMENT count (#PCDATA)>
<!ELEMENT comment (#PCDATA)>
<!--comment标签的flag属性 字符串类型 缺省值/默认值-->
<!ATTLIST comment flag CDATA "true">

]>

<book>
    <name>了凡四训</name>
    <price>100</price>
    <count>3</count>
    <comment></comment>                
</book>

<book>
    <name>孟子</name>
    <price>200</price>
    <count>5</count>
    <!-- flag属性不写都可以 -->
    <comment></comment>
</book>

<book>
    <name>灵枢</name>
    <price>300</price>
    <count>7</count>
    <!-- flag属性的值 自定义也可以 -->
    <comment flag="false"></comment>       
</book>

这个flag属性,省略时底层是怎么拿到的,或者说底层怎么赋上默认值,求解.

有方法先拿到标签,在拿到便签里面的具体值,直接组成for循环即可

直接组成for循环即可<!ATTLIST comment flag CDATA "true">

dom4j是开源的,去看源码