Stroika Library 3.0d16
 
Loading...
Searching...
No Matches
LibXML2.h
Go to the documentation of this file.
1/*
2 * Copyright(c) Sophist Solutions, Inc. 1990-2025. All rights reserved
3 */
4#ifndef _Stroika_Foundation_DataExchange_XML_Providers_LibXML2_h_
5#define _Stroika_Foundation_DataExchange_XML_Providers_LibXML2_h_ 1
6
7#include "Stroika/Foundation/StroikaPreComp.h"
8
9static_assert (qStroika_HasComponent_libxml2, "Don't include this file if qStroika_HasComponent_libxml2 not set");
10
11#include <libxml/parser.h>
12#include <libxml/schemasInternals.h>
13#include <libxml/xmlerror.h>
14#include <libxml/xmlschemas.h>
15#include <libxml/xpath.h>
16#include <libxml/xpathInternals.h>
17
21
22/**
23 * \file
24 *
25 * \note Code-Status: <a href="Code-Status.md#Beta">Beta</a>
26 *
27 * \note - Generally most code should NOT include this file - its implementation specific data for each provider
28 * Mostly use to control which implementation you are using for SAX, Schema etc, and/or to access implementation-specific objects
29 * from schema, DOM nodes, etc.
30 */
31
32namespace Stroika::Foundation::DataExchange::XML::Providers::LibXML2 {
33
34 using Characters::String;
35
36 /**
37 * Note - it is documented in the headers that xmlChar is always UTF8
38 */
39 String libXMLString2String (const xmlChar* s, int len);
40 String libXMLString2String (const xmlChar* t);
41
42 /**
43 */
44 struct ILibXML2SchemaRep : Schema::IRep {
45 virtual xmlSchema* GetSchemaLibRep () = 0;
46 };
47
48 struct ILibXML2DocRep : DOM::Document::IRep {
49 virtual xmlDoc* GetLibXMLDocRep () = 0;
50 };
51
52 /**
53 */
54 struct ILibXML2NodeRep : virtual DOM::Node::IRep {
55 virtual xmlNode* GetInternalTRep () = 0;
56 };
57
58 /**
59 * Can only be created ONCE (because libxml2 library can only be constructed once). Use the default impl.
60 */
61 struct Provider : Providers::IXMLProvider {
62 Provider ();
63 Provider (const Provider&) = delete;
64 ~Provider ();
65
66 virtual shared_ptr<Schema::IRep> SchemaFactory (const Streams::InputStream::Ptr<byte>& schemaData,
67 const Resource::ResolverPtr& resolver) const override;
68 virtual shared_ptr<DOM::Document::IRep> DocumentFactory (const Streams::InputStream::Ptr<byte>& in,
69 const Schema::Ptr& schemaToValidateAgainstWhileReading) const override;
70 virtual void SAXParse (const Streams::InputStream::Ptr<byte>& in, StructuredStreamEvents::IConsumer* callback,
71 const Schema::Ptr& schema) const override;
72 };
73 inline const Provider kDefaultProvider;
74
75}
76
77/*
78 ********************************************************************************
79 ***************************** Implementation Details ***************************
80 ********************************************************************************
81 */
82CompileTimeFlagChecker_HEADER (Stroika::Foundation::DataExchange::XML, qStroika_HasComponent_libxml2, qStroika_HasComponent_libxml2);
83
84#endif /*_Stroika_Foundation_DataExchange_XML_Providers_LibXML2_h_*/
#define CompileTimeFlagChecker_HEADER(NS_PREFIX, NAME, VALUE)
CompileTimeFlagChecker_HEADER () will generate a LINK ERROR if you ever compile a header with one val...
String libXMLString2String(const xmlChar *s, int len)
Definition LibXML2.cpp:929
InputStream<>::Ptr is Smart pointer (with abstract Rep) class defining the interface to reading from ...