TSDuck v3.40-4033
MPEG Transport Stream Toolkit
Loading...
Searching...
No Matches
ts::xml::Tweaks Class Reference

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

#include <tsxmlTweaks.h>

Public Member Functions

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

Public Attributes

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

Detailed Description

Global tweaks to manipulate, parse and format XML documents.

Each document is associated with a Tweaks structure.

Member Function Documentation

◆ defineArgs()

void ts::xml::Tweaks::defineArgs ( Args args)

Add command line option definitions in an Args.

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

◆ loadArgs()

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

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.

◆ 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 = true

If true, use double quotes for attribute values.

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

◆ strictAttributeFormatting

bool ts::xml::Tweaks::strictAttributeFormatting = true

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 = false

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 = false

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 = false

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 = false

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 = false

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

The default is false.

◆ x2jCollapseText

bool ts::xml::Tweaks::x2jCollapseText = false

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

The default is false.


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