Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the output format of xmllint ls?

Tags:

xml

xmllint

Using xmllint --shell, I execute

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>

and

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  

What does "ta", "c" and "a" stand for, and what do the characters represent?

like image 749
Rose Perrone Avatar asked Jul 24 '12 03:07

Rose Perrone


1 Answers

The answer you seek is available in the following location:

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

I've broken the output down by node type, please note that the second two characters below are shown as "--" for convenience. In actuality, for all node types other than XML_NAMESPACE_DECL, the second character is "a" if node->properties is not NULL and the third character is "n" if node->nsDef is not NULL. Finally, #NC# suggests a digit value for the number of children that node has while #CL# is a digit value for the length of the content of the node.

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
like image 71
Jeremy McEntire Avatar answered Oct 28 '22 21:10

Jeremy McEntire