什么是xmllint ls的输出格式?

时间:2012-07-24 03:12:08

标签: xml xmllint

使用xmllint --shell,执行

chapter > cat * 
 -------
<title>Getting to Know Penguins</title>
 -------
<abstract>
      <para>Penguins are cute.</para>
    </abstract>
 -------
<sect1>
      <title>The Head</title>
      <para>...</para>
    </sect1>
 -------
<sect1 id="penguin.coat">
      <title>The Coat</title>
      <para>...</para>
    </sect1>

chapter > ls
ta-        5      
---        1 title
ta-        5      
---        3 abstract
ta-        5      
---        5 sect1
ta-        5      
c--       17 
ta-        5      
-a-        5 sect1
ta-        3  

“ta”,“c”和“a”代表什么,字符代表什么?

1 个答案:

答案 0 :(得分:3)

您寻求的答案可在以下位置获得:

libxml2-2.9.0 :: debugXML.c:1652:xmlLsOneNode(FILE * output,xmlNodePtr node)

我按节点类型断开了输出,请注意,为方便起见,下面的后两个字符显示为“ - ”。实际上,对于除XML_NAMESPACE_DECL之外的所有节点类型,如果node-&gt;属性不为NULL,则第二个字符为“a”,如果node-&gt; nsDef不为NULL,则第三个字符为“n”。最后,#NC#建议节点具有的子节点数的数字值,而#CL#是节点内容长度的数字值。

XML_ELEMENT_NODE:
---     #NC# [[(node->ns->prefix):](node->name)]

XML_ATTRIBUTE_NODE:
a--     #NC# [(node->name)]

XML_TEXT_NODE:
t--     #CL# [xmlDebugDumpString(node->content)...|"(NULL)"]
    * The string value of content up to at most 40 characters with some
    * substitutions.  A space (' ') replaces the whitespace characters
    * allowed by the XML RFC: (0x20, 0x9, 0xA, 0xD).  Any character whose
    * HEX value is 0x80 or greater is printed as a string: "#XXXX"


XML_CDATA_SECTION_NODE:
C--     #CL#

XML_ENTITY_REF_NODE:
e--     1 [(node->name)]

XML_ENTITY_NODE:
E--     1 [(node->name)]

XML_PI_NODE:
p--     #CL#

XML_COMMENT_NODE:
c--     #CL#

XML_DOCUMENT_NODE:
d--     #NC#

XML_HTML_DOCUMENT_NODE:
h--     #NC#

XML_DOCUMENT_TYPE_NODE:
T--     1

XML_DOCUMENT_FRAG_NODE:
F--     1

XML_NOTATION_NODE:
N--     1

XML_NAMESPACE_DECL:
n       1 [(node->prefix)|"default"] -> (node->href)

default:
?--     1