0

Using tinyxml2, I'm trying to parse this Traffic Server config file:

<LogFormat>
    <Name = "simple"/>
    <Format = "simple"/> 
</LogFormat>

<LogObject>
     <Format = "simple"/>
     <Filename = "simple.log"/>
     <Mode = "ascii"/> 
</LogObject>

Traffic server XML config format is described here:

LoadFile() gives me this error:

"Error=XML_ERROR_PARSING_ELEMENT ErrorID=6 (0x6) Line number=2"

What is wrong with the Name element? Can tinyxml2 simply not parse Traffic Server XML config files?

firebush
  • 5,180
  • 4
  • 34
  • 45
  • 1
    The config format appears to be named and documented misleadingly. It is not XML. It is "modeled after XML". – eerorika Jan 19 '19 at 02:55

1 Answers1

3

<Name = "simple"/> is not a valid XML element. Valid XML element is something like

<LogFormat>
    <Name value="simple"/>
    <Format value="simple"/> 
</LogFormat>

or

<LogFormat name="simple" format="simple"/> 
</LogFormat>

Thus Traffic server logs_xml.config config file is not in the XML format, and tinyxml cannot parse it.

273K
  • 29,503
  • 10
  • 41
  • 64