TSDuck Version 3.29-2595 (TSDuck - The MPEG Transport Stream Toolkit)
ts::xml::Tweaks Class Reference

Global tweaks to manipulate, parse and format XML documents. More...

Inheritance diagram for ts::xml::Tweaks:
Collaboration diagram for ts::xml::Tweaks:

Public Member Functions

 Tweaks ()
 Default constructor.
 
UChar attributeValueOtherQuote () const
 The quote character which is different from the one to use for attribute values. More...
 
UChar attributeValueQuote () const
 The type of quote to use for attribute values. More...
 
virtual void defineArgs (Args &args) const override
 Add command line option definitions in an Args. More...
 
virtual bool loadArgs (DuckContext &duck, Args &args) override
 Load arguments from command line. More...
 

Public Attributes

bool attributeValueDoubleQuote
 If true, use double quotes for attribute values. More...
 
bool strictAttributeFormatting
 How to escape characters in attribute values. More...
 
bool strictTextNodeFormatting
 How to escape characters in text nodes. More...
 
bool x2jCollapseText
 In the XML-to-JSON conversion without model, collapse spaces in all text nodes. More...
 
bool x2jEnforceBoolean
 In the XML-to-JSON conversion without model, enforce the creation of a JSON boolean when possible. More...
 
bool x2jEnforceInteger
 In the XML-to-JSON conversion without model, enforce the creation of a JSON number when possible. More...
 
bool x2jIncludeRoot
 In the XML-to-JSON conversion, keep the root of the XML document as a JSON object. More...
 
bool x2jTrimText
 In the XML-to-JSON conversion without model, trim all text nodes. More...
 

Detailed Description

Global tweaks to manipulate, parse and format XML documents.

Each document is associated with a Tweaks structure.

Member Function Documentation

◆ defineArgs()

virtual void ts::xml::Tweaks::defineArgs ( Args args) const
overridevirtual

Add command line option definitions in an Args.

Parameters
[in,out]argsCommand line arguments to update.

Implements ts::ArgsSupplierInterface.

◆ loadArgs()

virtual bool ts::xml::Tweaks::loadArgs ( DuckContext duck,
Args args 
)
overridevirtual

Load arguments from command line.

Args error indicator is set in case of incorrect arguments.

Parameters
[in,out]duckTSDuck execution context.
[in,out]argsCommand line arguments.
Returns
True on success, false on error in argument line.

Implements ts::ArgsSupplierInterface.

◆ attributeValueQuote()

UChar ts::xml::Tweaks::attributeValueQuote ( ) const
inline

The type of quote to use for attribute values.

Returns
Either single or double quote.

◆ attributeValueOtherQuote()

UChar ts::xml::Tweaks::attributeValueOtherQuote ( ) const
inline

The quote character which is different from the one to use for attribute values.

Returns
Either single or double quote.

Member Data Documentation

◆ attributeValueDoubleQuote

bool ts::xml::Tweaks::attributeValueDoubleQuote

If true, use double quotes for attribute values.

If false, use single quote. The default is true.

◆ strictAttributeFormatting

bool ts::xml::Tweaks::strictAttributeFormatting

How to escape characters in attribute values.

When true, all 5 special characters '"&<> are escaped in attribute values and the attributeValueQuote() character is used as quote.

When false, a more human-readable but not strictly XML-compliant format is used. If the value contains only single or double quotes, the other character is used to enclose the value. Only the ampersand and the selected quote character is escaped.

The default is true.

◆ strictTextNodeFormatting

bool ts::xml::Tweaks::strictTextNodeFormatting

How to escape characters in text nodes.

When true, all 5 special characters '"&<> are escaped in text nodes. When false, a more human-readable but not strictly XML-compliant format is used: only the 3 characters &<> are escaped.

The default is false.

◆ x2jIncludeRoot

bool ts::xml::Tweaks::x2jIncludeRoot

In the XML-to-JSON conversion, keep the root of the XML document as a JSON object.

The default is false.

◆ x2jEnforceInteger

bool ts::xml::Tweaks::x2jEnforceInteger

In the XML-to-JSON conversion without model, enforce the creation of a JSON number when possible.

The default is false.

◆ x2jEnforceBoolean

bool ts::xml::Tweaks::x2jEnforceBoolean

In the XML-to-JSON conversion without model, enforce the creation of a JSON boolean when possible.

The default is false.

◆ x2jTrimText

bool ts::xml::Tweaks::x2jTrimText

In the XML-to-JSON conversion without model, trim all text nodes.

The default is false.

◆ x2jCollapseText

bool ts::xml::Tweaks::x2jCollapseText

In the XML-to-JSON conversion without model, collapse spaces in all text nodes.

The default is false. Option --x2j-collapse-text


The documentation for this class was generated from the following file: