libxml++ 5.6.1

Public Member Functions | Protected Member Functions | List of all members
xmlpp::Dtd Class Reference

Represents an XML DTD for validating XML files. More...

`#include <libxml++/dtd.h>`

Inheritance diagram for xmlpp::Dtd:
[legend]

## Public Member Functions
| Dtd ()
| Dtd (_xmlDtd * dtd, bool take_ownership=false)
| Create a Dtd from the underlying libxml DTD element.
| Dtd (const std::string & filename)
| Create a Dtd and parse an external subset (DTD file) immediately.
| Dtd (const ustring & external, const ustring & system)
| Create a Dtd and parse an external subset (DTD file) immediately.
| ~Dtd () override
const _xmlDtd * | cobj () const noexcept
| Access the underlying libxml implementation.
_xmlDtd * | cobj () noexcept
| Access the underlying libxml implementation.
ustring | get_external_id () const
| Get the external identifier for PUBLIC DTD.
std::optional< ustring > | get_external_id2 () const
| Get the external identifier for PUBLIC DTD.
ustring | get_name () const
| Get the name of the DTD.
std::optional< ustring > | get_name2 () const
| Get the name of the DTD.
ustring | get_system_id () const
| Get the URI for a SYSTEM or PUBLIC DTD.
std::optional< ustring > | get_system_id2 () const
| Get the URI for a SYSTEM or PUBLIC DTD.
void | parse_file (const std::string & filename)
| Parse an external subset (DTD file).
void | parse_memory (const ustring & contents)
| Parse a DTD from a string.
void | parse_stream (std::istream & in)
| Parse a DTD from a stream.
void | parse_subset (const ustring & external, const ustring & system)
| Parse an external subset (DTD file).
Public Member Functions inherited from xmlpp::NonCopyable
| NonCopyable (const NonCopyable &)=delete
| NonCopyable (NonCopyable &&)=delete
NonCopyable & | operator= (const NonCopyable &)=delete
NonCopyable & | operator= (NonCopyable &&)=delete

## Protected Member Functions
void | release_underlying ()
Protected Member Functions inherited from xmlpp::NonCopyable
| NonCopyable () noexcept
virtual | ~NonCopyable ()

## Detailed Description

Represents an XML DTD for validating XML files.

DTD = Document Type Definition

## Constructor & Destructor Documentation

## ◆ Dtd() [1/4]

xmlpp::Dtd::Dtd | ( |  | ) |

## ◆ Dtd() [2/4]

xmlpp::Dtd::Dtd | ( | _xmlDtd * | dtd,
|  | bool | take_ownership = false )
| explicit

Create a Dtd from the underlying libxml DTD element.

Parameters

  dtd | A pointer to the libxml DTD element.
  take_ownership | If true, this Dtd instance takes ownership of the libxml DTD element. The caller must not delete it. If false, this Dtd does not take ownership of the libxml DTD element. The caller must guarantee that the libxml DTD element exists as long as this Dtd keeps a pointer to it. The caller is responsible for deleting the libxml DTD element when it's no longer needed, unless it belongs to a Document, in which case it's deleted when the Document is deleted.

## ◆ Dtd() [3/4]

xmlpp::Dtd::Dtd | ( | const std::string & | filename | ) |
| explicit

Create a Dtd and parse an external subset (DTD file) immediately.

Since libxml++ 3.0

Parameters

  filename | The URL of the DTD.

Exceptions

  xmlpp::parse_error |

## ◆ Dtd() [4/4]

xmlpp::Dtd::Dtd | ( | const ustring & | external,
|  | const ustring & | system )

Create a Dtd and parse an external subset (DTD file) immediately.

Since libxml++ 3.0

Parameters

  external | The external ID of the DTD.
  system | The URL of the DTD.

Exceptions

  xmlpp::parse_error |

## ◆ ~Dtd()

xmlpp::Dtd::~Dtd | ( |  | ) |
| override

## Member Function Documentation

## ◆ cobj() [1/2]

const _xmlDtd * xmlpp::Dtd::cobj | ( |  | ) | const
| noexcept

Access the underlying libxml implementation.

## ◆ cobj() [2/2]

_xmlDtd * xmlpp::Dtd::cobj | ( |  | ) |
| noexcept

Access the underlying libxml implementation.

## ◆ get_external_id()

ustring xmlpp::Dtd::get_external_id | ( |  | ) | const

Get the external identifier for PUBLIC DTD.

Returns
  The external identifier for PUBLIC DTD.

Deprecated
  5.6: Use get_external_id2() instead.

## ◆ get_external_id2()

std::optional< ustring > xmlpp::Dtd::get_external_id2 | ( |  | ) | const

Get the external identifier for PUBLIC DTD.

Returns
  The external identifier for PUBLIC DTD, if any, else no value.

Since libxml++ 5.6

## ◆ get_name()

ustring xmlpp::Dtd::get_name | ( |  | ) | const

Get the name of the DTD.

Returns
  The name of the DTD.

Deprecated
  5.6: Use get_name2() instead.

## ◆ get_name2()

std::optional< ustring > xmlpp::Dtd::get_name2 | ( |  | ) | const

Get the name of the DTD.

Returns
  The name of the DTD, if any, else no value.

Since libxml++ 5.6

## ◆ get_system_id()

ustring xmlpp::Dtd::get_system_id | ( |  | ) | const

Get the URI for a SYSTEM or PUBLIC DTD.

Returns
  The URI for a SYSTEM or PUBLIC DTD.

Deprecated
  5.6: Use get_system_id2() instead.

## ◆ get_system_id2()

std::optional< ustring > xmlpp::Dtd::get_system_id2 | ( |  | ) | const

Get the URI for a SYSTEM or PUBLIC DTD.

Returns
  The URI for a SYSTEM or PUBLIC DTD, if any, else no value.

Since libxml++ 5.6

## ◆ parse_file()

void xmlpp::Dtd::parse_file | ( | const std::string & | filename | ) |

Parse an external subset (DTD file).

If another DTD has been parsed before, that DTD is replaced by the new one (deleted if this Dtd owns it).

Since libxml++ 3.0

Parameters

  filename | The URL of the DTD.

Exceptions

  xmlpp::parse_error |

## ◆ parse_memory()

void xmlpp::Dtd::parse_memory | ( | const ustring & | contents | ) |

Parse a DTD from a string.

If another DTD has been parsed before, that DTD is replaced by the new one (deleted if this Dtd owns it).

Since libxml++ 3.0

Parameters

  contents | The DTD as a string.

Exceptions

  xmlpp::parse_error |

## ◆ parse_stream()

void xmlpp::Dtd::parse_stream | ( | std::istream & | in | ) |

Parse a DTD from a stream.

If another DTD has been parsed before, that DTD is replaced by the new one (deleted if this Dtd owns it).

Since libxml++ 3.0

Parameters

  in | The stream.

Exceptions

  xmlpp::parse_error |

## ◆ parse_subset()

void xmlpp::Dtd::parse_subset | ( | const ustring & | external,
|  | const ustring & | system )

Parse an external subset (DTD file).

If another DTD has been parsed before, that DTD is replaced by the new one (deleted if this Dtd owns it).

Since libxml++ 3.0

Parameters

  external | The external ID of the DTD.
  system | The URL of the DTD.

Exceptions

  xmlpp::parse_error |

## ◆ release_underlying()

void xmlpp::Dtd::release_underlying | ( |  | ) |
| protected