==========
XML Models
==========
XML models are used to describe the structure of OPC UA address space: its nodes, types, variables, etc.
There are many predefined XML models in the OPC UA. You can find them in the git repository `NodeSet `_.
Loading XML models
------------------
When you start the server, you can load XML models from the file.
During loading, the server will parse the XML models and build the address space.
For every new loaded XML model added to the server, the server will create a new namespace.
Consider loading XML model for plastic rubber industry: `PlasticRubber `_.
The following example shows how to load the XML models by using the HTTP protocol from
OPCUA Foundation github repository:
.. literalinclude:: ../examples/server/server_load_models_http.lua
:language: lua
`Full source <../_static/server/server_load_models_http.lua>`__
The following example shows how to load the XML models from the local file:
.. literalinclude:: ../examples/server/server_load_models_file.lua
:language: lua
`Full source <../_static/server/server_load_models_file.lua>`__
Export XML models
------------------
You can export XML models from the server to the file. It is
possible to export either all models or selected models by specifying namespace URIs.
The following example shows how to export XML models to the file:
.. literalinclude:: ../examples/server/server_export_model_xml.lua
:language: lua
:lines: 8-19
`Full source <_static/examples/server/server_export_model_xml.lua>`__