MarkLogic Connect
MarkLogic Connect Client API Collection
Static Public Member Functions | List of all members
mlclient::utilities::PugiXmlHelper Class Reference

Uses the pugixml library to provide convenience XML parsing functionality. More...

#include <PugiXmlHelper.hpp>

Static Public Member Functions

static MLCLIENT_API ITextDocumentContenttoDocument (const pugi::xml_document &dc)
 Converts a pugi::xml_document instance to a MarkLogic C++ API IDocumentContent instance. More...
 
static MLCLIENT_API ITextDocumentContenttoDocument (const std::string &content)
 Converts a std::string instance to a MarkLogic C++ API IDocumentContent instance. More...
 
static MLCLIENT_API ITextDocumentContenttoDocument (const Response &resp)
 Creates an ITextDocumentContent instances from the response. More...
 
static MLCLIENT_API pugi::xml_documentfromDocument (const IDocumentContent &dc)
 Extracts a pugi::xml_document instance from a IDocumentContent object. More...
 
static MLCLIENT_API pugi::xml_documentfromResponse (const Response &resp)
 Extracts a pugi::xml_document instance directly from the Response object. More...
 

Detailed Description

Uses the pugixml library to provide convenience XML parsing functionality.

Author
Adam Fowler adam..nosp@m.fowl.nosp@m.er@ma.nosp@m.rklo.nosp@m.gic.c.nosp@m.om
Since
8.0.0
Date
2016-04-25

Provides convenience conversions between pugi::xml_document and IDocumentContent objects.

Note
This class introduces a dependency on the pugixml C++ library. You must install that to use this class.

Member Function Documentation

static MLCLIENT_API pugi::xml_document* mlclient::utilities::PugiXmlHelper::fromDocument ( const IDocumentContent dc)
static

Extracts a pugi::xml_document instance from a IDocumentContent object.

This is useful when retrieving a document from MarkLogic Server and then processing the underlying XML.

Exceptions
InvalidFormatExceptionIf the IDocumentContent does not have the application/xml mime type, or if parsing fails.
Parameters
dcThe IDocumentContent instance to extract the XML content from.
Returns
A pugi::xml_document instance (parsed XML) created from the IDocumentContent object provided.
static MLCLIENT_API pugi::xml_document* mlclient::utilities::PugiXmlHelper::fromResponse ( const Response resp)
static

Extracts a pugi::xml_document instance directly from the Response object.

Exceptions
InvalidFormatExceptionif the Response does not have a mime type of application/xml, or if a parsing error occurs.
Parameters
respThe MarkLogic C++ API Response object instance.
Returns
A pugi::xml_document instance (parsed XML tree) created from the Response.
static MLCLIENT_API ITextDocumentContent* mlclient::utilities::PugiXmlHelper::toDocument ( const pugi::xml_document dc)
static

Converts a pugi::xml_document instance to a MarkLogic C++ API IDocumentContent instance.

Parameters
dcThe pugi::xml_document instance to convert
Returns
The IDocumentContent instance wrapping the XML content, with its mime type and content set
static MLCLIENT_API ITextDocumentContent* mlclient::utilities::PugiXmlHelper::toDocument ( const std::string &  content)
static

Converts a std::string instance to a MarkLogic C++ API IDocumentContent instance.

Parameters
contentThe std::string instance to convert
Returns
The IDocumentContent instance wrapping the XML content, with its mime type and content set
Exceptions
InvalidFormatExceptionIf the string content does not have the application/xml mime type, or if parsing fails.
static MLCLIENT_API ITextDocumentContent* mlclient::utilities::PugiXmlHelper::toDocument ( const Response resp)
static

Creates an ITextDocumentContent instances from the response.

Since
8.0.2
Parameters
respThe MarkLogic C++ API Response object instance.
Returns
The IDocumentContent instance wrapping the XML content in the response, with its mime type and content set
Exceptions
InvalidFormatExceptionIf the Response does not have the application/xml mime type, or if parsing fails.

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