Base Framework
Classes | Public Types | Public Member Functions | Static Public Member Functions | List of all members
DOMImplementation Class Reference

DOM implementation. More...

#include <base/xml/DOMImplementation.h>

Inherits Object.

Classes

class  DocumentEvent
 
class  EventException
 
class  EventListener
 
class  EventTarget
 
class  Interface
 

Public Types

enum  Flag {
  WARNINGS = 1, PEDANTIC = 2, SUBSTITUTE_ENTITIES = 4, DETECT_IDS = 8,
  COMPLETE_ATTRIBUTE_LISTS = 16
}
 
enum  Mode { PARSING, VALIDATING, RECOVERING }
 

Public Member Functions

 DOMImplementation () noexcept
 
 DOMImplementation (const DOMImplementation &copy) noexcept
 
DOMImplementationoperator= (const DOMImplementation &assign) noexcept
 
bool hasFeature (const String &name, const String &version) noexcept
 
Document createDocument (const String &version="1.0")
 
Document createDocument (DocumentType doctype, const String &version="1.0")
 
Document createDocument (const String &namespaceURI, const String &qualifiedName, DocumentType doctype, const String &version="1.0")
 
Document createFromURI (const String &systemId, Mode mode=VALIDATING, unsigned int flags=WARNINGS|PEDANTIC|DETECT_IDS|COMPLETE_ATTRIBUTE_LISTS)
 
Document createDocumentFromString (const String &value, Mode mode=VALIDATING, unsigned int flags=WARNINGS|PEDANTIC|DETECT_IDS|COMPLETE_ATTRIBUTE_LISTS)
 
DocumentType createDocumentType (const String &qualifiedName, const String &publicId, const String &systemId)
 
void saveDocument (Document document, const String &filename, bool indent=false)
 
void saveDocument (Document document, const String &filename, const String &encoding, bool indent)
 
String saveDocumentToMemory (Document document, bool spaces=false)
 
String saveDocumentToMemory (Document document, const String &encoding, bool spaces=false)
 

Static Public Member Functions

static bool isSupported () noexcept
 

Detailed Description

DOM implementation.

Document Object Model (DOM) implementation.

Version
1.0
Examples
testsuite/sax.cpp, testsuite/validate.cpp, and testsuite/xsltprocessor.cpp.

Member Enumeration Documentation

◆ Mode

Enumerator
PARSING 

Parsing without validation.

VALIDATING 

Parsing with validation.

RECOVERING 

Recovering mode.

Constructor & Destructor Documentation

◆ DOMImplementation()

DOMImplementation::DOMImplementation ( )
inlinenoexcept

Initializes DOM implementation.

Member Function Documentation

◆ createDocument() [1/3]

Document DOMImplementation::createDocument ( const String namespaceURI,
const String qualifiedName,
DocumentType  doctype,
const String version = "1.0" 
)

Creates a DOM Document object of the specified type with its document element.

Parameters
namespaceURIThe namespace. May be improper.
qualifiedNameThe qualified name of the document element.
doctypeThe document type.
versionThe XML version. The default is "1.0".

◆ createDocument() [2/3]

Document DOMImplementation::createDocument ( const String version = "1.0")

Creates an enmpty DOM Document object.

Parameters
versionThe XML version. The default is "1.0".
Examples
testsuite/sax.cpp.

◆ createDocument() [3/3]

Document DOMImplementation::createDocument ( DocumentType  doctype,
const String version = "1.0" 
)

Creates a DOM Document object of the specified type.

Parameters
doctypeThe document type.
versionThe XML version. The default is "1.0".

◆ createDocumentFromString()

Document DOMImplementation::createDocumentFromString ( const String value,
Mode  mode = VALIDATING,
unsigned int  flags = WARNINGS|PEDANTIC|DETECT_IDS|COMPLETE_ATTRIBUTE_LISTS 
)

Creates the document from a string.

Parameters
valueThe string.
modeThe mode.
flagsThe flags.

◆ createDocumentType()

DocumentType DOMImplementation::createDocumentType ( const String qualifiedName,
const String publicId,
const String systemId 
)

Creates an empty DocumentType node.

◆ createFromURI()

Document DOMImplementation::createFromURI ( const String systemId,
Mode  mode = VALIDATING,
unsigned int  flags = WARNINGS|PEDANTIC|DETECT_IDS|COMPLETE_ATTRIBUTE_LISTS 
)

Creates a document from a URI.

Parameters
systemIdThe URI.
modeThe mode.
flagsThe flags.
Examples
testsuite/validate.cpp, and testsuite/xsltprocessor.cpp.

◆ hasFeature()

bool DOMImplementation::hasFeature ( const String name,
const String version 
)
noexcept

Returns true if the feature is available.

◆ isSupported()

static bool DOMImplementation::isSupported ( )
staticnoexcept

Returns true if XML is supported by the runtime.

◆ saveDocument() [1/2]

void DOMImplementation::saveDocument ( Document  document,
const String filename,
bool  indent = false 
)

Saves the document to the specified file.

Parameters
filenameThe path of the file.
documentThe document.
indentSpecifies whether or not the document should be indented. The default is false.

◆ saveDocument() [2/2]

void DOMImplementation::saveDocument ( Document  document,
const String filename,
const String encoding,
bool  indent 
)

Saves the document to the specified file.

Parameters
filenameThe path of the file.
documentThe document.
encodingThe encoding.
indentSpecifies whether or not the document should be indented. The default is false.

◆ saveDocumentToMemory() [1/2]

String DOMImplementation::saveDocumentToMemory ( Document  document,
bool  spaces = false 
)

Saves the document to a string.

Parameters
documentThe document.
spacesSpecifies whether or not formatting spaces should be added. The default is false.

◆ saveDocumentToMemory() [2/2]

String DOMImplementation::saveDocumentToMemory ( Document  document,
const String encoding,
bool  spaces = false 
)

Saves the document to a string.

Parameters
documentThe document.
encodingThe encoding.
spacesSpecifies whether or not formatting spaces should be added. The default is false.