Stroika Library 3.0d25
 
Loading...
Searching...
No Matches
IProvider.cpp
1/*
2 * Copyright(c) Sophist Solutions, Inc. 1990-2026. All rights reserved
3 */
4#include "Stroika/Foundation/StroikaPreComp.h"
5
7
8#include "IProvider.h"
9
10#if qStroika_HasComponent_xerces
12#endif
13#if qStroika_HasComponent_libxml2
15#endif
16
17using namespace Stroika::Foundation;
19using namespace Stroika::Foundation::DataExchange::XML;
20
21#if qStroika_Foundation_DataExchange_XML_SupportParsing and qStroika_Foundation_DataExchange_XML_SupportSchema and qStroika_Foundation_DataExchange_XML_SupportDOM
22const XML::Providers::IXMLProvider* XML::Providers::Private_::GetDefaultProvider_ ()
23{
24 // libxml2 has better XPath support than Xerces (and so therefore also better schema validation).
25 // so make it the default as of 2024-01-14
26#if qStroika_HasComponent_libxml2
27 return &LibXML2::kDefaultProvider;
28#elif qStroika_HasComponent_xerces
29 return &Xerces::kDefaultProvider;
30#endif
31}
32
33/*
34 ********************************************************************************
35 ********************************** XML::Options ********************************
36 ********************************************************************************
37 */
38const XML::Providers::IXMLProvider& XML::Options::GetProvider () const
39{
40 if (fProvider != nullptr) {
41 return *fProvider;
42 }
43 const Providers::IXMLProvider* d = Providers::kDefaultProvider ();
44 EnsureNotNull (d); // this compiles only where SupportDOM is, and that means xerces or libxml2 is configured
45 return *d;
46}
47#endif
#define EnsureNotNull(p)
Definition Assertions.h:343
const Providers::IXMLProvider * fProvider
Read and write with this provider - nullptr, the default, meaning Providers::kDefaultProvider: libxml...