Sfoglia il codice sorgente

Merge branch 'master' of https://github.com/acplt/open62541

opcua 11 anni fa
parent
commit
2c3a336f47

+ 1 - 1
Makefile.am

@@ -20,7 +20,7 @@ endif
 export GLOBAL_AM_CFLAGS = $(AM_CFLAGS)
 export GLOBAL_AM_LDADD = $(AM_LDADD)
 
-SUBS=tool include src
+SUBS=tools include src
 if HAVE_CHECK
 	SUBS+= tests
 endif

+ 5 - 1
README.md

@@ -10,7 +10,11 @@ An open-source communication stack implementation of OPC UA (OPC Unified Archite
 ### Ubuntu
 ##### Getting gcc toolchain:
 ```bash
-sudo apt-get install build-essential subversion git autoconf libtool texinfo python-lxml
+sudo apt-get install build-essential subversion git autoconf libtool texinfo python-lxml 
+```
+##### Getting toolchain for tools:
+```bash
+sudo apt-get install gperf libexpat
 ```
 ##### Getting and installing *check* as unit test framework (http://check.sourceforge.net/):
 ```bash

+ 3 - 2
configure.ac

@@ -4,7 +4,7 @@ AC_PREREQ(2.59)
 AC_INIT(Open62541, 1.0)
 
 AC_CANONICAL_SYSTEM
-AM_INIT_AUTOMAKE()
+AM_INIT_AUTOMAKE([subdir-objects])
 AC_PROG_MAKE_SET
 #default CFLAGS is -g -02
 #reset it just to -g and make optimization dependend on --enable-debug
@@ -16,6 +16,7 @@ AC_PROG_CC
 AC_PROG_LN_S
 AM_PROG_CC_C_O
 AC_CHECK_LIB([m],[exp],,AC_MSG_ERROR([Libm missing]))
+AC_CHECK_LIB([expat],[XML_Parse],,AC_MSG_ERROR([Libexpat missing]))
 PKG_CHECK_MODULES([CHECK], [check >= 0.9.12],[have_check="yes"],AC_MSG_WARN([Check not found or check version lower than 0.9.12; cannot run unit tests!])
 [have_check="no"])
 AM_CONDITIONAL([HAVE_CHECK], [test x"$have_check" = "xyes"])
@@ -95,6 +96,6 @@ AM_COND_IF([ENABLE_DOXYGEN], [AC_CONFIG_FILES([doc/Doxyfile])])
 AC_LIBTOOL_WIN32_DLL
 AC_PROG_LIBTOOL
 AC_CONFIG_MACRO_DIR([m4])
-AC_CONFIG_FILES(Makefile include/Makefile src/Makefile tool/Makefile tests/Makefile examples/src/Makefile doc/Makefile)
+AC_CONFIG_FILES(Makefile include/Makefile src/Makefile tools/Makefile tests/Makefile examples/src/Makefile doc/Makefile)
 AC_OUTPUT
 

+ 10 - 3
examples/src/Makefile.am

@@ -1,12 +1,19 @@
+bin_PROGRAMS = $(top_builddir)/bin/xml2ns0 
+
+__top_builddir__bin_xml2ns0_SOURCES = xml2ns0.c
+__top_builddir__bin_xml2ns0_CFLAGS = -I$(top_builddir)/src -I$(top_builddir)/include $(GLOBAL_AM_CFLAGS)
+__top_builddir__bin_xml2ns0_LDADD = $(top_builddir)/lib/libopen62541.a $(GLOBAL_AM_LDADD)
+__top_builddir__bin_xml2ns0_LDFLAGS = -lexpat
+
 if MULTITHREADING
-bin_PROGRAMS= $(top_builddir)/bin/exampleServerMT 
+bin_PROGRAMS += $(top_builddir)/bin/exampleServerMT 
 
 __top_builddir__bin_exampleServerMT_CFLAGS = -I$(top_builddir)/src -I$(top_builddir)/include $(GLOBAL_AM_CFLAGS)
 __top_builddir__bin_exampleServerMT_SOURCES = opcuaServerMT.c networklayer.c
 __top_builddir__bin_exampleServerMT_LDADD= $(top_builddir)/lib/libopen62541.a $(GLOBAL_AM_LDADD)
 
 else
-bin_PROGRAMS= $(top_builddir)/bin/exampleServer $(top_builddir)/bin/exampleServerACPLT
+bin_PROGRAMS += $(top_builddir)/bin/exampleServer $(top_builddir)/bin/exampleServerACPLT
 
 __top_builddir__bin_exampleServer_CFLAGS = -I$(top_builddir)/src -I$(top_builddir)/include $(GLOBAL_AM_CFLAGS)
 __top_builddir__bin_exampleServer_SOURCES = opcuaServer.c networklayer.c
@@ -15,4 +22,4 @@ __top_builddir__bin_exampleServer_LDADD= $(top_builddir)/lib/libopen62541.a $(GL
 __top_builddir__bin_exampleServerACPLT_CFLAGS = -I$(top_builddir)/src -I$(top_builddir)/include $(GLOBAL_AM_CFLAGS)
 __top_builddir__bin_exampleServerACPLT_SOURCES = opcuaServerACPLT.c networklayer.c
 __top_builddir__bin_exampleServerACPLT_LDADD= $(top_builddir)/lib/libopen62541.a $(GLOBAL_AM_LDADD)
-endif
+endif

+ 990 - 0
examples/src/Opc.Ua.NodeSet2.Part3.xml

@@ -0,0 +1,990 @@
+<?xml version="1.0" encoding="utf-8"?>
+<UANodeSet xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" Version="1.02" LastModified="2013-03-06T05:36:43.3142217Z" xmlns="http://opcfoundation.org/UA/2011/03/UANodeSet.xsd">
+  <Aliases>
+    <Alias Alias="Boolean">i=1</Alias>
+    <Alias Alias="SByte">i=2</Alias>
+    <Alias Alias="Byte">i=3</Alias>
+    <Alias Alias="Int16">i=4</Alias>
+    <Alias Alias="UInt16">i=5</Alias>
+    <Alias Alias="Int32">i=6</Alias>
+    <Alias Alias="UInt32">i=7</Alias>
+    <Alias Alias="Int64">i=8</Alias>
+    <Alias Alias="UInt64">i=9</Alias>
+    <Alias Alias="Float">i=10</Alias>
+    <Alias Alias="Double">i=11</Alias>
+    <Alias Alias="DateTime">i=13</Alias>
+    <Alias Alias="String">i=12</Alias>
+    <Alias Alias="ByteString">i=15</Alias>
+    <Alias Alias="Guid">i=14</Alias>
+    <Alias Alias="XmlElement">i=16</Alias>
+    <Alias Alias="NodeId">i=17</Alias>
+    <Alias Alias="ExpandedNodeId">i=18</Alias>
+    <Alias Alias="QualifiedName">i=20</Alias>
+    <Alias Alias="LocalizedText">i=21</Alias>
+    <Alias Alias="StatusCode">i=19</Alias>
+    <Alias Alias="Structure">i=22</Alias>
+    <Alias Alias="Number">i=26</Alias>
+    <Alias Alias="Integer">i=27</Alias>
+    <Alias Alias="UInteger">i=28</Alias>
+    <Alias Alias="HasComponent">i=47</Alias>
+    <Alias Alias="HasProperty">i=46</Alias>
+    <Alias Alias="Organizes">i=35</Alias>
+    <Alias Alias="HasEventSource">i=36</Alias>
+    <Alias Alias="HasNotifier">i=48</Alias>
+    <Alias Alias="HasSubtype">i=45</Alias>
+    <Alias Alias="HasTypeDefinition">i=40</Alias>
+    <Alias Alias="HasModellingRule">i=37</Alias>
+    <Alias Alias="HasEncoding">i=38</Alias>
+    <Alias Alias="HasDescription">i=39</Alias>
+  </Aliases>
+  <UAObject NodeId="i=3062" BrowseName="Default Binary" SymbolicName="DefaultBinary">
+    <DisplayName>Default Binary</DisplayName>
+    <Description>The default binary encoding for a data type.</Description>
+    <References>
+      <Reference ReferenceType="HasTypeDefinition">i=58</Reference>
+    </References>
+  </UAObject>
+  <UAObject NodeId="i=3063" BrowseName="Default XML" SymbolicName="DefaultXml">
+    <DisplayName>Default XML</DisplayName>
+    <Description>The default XML encoding for a data type.</Description>
+    <References>
+      <Reference ReferenceType="HasTypeDefinition">i=58</Reference>
+    </References>
+  </UAObject>
+  <UADataType NodeId="i=24" BrowseName="BaseDataType" IsAbstract="true">
+    <DisplayName>BaseDataType</DisplayName>
+    <Description>Describes a value that can have any valid DataType.</Description>
+    <References />
+  </UADataType>
+  <UADataType NodeId="i=26" BrowseName="Number" IsAbstract="true">
+    <DisplayName>Number</DisplayName>
+    <Description>Describes a value that can have any numeric DataType.</Description>
+    <References>
+      <Reference ReferenceType="HasSubtype" IsForward="false">i=24</Reference>
+    </References>
+  </UADataType>
+  <UADataType NodeId="i=27" BrowseName="Integer" IsAbstract="true">
+    <DisplayName>Integer</DisplayName>
+    <Description>Describes a value that can have any integer DataType.</Description>
+    <References>
+      <Reference ReferenceType="HasSubtype" IsForward="false">i=26</Reference>
+    </References>
+  </UADataType>
+  <UADataType NodeId="i=28" BrowseName="UInteger" IsAbstract="true">
+    <DisplayName>UInteger</DisplayName>
+    <Description>Describes a value that can have any unsigned integer DataType.</Description>
+    <References>
+      <Reference ReferenceType="HasSubtype" IsForward="false">i=27</Reference>
+    </References>
+  </UADataType>
+  <UADataType NodeId="i=29" BrowseName="Enumeration" IsAbstract="true">
+    <DisplayName>Enumeration</DisplayName>
+    <Description>Describes a value that is an enumerated DataType.</Description>
+    <References>
+      <Reference ReferenceType="HasSubtype" IsForward="false">i=24</Reference>
+    </References>
+  </UADataType>
+  <UADataType NodeId="i=1" BrowseName="Boolean">
+    <DisplayName>Boolean</DisplayName>
+    <Description>Describes a value that is either TRUE or FALSE.</Description>
+    <References>
+      <Reference ReferenceType="HasSubtype" IsForward="false">i=24</Reference>
+    </References>
+  </UADataType>
+  <UADataType NodeId="i=2" BrowseName="SByte">
+    <DisplayName>SByte</DisplayName>
+    <Description>Describes a value that is an integer between -128 and 127.</Description>
+    <References>
+      <Reference ReferenceType="HasSubtype" IsForward="false">i=27</Reference>
+    </References>
+  </UADataType>
+  <UADataType NodeId="i=3" BrowseName="Byte">
+    <DisplayName>Byte</DisplayName>
+    <Description>Describes a value that is an integer between 0 and 255.</Description>
+    <References>
+      <Reference ReferenceType="HasSubtype" IsForward="false">i=28</Reference>
+    </References>
+  </UADataType>
+  <UADataType NodeId="i=4" BrowseName="Int16">
+    <DisplayName>Int16</DisplayName>
+    <Description>Describes a value that is an integer between −32,768 and 32,767.</Description>
+    <References>
+      <Reference ReferenceType="HasSubtype" IsForward="false">i=27</Reference>
+    </References>
+  </UADataType>
+  <UADataType NodeId="i=5" BrowseName="UInt16">
+    <DisplayName>UInt16</DisplayName>
+    <Description>Describes a value that is an integer between 0 and 65535.</Description>
+    <References>
+      <Reference ReferenceType="HasSubtype" IsForward="false">i=28</Reference>
+    </References>
+  </UADataType>
+  <UADataType NodeId="i=6" BrowseName="Int32">
+    <DisplayName>Int32</DisplayName>
+    <Description>Describes a value that is an integer between −2,147,483,648  and 2,147,483,647.</Description>
+    <References>
+      <Reference ReferenceType="HasSubtype" IsForward="false">i=27</Reference>
+    </References>
+  </UADataType>
+  <UADataType NodeId="i=7" BrowseName="UInt32">
+    <DisplayName>UInt32</DisplayName>
+    <Description>Describes a value that is an integer between 0 and 4,294,967,295.</Description>
+    <References>
+      <Reference ReferenceType="HasSubtype" IsForward="false">i=28</Reference>
+    </References>
+  </UADataType>
+  <UADataType NodeId="i=8" BrowseName="Int64">
+    <DisplayName>Int64</DisplayName>
+    <Description>Describes a value that is an integer between −9,223,372,036,854,775,808 and 9,223,372,036,854,775,807.</Description>
+    <References>
+      <Reference ReferenceType="HasSubtype" IsForward="false">i=27</Reference>
+    </References>
+  </UADataType>
+  <UADataType NodeId="i=9" BrowseName="UInt64">
+    <DisplayName>UInt64</DisplayName>
+    <Description>Describes a value that is an integer between 0 and 18,446,744,073,709,551,615.</Description>
+    <References>
+      <Reference ReferenceType="HasSubtype" IsForward="false">i=28</Reference>
+    </References>
+  </UADataType>
+  <UADataType NodeId="i=10" BrowseName="Float">
+    <DisplayName>Float</DisplayName>
+    <Description>Describes a value that is an IEEE 754-1985 single precision floating point number.</Description>
+    <References>
+      <Reference ReferenceType="HasSubtype" IsForward="false">i=26</Reference>
+    </References>
+  </UADataType>
+  <UADataType NodeId="i=11" BrowseName="Double">
+    <DisplayName>Double</DisplayName>
+    <Description>Describes a value that is an IEEE 754-1985 double precision floating point number.</Description>
+    <References>
+      <Reference ReferenceType="HasSubtype" IsForward="false">i=26</Reference>
+    </References>
+  </UADataType>
+  <UADataType NodeId="i=12" BrowseName="String">
+    <DisplayName>String</DisplayName>
+    <Description>Describes a value that is a sequence of printable Unicode characters.</Description>
+    <References>
+      <Reference ReferenceType="HasSubtype" IsForward="false">i=24</Reference>
+    </References>
+  </UADataType>
+  <UADataType NodeId="i=13" BrowseName="DateTime">
+    <DisplayName>DateTime</DisplayName>
+    <Description>Describes a value that is a Gregorian calender date and time.</Description>
+    <References>
+      <Reference ReferenceType="HasSubtype" IsForward="false">i=24</Reference>
+    </References>
+  </UADataType>
+  <UADataType NodeId="i=14" BrowseName="Guid">
+    <DisplayName>Guid</DisplayName>
+    <Description>Describes a value that is a 128-bit globally unique identifier.</Description>
+    <References>
+      <Reference ReferenceType="HasSubtype" IsForward="false">i=24</Reference>
+    </References>
+  </UADataType>
+  <UADataType NodeId="i=15" BrowseName="ByteString">
+    <DisplayName>ByteString</DisplayName>
+    <Description>Describes a value that is a sequence of bytes.</Description>
+    <References>
+      <Reference ReferenceType="HasSubtype" IsForward="false">i=24</Reference>
+    </References>
+  </UADataType>
+  <UADataType NodeId="i=16" BrowseName="XmlElement">
+    <DisplayName>XmlElement</DisplayName>
+    <Description>Describes a value that is an XML element.</Description>
+    <References>
+      <Reference ReferenceType="HasSubtype" IsForward="false">i=24</Reference>
+    </References>
+  </UADataType>
+  <UADataType NodeId="i=17" BrowseName="NodeId">
+    <DisplayName>NodeId</DisplayName>
+    <Description>Describes a value that is an identifier for a node within a Server address space.</Description>
+    <References>
+      <Reference ReferenceType="HasSubtype" IsForward="false">i=24</Reference>
+    </References>
+  </UADataType>
+  <UADataType NodeId="i=20" BrowseName="QualifiedName">
+    <DisplayName>QualifiedName</DisplayName>
+    <Description>Describes a value that is a name qualified by a namespace.</Description>
+    <References>
+      <Reference ReferenceType="HasSubtype" IsForward="false">i=24</Reference>
+    </References>
+  </UADataType>
+  <UADataType NodeId="i=21" BrowseName="LocalizedText">
+    <DisplayName>LocalizedText</DisplayName>
+    <Description>Describes a value that is human readable Unicode text with a locale identifier.</Description>
+    <References>
+      <Reference ReferenceType="HasSubtype" IsForward="false">i=24</Reference>
+    </References>
+  </UADataType>
+  <UADataType NodeId="i=22" BrowseName="Structure" IsAbstract="true">
+    <DisplayName>Structure</DisplayName>
+    <Description>Describes a value that is any type of structure that can be described with a data encoding.</Description>
+    <References>
+      <Reference ReferenceType="HasSubtype" IsForward="false">i=24</Reference>
+    </References>
+  </UADataType>
+  <UADataType NodeId="i=30" BrowseName="Image">
+    <DisplayName>Image</DisplayName>
+    <Description>Describes a value that is an image encoded as a string of bytes.</Description>
+    <References>
+      <Reference ReferenceType="HasSubtype" IsForward="false">i=15</Reference>
+    </References>
+  </UADataType>
+  <UAReferenceType NodeId="i=31" BrowseName="References" IsAbstract="true" Symmetric="true">
+    <DisplayName>References</DisplayName>
+    <Description>The abstract base type for all references.</Description>
+    <References />
+    <InverseName>References</InverseName>
+  </UAReferenceType>
+  <UAReferenceType NodeId="i=32" BrowseName="NonHierarchicalReferences" IsAbstract="true">
+    <DisplayName>NonHierarchicalReferences</DisplayName>
+    <Description>The abstract base type for all non-hierarchical references.</Description>
+    <References>
+      <Reference ReferenceType="HasSubtype" IsForward="false">i=31</Reference>
+    </References>
+    <InverseName>NonHierarchicalReferences</InverseName>
+  </UAReferenceType>
+  <UAReferenceType NodeId="i=33" BrowseName="HierarchicalReferences" IsAbstract="true">
+    <DisplayName>HierarchicalReferences</DisplayName>
+    <Description>The abstract base type for all hierarchical references.</Description>
+    <References>
+      <Reference ReferenceType="HasSubtype" IsForward="false">i=31</Reference>
+    </References>
+    <InverseName>HierarchicalReferences</InverseName>
+  </UAReferenceType>
+  <UAReferenceType NodeId="i=34" BrowseName="HasChild">
+    <DisplayName>HasChild</DisplayName>
+    <Description>The abstract base type for all non-looping hierarchical references.</Description>
+    <References>
+      <Reference ReferenceType="HasSubtype" IsForward="false">i=33</Reference>
+    </References>
+    <InverseName>ChildOf</InverseName>
+  </UAReferenceType>
+  <UAReferenceType NodeId="i=35" BrowseName="Organizes">
+    <DisplayName>Organizes</DisplayName>
+    <Description>The type for hierarchical references that are used to organize nodes.</Description>
+    <References>
+      <Reference ReferenceType="HasSubtype" IsForward="false">i=33</Reference>
+    </References>
+    <InverseName>OrganizedBy</InverseName>
+  </UAReferenceType>
+  <UAReferenceType NodeId="i=36" BrowseName="HasEventSource">
+    <DisplayName>HasEventSource</DisplayName>
+    <Description>The type for non-looping hierarchical references that are used to organize event sources.</Description>
+    <References>
+      <Reference ReferenceType="HasSubtype" IsForward="false">i=33</Reference>
+    </References>
+    <InverseName>EventSourceOf</InverseName>
+  </UAReferenceType>
+  <UAReferenceType NodeId="i=37" BrowseName="HasModellingRule">
+    <DisplayName>HasModellingRule</DisplayName>
+    <Description>The type for references from instance declarations to modelling rule nodes.</Description>
+    <References>
+      <Reference ReferenceType="HasSubtype" IsForward="false">i=32</Reference>
+    </References>
+    <InverseName>ModellingRuleOf</InverseName>
+  </UAReferenceType>
+  <UAReferenceType NodeId="i=38" BrowseName="HasEncoding">
+    <DisplayName>HasEncoding</DisplayName>
+    <Description>The type for references from data type nodes to to data type encoding nodes.</Description>
+    <References>
+      <Reference ReferenceType="HasSubtype" IsForward="false">i=32</Reference>
+    </References>
+    <InverseName>EncodingOf</InverseName>
+  </UAReferenceType>
+  <UAReferenceType NodeId="i=39" BrowseName="HasDescription">
+    <DisplayName>HasDescription</DisplayName>
+    <Description>The type for references from data type encoding nodes to data type description nodes.</Description>
+    <References>
+      <Reference ReferenceType="HasSubtype" IsForward="false">i=32</Reference>
+    </References>
+    <InverseName>DescriptionOf</InverseName>
+  </UAReferenceType>
+  <UAReferenceType NodeId="i=40" BrowseName="HasTypeDefinition">
+    <DisplayName>HasTypeDefinition</DisplayName>
+    <Description>The type for references from a instance node its type defintion node.</Description>
+    <References>
+      <Reference ReferenceType="HasSubtype" IsForward="false">i=32</Reference>
+    </References>
+    <InverseName>TypeDefinitionOf</InverseName>
+  </UAReferenceType>
+  <UAReferenceType NodeId="i=41" BrowseName="GeneratesEvent">
+    <DisplayName>GeneratesEvent</DisplayName>
+    <Description>The type for references from a node to an event type that is raised by node.</Description>
+    <References>
+      <Reference ReferenceType="HasSubtype" IsForward="false">i=32</Reference>
+    </References>
+    <InverseName>GeneratesEvent</InverseName>
+  </UAReferenceType>
+  <UAReferenceType NodeId="i=3065" BrowseName="AlwaysGeneratesEvent">
+    <DisplayName>AlwaysGeneratesEvent</DisplayName>
+    <Description>The type for references from a node to an event type that is always raised by node.</Description>
+    <References>
+      <Reference ReferenceType="HasSubtype" IsForward="false">i=32</Reference>
+    </References>
+    <InverseName>AlwaysGeneratesEvent</InverseName>
+  </UAReferenceType>
+  <UAReferenceType NodeId="i=44" BrowseName="Aggregates">
+    <DisplayName>Aggregates</DisplayName>
+    <Description>The type for non-looping hierarchical references that are used to aggregate nodes into complex types.</Description>
+    <References>
+      <Reference ReferenceType="HasSubtype" IsForward="false">i=34</Reference>
+    </References>
+    <InverseName>AggregatedBy</InverseName>
+  </UAReferenceType>
+  <UAReferenceType NodeId="i=45" BrowseName="HasSubtype">
+    <DisplayName>HasSubtype</DisplayName>
+    <Description>The type for non-looping hierarchical references that are used to define sub types.</Description>
+    <References>
+      <Reference ReferenceType="HasSubtype" IsForward="false">i=34</Reference>
+    </References>
+    <InverseName>HasSupertype</InverseName>
+  </UAReferenceType>
+  <UAReferenceType NodeId="i=46" BrowseName="HasProperty">
+    <DisplayName>HasProperty</DisplayName>
+    <Description>The type for non-looping hierarchical reference from a node to its property.</Description>
+    <References>
+      <Reference ReferenceType="HasSubtype" IsForward="false">i=44</Reference>
+    </References>
+    <InverseName>PropertyOf</InverseName>
+  </UAReferenceType>
+  <UAReferenceType NodeId="i=47" BrowseName="HasComponent">
+    <DisplayName>HasComponent</DisplayName>
+    <Description>The type for non-looping hierarchical reference from a node to its component.</Description>
+    <References>
+      <Reference ReferenceType="HasSubtype" IsForward="false">i=44</Reference>
+    </References>
+    <InverseName>ComponentOf</InverseName>
+  </UAReferenceType>
+  <UAReferenceType NodeId="i=48" BrowseName="HasNotifier">
+    <DisplayName>HasNotifier</DisplayName>
+    <Description>The type for non-looping hierarchical references that are used to indicate how events propagate from node to node.</Description>
+    <References>
+      <Reference ReferenceType="HasSubtype" IsForward="false">i=36</Reference>
+    </References>
+    <InverseName>NotifierOf</InverseName>
+  </UAReferenceType>
+  <UAReferenceType NodeId="i=49" BrowseName="HasOrderedComponent">
+    <DisplayName>HasOrderedComponent</DisplayName>
+    <Description>The type for non-looping hierarchical reference from a node to its component when the order of references matters.</Description>
+    <References>
+      <Reference ReferenceType="HasSubtype" IsForward="false">i=47</Reference>
+    </References>
+    <InverseName>OrderedComponentOf</InverseName>
+  </UAReferenceType>
+  <UADataType NodeId="i=120" BrowseName="NamingRuleType">
+    <DisplayName>NamingRuleType</DisplayName>
+    <Description>Describes a value that specifies the significance of the BrowseName for an instance declaration.</Description>
+    <References>
+      <Reference ReferenceType="HasProperty">i=12169</Reference>
+      <Reference ReferenceType="HasSubtype" IsForward="false">i=29</Reference>
+    </References>
+    <Definition Name="NamingRuleType">
+      <Field Name="Mandatory" Value="1">
+        <Description>The BrowseName must appear in all instances of the type.</Description>
+      </Field>
+      <Field Name="Optional" Value="2">
+        <Description>The BrowseName may appear in an instance of the type.</Description>
+      </Field>
+      <Field Name="Constraint" Value="3">
+        <Description>The modelling rule defines a constraint and the BrowseName is not used in an instance of the type.</Description>
+      </Field>
+    </Definition>
+  </UADataType>
+  <UAVariable NodeId="i=12169" BrowseName="EnumValues" ParentNodeId="i=120" DataType="i=7594" ValueRank="1">
+    <DisplayName>EnumValues</DisplayName>
+    <References>
+      <Reference ReferenceType="HasTypeDefinition">i=68</Reference>
+      <Reference ReferenceType="HasModellingRule">i=78</Reference>
+      <Reference ReferenceType="HasProperty" IsForward="false">i=120</Reference>
+    </References>
+    <Value>
+      <ListOfExtensionObject xmlns="http://opcfoundation.org/UA/2008/02/Types.xsd">
+        <ExtensionObject>
+          <TypeId>
+            <Identifier>i=7616</Identifier>
+          </TypeId>
+          <Body>
+            <EnumValueType>
+              <Value>1</Value>
+              <DisplayName>
+                <Locale>
+                </Locale>
+                <Text>Mandatory</Text>
+              </DisplayName>
+              <Description>
+                <Locale>
+                </Locale>
+                <Text>The BrowseName must appear in all instances of the type.</Text>
+              </Description>
+            </EnumValueType>
+          </Body>
+        </ExtensionObject>
+        <ExtensionObject>
+          <TypeId>
+            <Identifier>i=7616</Identifier>
+          </TypeId>
+          <Body>
+            <EnumValueType>
+              <Value>2</Value>
+              <DisplayName>
+                <Locale>
+                </Locale>
+                <Text>Optional</Text>
+              </DisplayName>
+              <Description>
+                <Locale>
+                </Locale>
+                <Text>The BrowseName may appear in an instance of the type.</Text>
+              </Description>
+            </EnumValueType>
+          </Body>
+        </ExtensionObject>
+        <ExtensionObject>
+          <TypeId>
+            <Identifier>i=7616</Identifier>
+          </TypeId>
+          <Body>
+            <EnumValueType>
+              <Value>3</Value>
+              <DisplayName>
+                <Locale>
+                </Locale>
+                <Text>Constraint</Text>
+              </DisplayName>
+              <Description>
+                <Locale>
+                </Locale>
+                <Text>The modelling rule defines a constraint and the BrowseName is not used in an instance of the type.</Text>
+              </Description>
+            </EnumValueType>
+          </Body>
+        </ExtensionObject>
+      </ListOfExtensionObject>
+    </Value>
+  </UAVariable>
+  <UAVariable NodeId="i=3068" BrowseName="NodeVersion" DataType="String" ValueRank="-2">
+    <DisplayName>NodeVersion</DisplayName>
+    <Description>The version number of the node (used to indicate changes to references of the owning node).</Description>
+    <References>
+      <Reference ReferenceType="HasTypeDefinition">i=68</Reference>
+    </References>
+  </UAVariable>
+  <UAVariable NodeId="i=12170" BrowseName="ViewVersion" DataType="UInt32" ValueRank="-2">
+    <DisplayName>ViewVersion</DisplayName>
+    <Description>The version number of the view.</Description>
+    <References>
+      <Reference ReferenceType="HasTypeDefinition">i=68</Reference>
+    </References>
+  </UAVariable>
+  <UAVariable NodeId="i=3067" BrowseName="Icon" DataType="i=30" ValueRank="-2">
+    <DisplayName>Icon</DisplayName>
+    <Description>A small image representing the object.</Description>
+    <References>
+      <Reference ReferenceType="HasTypeDefinition">i=68</Reference>
+    </References>
+  </UAVariable>
+  <UAVariable NodeId="i=3069" BrowseName="LocalTime" DataType="i=8912" ValueRank="-2">
+    <DisplayName>LocalTime</DisplayName>
+    <Description>The local time where the owning variable value was collected.</Description>
+    <References>
+      <Reference ReferenceType="HasTypeDefinition">i=68</Reference>
+    </References>
+  </UAVariable>
+  <UAVariable NodeId="i=3070" BrowseName="AllowNulls" DataType="Boolean" ValueRank="-2">
+    <DisplayName>AllowNulls</DisplayName>
+    <Description>Whether the value of the owning variable is allowed to be null.</Description>
+    <References>
+      <Reference ReferenceType="HasTypeDefinition">i=68</Reference>
+    </References>
+  </UAVariable>
+  <UAVariable NodeId="i=11433" BrowseName="ValueAsText" DataType="LocalizedText" ValueRank="-2">
+    <DisplayName>ValueAsText</DisplayName>
+    <Description>The string representation of the current value for a variable with an enumerated data type.</Description>
+    <References>
+      <Reference ReferenceType="HasTypeDefinition">i=68</Reference>
+    </References>
+  </UAVariable>
+  <UAVariable NodeId="i=11498" BrowseName="MaxStringLength" DataType="UInt32" ValueRank="-2">
+    <DisplayName>MaxStringLength</DisplayName>
+    <Description>The maximum length for a string that can be stored in the owning variable.</Description>
+    <References>
+      <Reference ReferenceType="HasTypeDefinition">i=68</Reference>
+    </References>
+  </UAVariable>
+  <UAVariable NodeId="i=11512" BrowseName="MaxArrayLength" DataType="UInt32" ValueRank="-2">
+    <DisplayName>MaxArrayLength</DisplayName>
+    <Description>The maximum length for an array that can be stored in the owning variable.</Description>
+    <References>
+      <Reference ReferenceType="HasTypeDefinition">i=68</Reference>
+    </References>
+  </UAVariable>
+  <UAVariable NodeId="i=11513" BrowseName="EngineeringUnits" DataType="i=887" ValueRank="-2">
+    <DisplayName>EngineeringUnits</DisplayName>
+    <Description>The engineering units for the value of the owning variable.</Description>
+    <References>
+      <Reference ReferenceType="HasTypeDefinition">i=68</Reference>
+    </References>
+  </UAVariable>
+  <UAVariable NodeId="i=11432" BrowseName="EnumStrings" DataType="LocalizedText" ValueRank="1">
+    <DisplayName>EnumStrings</DisplayName>
+    <Description>The human readable strings associated with the values of an enumerated value (when values are sequential).</Description>
+    <References>
+      <Reference ReferenceType="HasTypeDefinition">i=68</Reference>
+    </References>
+  </UAVariable>
+  <UAVariable NodeId="i=3071" BrowseName="EnumValues" DataType="i=7594" ValueRank="1">
+    <DisplayName>EnumValues</DisplayName>
+    <Description>The human readable strings associated with the values of an enumerated value (when values have no sequence).</Description>
+    <References>
+      <Reference ReferenceType="HasTypeDefinition">i=68</Reference>
+    </References>
+  </UAVariable>
+  <UAVariable NodeId="i=3072" BrowseName="InputArguments" DataType="i=296" ValueRank="1">
+    <DisplayName>InputArguments</DisplayName>
+    <Description>The input arguments for a method.</Description>
+    <References>
+      <Reference ReferenceType="HasTypeDefinition">i=68</Reference>
+    </References>
+  </UAVariable>
+  <UAVariable NodeId="i=3073" BrowseName="OutputArguments" DataType="i=296" ValueRank="1">
+    <DisplayName>OutputArguments</DisplayName>
+    <Description>The output arguments for a method.</Description>
+    <References>
+      <Reference ReferenceType="HasTypeDefinition">i=68</Reference>
+    </References>
+  </UAVariable>
+  <UADataType NodeId="i=2000" BrowseName="ImageBMP">
+    <DisplayName>ImageBMP</DisplayName>
+    <Description>An image encoded in BMP format.</Description>
+    <References>
+      <Reference ReferenceType="HasSubtype" IsForward="false">i=30</Reference>
+    </References>
+  </UADataType>
+  <UADataType NodeId="i=2001" BrowseName="ImageGIF">
+    <DisplayName>ImageGIF</DisplayName>
+    <Description>An image encoded in GIF format.</Description>
+    <References>
+      <Reference ReferenceType="HasSubtype" IsForward="false">i=30</Reference>
+    </References>
+  </UADataType>
+  <UADataType NodeId="i=2002" BrowseName="ImageJPG">
+    <DisplayName>ImageJPG</DisplayName>
+    <Description>An image encoded in JPEG format.</Description>
+    <References>
+      <Reference ReferenceType="HasSubtype" IsForward="false">i=30</Reference>
+    </References>
+  </UADataType>
+  <UADataType NodeId="i=2003" BrowseName="ImagePNG">
+    <DisplayName>ImagePNG</DisplayName>
+    <Description>An image encoded in PNG format.</Description>
+    <References>
+      <Reference ReferenceType="HasSubtype" IsForward="false">i=30</Reference>
+    </References>
+  </UADataType>
+  <UADataType NodeId="i=256" BrowseName="IdType">
+    <DisplayName>IdType</DisplayName>
+    <Description>The type of identifier used in a node id.</Description>
+    <References>
+      <Reference ReferenceType="HasProperty">i=7591</Reference>
+      <Reference ReferenceType="HasSubtype" IsForward="false">i=29</Reference>
+    </References>
+    <Definition Name="IdType">
+      <Field Name="Numeric" Value="0">
+        <Description>The identifier is a numeric value. 0 is a null value.</Description>
+      </Field>
+      <Field Name="String" Value="1">
+        <Description>The identifier is a string value. An empty string is a null value.</Description>
+      </Field>
+      <Field Name="Guid" Value="2">
+        <Description>The identifier is a 16 byte structure. 16 zero bytes is a null value.</Description>
+      </Field>
+      <Field Name="Opaque" Value="3">
+        <Description>The identifier is an array of bytes. A zero length array is a null value.</Description>
+      </Field>
+    </Definition>
+  </UADataType>
+  <UAVariable NodeId="i=7591" BrowseName="EnumStrings" ParentNodeId="i=256" DataType="LocalizedText" ValueRank="1">
+    <DisplayName>EnumStrings</DisplayName>
+    <References>
+      <Reference ReferenceType="HasTypeDefinition">i=68</Reference>
+      <Reference ReferenceType="HasModellingRule">i=78</Reference>
+      <Reference ReferenceType="HasProperty" IsForward="false">i=256</Reference>
+    </References>
+    <Value>
+      <ListOfLocalizedText xmlns="http://opcfoundation.org/UA/2008/02/Types.xsd">
+        <LocalizedText>
+          <Locale>
+          </Locale>
+          <Text>Numeric</Text>
+        </LocalizedText>
+        <LocalizedText>
+          <Locale>
+          </Locale>
+          <Text>String</Text>
+        </LocalizedText>
+        <LocalizedText>
+          <Locale>
+          </Locale>
+          <Text>Guid</Text>
+        </LocalizedText>
+        <LocalizedText>
+          <Locale>
+          </Locale>
+          <Text>Opaque</Text>
+        </LocalizedText>
+      </ListOfLocalizedText>
+    </Value>
+  </UAVariable>
+  <UADataType NodeId="i=257" BrowseName="NodeClass">
+    <DisplayName>NodeClass</DisplayName>
+    <Description>A mask specifying the class of the node.</Description>
+    <References>
+      <Reference ReferenceType="HasProperty">i=11878</Reference>
+      <Reference ReferenceType="HasSubtype" IsForward="false">i=29</Reference>
+    </References>
+    <Definition Name="NodeClass">
+      <Field Name="Unspecified" Value="0">
+        <Description>No classes are selected.</Description>
+      </Field>
+      <Field Name="Object" Value="1">
+        <Description>The node is an object.</Description>
+      </Field>
+      <Field Name="Variable" Value="2">
+        <Description>The node is a variable.</Description>
+      </Field>
+      <Field Name="Method" Value="4">
+        <Description>The node is a method.</Description>
+      </Field>
+      <Field Name="ObjectType" Value="8">
+        <Description>The node is an object type.</Description>
+      </Field>
+      <Field Name="VariableType" Value="16">
+        <Description>The node is an variable type.</Description>
+      </Field>
+      <Field Name="ReferenceType" Value="32">
+        <Description>The node is a reference type.</Description>
+      </Field>
+      <Field Name="DataType" Value="64">
+        <Description>The node is a data type.</Description>
+      </Field>
+      <Field Name="View" Value="128">
+        <Description>The node is a view.</Description>
+      </Field>
+    </Definition>
+  </UADataType>
+  <UAVariable NodeId="i=11878" BrowseName="EnumValues" ParentNodeId="i=257" DataType="i=7594" ValueRank="1">
+    <DisplayName>EnumValues</DisplayName>
+    <References>
+      <Reference ReferenceType="HasTypeDefinition">i=68</Reference>
+      <Reference ReferenceType="HasModellingRule">i=78</Reference>
+      <Reference ReferenceType="HasProperty" IsForward="false">i=257</Reference>
+    </References>
+    <Value>
+      <ListOfExtensionObject xmlns="http://opcfoundation.org/UA/2008/02/Types.xsd">
+        <ExtensionObject>
+          <TypeId>
+            <Identifier>i=7616</Identifier>
+          </TypeId>
+          <Body>
+            <EnumValueType>
+              <Value>0</Value>
+              <DisplayName>
+                <Locale>
+                </Locale>
+                <Text>Unspecified</Text>
+              </DisplayName>
+              <Description>
+                <Locale>
+                </Locale>
+                <Text>No classes are selected.</Text>
+              </Description>
+            </EnumValueType>
+          </Body>
+        </ExtensionObject>
+        <ExtensionObject>
+          <TypeId>
+            <Identifier>i=7616</Identifier>
+          </TypeId>
+          <Body>
+            <EnumValueType>
+              <Value>1</Value>
+              <DisplayName>
+                <Locale>
+                </Locale>
+                <Text>Object</Text>
+              </DisplayName>
+              <Description>
+                <Locale>
+                </Locale>
+                <Text>The node is an object.</Text>
+              </Description>
+            </EnumValueType>
+          </Body>
+        </ExtensionObject>
+        <ExtensionObject>
+          <TypeId>
+            <Identifier>i=7616</Identifier>
+          </TypeId>
+          <Body>
+            <EnumValueType>
+              <Value>2</Value>
+              <DisplayName>
+                <Locale>
+                </Locale>
+                <Text>Variable</Text>
+              </DisplayName>
+              <Description>
+                <Locale>
+                </Locale>
+                <Text>The node is a variable.</Text>
+              </Description>
+            </EnumValueType>
+          </Body>
+        </ExtensionObject>
+        <ExtensionObject>
+          <TypeId>
+            <Identifier>i=7616</Identifier>
+          </TypeId>
+          <Body>
+            <EnumValueType>
+              <Value>4</Value>
+              <DisplayName>
+                <Locale>
+                </Locale>
+                <Text>Method</Text>
+              </DisplayName>
+              <Description>
+                <Locale>
+                </Locale>
+                <Text>The node is a method.</Text>
+              </Description>
+            </EnumValueType>
+          </Body>
+        </ExtensionObject>
+        <ExtensionObject>
+          <TypeId>
+            <Identifier>i=7616</Identifier>
+          </TypeId>
+          <Body>
+            <EnumValueType>
+              <Value>8</Value>
+              <DisplayName>
+                <Locale>
+                </Locale>
+                <Text>ObjectType</Text>
+              </DisplayName>
+              <Description>
+                <Locale>
+                </Locale>
+                <Text>The node is an object type.</Text>
+              </Description>
+            </EnumValueType>
+          </Body>
+        </ExtensionObject>
+        <ExtensionObject>
+          <TypeId>
+            <Identifier>i=7616</Identifier>
+          </TypeId>
+          <Body>
+            <EnumValueType>
+              <Value>16</Value>
+              <DisplayName>
+                <Locale>
+                </Locale>
+                <Text>VariableType</Text>
+              </DisplayName>
+              <Description>
+                <Locale>
+                </Locale>
+                <Text>The node is an variable type.</Text>
+              </Description>
+            </EnumValueType>
+          </Body>
+        </ExtensionObject>
+        <ExtensionObject>
+          <TypeId>
+            <Identifier>i=7616</Identifier>
+          </TypeId>
+          <Body>
+            <EnumValueType>
+              <Value>32</Value>
+              <DisplayName>
+                <Locale>
+                </Locale>
+                <Text>ReferenceType</Text>
+              </DisplayName>
+              <Description>
+                <Locale>
+                </Locale>
+                <Text>The node is a reference type.</Text>
+              </Description>
+            </EnumValueType>
+          </Body>
+        </ExtensionObject>
+        <ExtensionObject>
+          <TypeId>
+            <Identifier>i=7616</Identifier>
+          </TypeId>
+          <Body>
+            <EnumValueType>
+              <Value>64</Value>
+              <DisplayName>
+                <Locale>
+                </Locale>
+                <Text>DataType</Text>
+              </DisplayName>
+              <Description>
+                <Locale>
+                </Locale>
+                <Text>The node is a data type.</Text>
+              </Description>
+            </EnumValueType>
+          </Body>
+        </ExtensionObject>
+        <ExtensionObject>
+          <TypeId>
+            <Identifier>i=7616</Identifier>
+          </TypeId>
+          <Body>
+            <EnumValueType>
+              <Value>128</Value>
+              <DisplayName>
+                <Locale>
+                </Locale>
+                <Text>View</Text>
+              </DisplayName>
+              <Description>
+                <Locale>
+                </Locale>
+                <Text>The node is a view.</Text>
+              </Description>
+            </EnumValueType>
+          </Body>
+        </ExtensionObject>
+      </ListOfExtensionObject>
+    </Value>
+  </UAVariable>
+  <UADataType NodeId="i=296" BrowseName="Argument">
+    <DisplayName>Argument</DisplayName>
+    <Description>An argument for a method.</Description>
+    <References>
+      <Reference ReferenceType="HasSubtype" IsForward="false">i=22</Reference>
+    </References>
+    <Definition Name="Argument">
+      <Field Name="Name" DataType="i=12">
+        <Description>The name of the argument.</Description>
+      </Field>
+      <Field Name="DataType" DataType="i=17">
+        <Description>The data type of the argument.</Description>
+      </Field>
+      <Field Name="ValueRank" DataType="i=6">
+        <Description>Whether the argument is an array type and the rank of the array if it is.</Description>
+      </Field>
+      <Field Name="ArrayDimensions" DataType="i=7" ValueRank="1">
+        <Description>The number of dimensions if the argument is an array type and one or more dimensions have a fixed length.</Description>
+      </Field>
+      <Field Name="Description" DataType="i=21">
+        <Description>The description for the argument.</Description>
+      </Field>
+    </Definition>
+  </UADataType>
+  <UADataType NodeId="i=7594" BrowseName="EnumValueType">
+    <DisplayName>EnumValueType</DisplayName>
+    <Description>A mapping between a value of an enumerated type and a name and description.</Description>
+    <References>
+      <Reference ReferenceType="HasSubtype" IsForward="false">i=22</Reference>
+    </References>
+    <Definition Name="EnumValueType">
+      <Field Name="Value" DataType="i=8">
+        <Description>The value of the enumeration.</Description>
+      </Field>
+      <Field Name="DisplayName" DataType="i=21">
+        <Description>Human readable name for the value.</Description>
+      </Field>
+      <Field Name="Description" DataType="i=21">
+        <Description>A description of the value.</Description>
+      </Field>
+    </Definition>
+  </UADataType>
+  <UADataType NodeId="i=290" BrowseName="Duration">
+    <DisplayName>Duration</DisplayName>
+    <Description>A period of time measured in seconds.</Description>
+    <References>
+      <Reference ReferenceType="HasSubtype" IsForward="false">i=11</Reference>
+    </References>
+  </UADataType>
+  <UADataType NodeId="i=294" BrowseName="UtcTime">
+    <DisplayName>UtcTime</DisplayName>
+    <Description>A date/time value specified in Universal Coordinated Time (UTC).</Description>
+    <References>
+      <Reference ReferenceType="HasSubtype" IsForward="false">i=13</Reference>
+    </References>
+  </UADataType>
+  <UADataType NodeId="i=295" BrowseName="LocaleId">
+    <DisplayName>LocaleId</DisplayName>
+    <Description>An identifier for a user locale.</Description>
+    <References>
+      <Reference ReferenceType="HasSubtype" IsForward="false">i=12</Reference>
+    </References>
+  </UADataType>
+  <UADataType NodeId="i=8912" BrowseName="TimeZoneDataType">
+    <DisplayName>TimeZoneDataType</DisplayName>
+    <References>
+      <Reference ReferenceType="HasSubtype" IsForward="false">i=22</Reference>
+    </References>
+    <Definition Name="TimeZoneDataType">
+      <Field Name="Offset" DataType="i=4" />
+      <Field Name="DaylightSavingInOffset" DataType="i=1" />
+    </Definition>
+  </UADataType>
+  <UAObject NodeId="i=297" BrowseName="Default XML" SymbolicName="DefaultXml">
+    <DisplayName>Default XML</DisplayName>
+    <References>
+      <Reference ReferenceType="HasEncoding" IsForward="false">i=296</Reference>
+      <Reference ReferenceType="HasDescription">i=8285</Reference>
+      <Reference ReferenceType="HasTypeDefinition">i=76</Reference>
+    </References>
+  </UAObject>
+  <UAObject NodeId="i=7616" BrowseName="Default XML" SymbolicName="DefaultXml">
+    <DisplayName>Default XML</DisplayName>
+    <References>
+      <Reference ReferenceType="HasEncoding" IsForward="false">i=7594</Reference>
+      <Reference ReferenceType="HasDescription">i=8291</Reference>
+      <Reference ReferenceType="HasTypeDefinition">i=76</Reference>
+    </References>
+  </UAObject>
+  <UAObject NodeId="i=8913" BrowseName="Default XML" SymbolicName="DefaultXml">
+    <DisplayName>Default XML</DisplayName>
+    <References>
+      <Reference ReferenceType="HasEncoding" IsForward="false">i=8912</Reference>
+      <Reference ReferenceType="HasDescription">i=8918</Reference>
+      <Reference ReferenceType="HasTypeDefinition">i=76</Reference>
+    </References>
+  </UAObject>
+  <UAObject NodeId="i=298" BrowseName="Default Binary" SymbolicName="DefaultBinary">
+    <DisplayName>Default Binary</DisplayName>
+    <References>
+      <Reference ReferenceType="HasEncoding" IsForward="false">i=296</Reference>
+      <Reference ReferenceType="HasDescription">i=7650</Reference>
+      <Reference ReferenceType="HasTypeDefinition">i=76</Reference>
+    </References>
+  </UAObject>
+  <UAObject NodeId="i=8251" BrowseName="Default Binary" SymbolicName="DefaultBinary">
+    <DisplayName>Default Binary</DisplayName>
+    <References>
+      <Reference ReferenceType="HasEncoding" IsForward="false">i=7594</Reference>
+      <Reference ReferenceType="HasDescription">i=7656</Reference>
+      <Reference ReferenceType="HasTypeDefinition">i=76</Reference>
+    </References>
+  </UAObject>
+  <UAObject NodeId="i=8917" BrowseName="Default Binary" SymbolicName="DefaultBinary">
+    <DisplayName>Default Binary</DisplayName>
+    <References>
+      <Reference ReferenceType="HasEncoding" IsForward="false">i=8912</Reference>
+      <Reference ReferenceType="HasDescription">i=8914</Reference>
+      <Reference ReferenceType="HasTypeDefinition">i=76</Reference>
+    </References>
+  </UAObject>
+</UANodeSet>

File diff suppressed because it is too large
+ 2908 - 0
examples/src/Opc.Ua.NodeSet2.Part4.xml


File diff suppressed because it is too large
+ 14609 - 0
examples/src/Opc.Ua.NodeSet2.Part5.xml


+ 513 - 0
examples/src/xml2ns0.c

@@ -0,0 +1,513 @@
+/*
+ * xml2ns0.c
+ *
+ *  Created on: 21.04.2014
+ *      Author: mrt
+ */
+
+#include <expat.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h> // strlen
+#include <ctype.h> // isspace
+#include <unistd.h> // read
+
+#include "opcua.h"
+#include "ua_namespace.h"
+
+// some typedefs for typical arguments in this module
+typedef char const * const XML_Attr_t;
+typedef char const * cstring_t;
+
+// FIXME: We might want to have these classes and their methods defined in opcua.h
+/** NodeSetAlias - a readable shortcut for References */
+typedef struct UA_NodeSetAlias_T {
+	UA_String alias;
+	UA_String value;
+} UA_NodeSetAlias;
+UA_Int32 UA_NodeSetAlias_init(UA_NodeSetAlias* p) {
+	UA_String_init(&(p->alias));
+	UA_String_init(&(p->value));
+	return UA_SUCCESS;
+}
+UA_Int32 UA_NodeSetAlias_new(UA_NodeSetAlias** p) {
+	UA_alloc((void** )p, sizeof(UA_NodeSetAlias));
+	UA_NodeSetAlias_init(*p);
+	return UA_SUCCESS;
+}
+/* The current set of aliases */
+typedef struct UA_NodeSetAliases_T {
+	UA_Int32 size;
+	UA_NodeSetAlias** aliases;
+} UA_NodeSetAliases;
+UA_Int32 UA_NodeSetAliases_init(UA_NodeSetAliases* p) {
+	p->size = -1;
+	p->aliases = UA_NULL;
+	return UA_SUCCESS;
+}
+UA_Int32 UA_NodeSetAliases_new(UA_NodeSetAliases** p) {
+	UA_alloc((void** )p, sizeof(UA_NodeSetAliases));
+	UA_NodeSetAliases_init(*p);
+	return UA_SUCCESS;
+}
+UA_Int32 UA_NodeSetAliases_println(cstring_t label, UA_NodeSetAliases *p) {
+	UA_Int32 i;
+	for (i = 0; i < p->size; i++) {
+		UA_NodeSetAlias* a = p->aliases[i];
+		printf("Alias addr=%p", (void*)a);
+		if (a) {
+			printf("'%.*s'='%.*s", a->alias.length, a->alias.data, a->value.length, a->value.data);
+		}
+		printf("\n");
+	}
+	return UA_SUCCESS;
+}
+
+/* A nodeset consist of a namespace and a list of aliases */
+typedef struct T_UA_NodeSet {
+	namespace* ns;
+	UA_NodeSetAliases aliases;
+} UA_NodeSet;
+UA_Int32 UA_NodeSet_init(UA_NodeSet* p) {
+	create_ns(&(p->ns), 100);
+	p->aliases.size = -1;
+	p->aliases.aliases = UA_NULL;
+	return UA_SUCCESS;
+}
+UA_Int32 UA_NodeSet_new(UA_NodeSet** p) {
+	UA_alloc((void** )p, sizeof(UA_NodeSet));
+	UA_NodeSet_init(*p);
+	return UA_SUCCESS;
+}
+UA_Int32 UA_NodeId_copycstring(cstring_t src, UA_NodeId* dst, UA_NodeSetAliases* aliases) {
+	dst->encodingByte = UA_NODEIDTYPE_FOURBYTE;
+	dst->namespace = 0;
+	// FIXME: assumes i=nnnn, does not care for aliases as of now
+	dst->identifier.numeric = atoi(&src[2]);
+	return UA_SUCCESS;
+}
+
+/* the stack and it's elements */
+#define XML_STACK_MAX_DEPTH 10
+#define XML_STACK_MAX_CHILDREN 40
+struct XML_Stack;
+typedef UA_Int32 (*XML_decoder)(struct XML_Stack* s, XML_Attr_t* attr, void* dst, _Bool isStart);
+typedef struct XML_child {
+	cstring_t name;
+	UA_Int32 type;
+	XML_decoder elementHandler;
+	void* obj;
+} XML_child_t;
+
+typedef struct XML_Parent {
+	cstring_t name;
+	int textAttribIdx; // -1 - not set
+	cstring_t textAttrib;
+	int activeChild; // -1 - no active child
+	int len; // -1 - empty set
+	XML_child_t children[XML_STACK_MAX_CHILDREN];
+} XML_Parent_t;
+
+typedef struct XML_Stack {
+	int depth;
+	XML_Parent_t parent[XML_STACK_MAX_DEPTH];
+	UA_NodeSetAliases* aliases; // shall point to the aliases of the NodeSet after reading
+} XML_Stack_t;
+
+void XML_Stack_init(XML_Stack_t* p, cstring_t name) {
+	unsigned int i, j;
+	p->depth = 0;
+	for (i = 0; i < XML_STACK_MAX_DEPTH; i++) {
+		p->parent[i].name = UA_NULL;
+		p->parent[i].len = 0;
+		p->parent[i].activeChild = -1;
+		p->parent[i].textAttrib = UA_NULL;
+		p->parent[i].textAttribIdx = -1;
+		for (j = 0; j < XML_STACK_MAX_CHILDREN; j++) {
+			p->parent[i].children[j].name = UA_NULL;
+			p->parent[i].children[j].elementHandler = UA_NULL;
+			p->parent[i].children[j].type = UA_INVALIDTYPE;
+			p->parent[i].children[j].obj = UA_NULL;
+		}
+	}
+	p->parent[0].name = name;
+}
+
+void XML_Stack_print(XML_Stack_t* s) {
+	UA_Int32 i;
+	for (i = 0; i <= s->depth; i++) {
+		printf("%s.", s->parent[i].name);
+	}
+}
+
+// FIXME: we might want to calculate textAttribIdx
+void XML_Stack_handleTextAs(XML_Stack_t* p, cstring_t textAttrib, unsigned int textAttribIdx) {
+	p->parent[p->depth].textAttrib = textAttrib;
+	p->parent[p->depth].textAttribIdx = textAttribIdx;
+}
+
+void XML_Stack_addChildHandler(XML_Stack_t* p, cstring_t name, XML_decoder handler, UA_Int32 type, void* dst) {
+	unsigned int len = p->parent[p->depth].len;
+	p->parent[p->depth].children[len].name = name;
+	p->parent[p->depth].children[len].elementHandler = handler;
+	p->parent[p->depth].children[len].type = type;
+	p->parent[p->depth].children[len].obj = dst;
+	p->parent[p->depth].len++;
+}
+
+UA_Int32 UA_Array_decodeXML(XML_Stack_t* s, XML_Attr_t* attr, void* dst, _Bool isStart) {
+	// FIXME: Implement
+	return UA_SUCCESS;
+}
+
+UA_Int32 UA_Int32_decodeXML(XML_Stack_t* s, XML_Attr_t* attr, UA_Int32* dst, _Bool isStart) {
+	DBG_VERBOSE(printf("UA_Int32 entered with dst=%p,isStart=%d\n", (void*) dst,isStart));
+	if (isStart) {
+		if (dst == UA_NULL) {
+			UA_Int32_new(&dst);
+			s->parent[s->depth - 1].children[s->parent[s->depth - 1].activeChild].obj = (void*) dst;
+		}
+		*dst = atoi(attr[1]);
+	} else {
+		// TODO: It is a design flaw that we need to do this here, isn't it?
+		s->parent[s->depth - 1].children[s->parent[s->depth - 1].activeChild].obj =
+		UA_NULL;
+	}
+	return UA_SUCCESS;
+}
+
+UA_Int32 UA_String_decodeXML(XML_Stack_t* s, XML_Attr_t* attr, UA_String* dst, _Bool isStart) {
+	DBG_VERBOSE(printf("UA_String entered with dst=%p,isStart=%d\n", (void*) dst,isStart));
+	UA_UInt32 i;
+	if (isStart) {
+		if (dst == UA_NULL) {
+			UA_String_new(&dst);
+			s->parent[s->depth - 1].children[s->parent[s->depth - 1].activeChild].obj = (void*) dst;
+		}
+		s->parent[s->depth].len = 0;
+		XML_Stack_addChildHandler(s, "Data", (XML_decoder) UA_Array_decodeXML, UA_BYTE, &(dst->data));
+		XML_Stack_addChildHandler(s, "Length", (XML_decoder) UA_Int32_decodeXML, UA_INT32, &(dst->length));
+		XML_Stack_handleTextAs(s, "Data", 0);
+
+		// set attributes
+		for (i = 0; attr[i]; i += 2) {
+			if (0 == strncmp("Data", attr[i], strlen("Data"))) {
+				UA_String_copycstring(attr[i + 1], dst);
+			} else {
+				perror("Unknown attribute");
+			}
+		}
+	} else {
+		// TODO: It is a design flaw that we need to do this here, isn't it?
+		DBG_VERBOSE(printf("UA_String clears %p\n", (void*) (s->parent[s->depth - 1].children[s->parent[s->depth - 1].activeChild].obj)));
+		s->parent[s->depth - 1].children[s->parent[s->depth - 1].activeChild].obj =	 UA_NULL;
+	}
+	return UA_SUCCESS;
+}
+
+UA_Int32 UA_LocalizedText_decodeXML(XML_Stack_t* s, XML_Attr_t* attr, UA_LocalizedText* dst, _Bool isStart) {
+	DBG_VERBOSE(printf("UA_LocalizedText entered with dst=%p,isStart=%d\n", (void*) dst,isStart));
+	UA_UInt32 i;
+	if (isStart) {
+		if (dst == UA_NULL) {
+			UA_LocalizedText_new(&dst);
+			s->parent[s->depth - 1].children[s->parent[s->depth - 1].activeChild].obj = (void*) dst;
+		}
+		s->parent[s->depth].len = 0;
+		XML_Stack_addChildHandler(s, "Text", (XML_decoder) UA_String_decodeXML, UA_STRING, &(dst->text));
+		XML_Stack_addChildHandler(s, "Locale", (XML_decoder) UA_String_decodeXML, UA_STRING, &(dst->locale));
+		XML_Stack_handleTextAs(s, "Data", 0);
+
+		// set attributes
+		for (i = 0; attr[i]; i += 2) {
+			if (0 == strncmp("Text", attr[i], strlen("Text"))) {
+				UA_String_copycstring(attr[i + 1], &(dst->text));
+				dst->encodingMask |= UA_LOCALIZEDTEXT_ENCODINGMASKTYPE_TEXT;
+			} else if (0 == strncmp("Locale", attr[i], strlen("Locale"))) {
+				UA_String_copycstring(attr[i + 1], &(dst->locale));
+				dst->encodingMask |= UA_LOCALIZEDTEXT_ENCODINGMASKTYPE_LOCALE;
+			} else {
+				perror("Unknown attribute");
+			}
+		}
+	} else {
+		switch (s->parent[s->depth - 1].activeChild) {
+		case 0:
+			dst->encodingMask |= UA_LOCALIZEDTEXT_ENCODINGMASKTYPE_TEXT;
+			break;
+		case 1:
+			dst->encodingMask |= UA_LOCALIZEDTEXT_ENCODINGMASKTYPE_LOCALE;
+			break;
+		default:
+			break;
+		}
+		// TODO: I think it is a design flaw that we need to do this here, isn't it?
+		DBG_VERBOSE(printf("UA_LocalizedText clears %p\n", (void*) (s->parent[s->depth - 1].children[s->parent[s->depth - 1].activeChild].obj)));
+		s->parent[s->depth - 1].children[s->parent[s->depth - 1].activeChild].obj = UA_NULL;
+	}
+	return UA_SUCCESS;
+}
+
+UA_Int32 UA_DataTypeNode_decodeXML(XML_Stack_t* s, XML_Attr_t* attr, UA_DataTypeNode* dst, _Bool isStart) {
+	DBG_VERBOSE(printf("UA_DataTypeNode entered with dst=%p,isStart=%d\n", (void*) dst,isStart));
+	UA_UInt32 i;
+
+	if (isStart) {
+		// create a new object if called with UA_NULL
+		if (dst == UA_NULL) {
+			UA_DataTypeNode_new(&dst);
+			s->parent[s->depth - 1].children[s->parent[s->depth - 1].activeChild].obj = (void*) dst;
+		}
+
+		s->parent[s->depth].len = 0;
+		XML_Stack_addChildHandler(s, "DisplayName", (XML_decoder) UA_LocalizedText_decodeXML, UA_LOCALIZEDTEXT, &(dst->displayName));
+		XML_Stack_addChildHandler(s, "Description", (XML_decoder) UA_LocalizedText_decodeXML, UA_LOCALIZEDTEXT, &(dst->description));
+
+		// set missing default attributes
+		dst->nodeClass = UA_NODECLASS_DATATYPE;
+
+		// set attributes
+		for (i = 0; attr[i]; i += 2) {
+			if (0 == strncmp("NodeId", attr[i], strlen("NodeId"))) {
+				UA_NodeId_copycstring(attr[i + 1], &(dst->nodeId), s->aliases);
+			} else if (0 == strncmp("BrowseName", attr[i], strlen("BrowseName"))) {
+				UA_String_copycstring(attr[i + 1], &(dst->browseName.name));
+				dst->browseName.namespaceIndex = 0;
+			} else if (0 == strncmp("DisplayName", attr[i], strlen("DisplayName"))) {
+				UA_String_copycstring(attr[i + 1], &(dst->displayName.text));
+				dst->displayName.encodingMask = UA_LOCALIZEDTEXT_ENCODINGMASKTYPE_TEXT;
+			} else if (0 == strncmp("Description", attr[i], strlen("Description"))) {
+				UA_String_copycstring(attr[i + 1], &(dst->description.text));
+				dst->description.encodingMask = UA_LOCALIZEDTEXT_ENCODINGMASKTYPE_TEXT;
+			} else {
+				DBG_ERR(XML_Stack_print(s));DBG_ERR(printf("%s - unknown attribute\n",attr[i]));
+			}
+		}
+	} else {
+		// TODO: It is a design flaw that we need to do this here, isn't it?
+		DBG_VERBOSE(printf("UA_DataTypeNode clears %p\n", (void*) (s->parent[s->depth - 1].children[s->parent[s->depth - 1].activeChild].obj)));
+		s->parent[s->depth - 1].children[s->parent[s->depth - 1].activeChild].obj =
+		UA_NULL;
+	}
+	return UA_SUCCESS;
+}
+
+void print_node(UA_Node const * node) {
+	if (node != UA_NULL) {
+		UA_NodeId_printf("---------------------------\nnode.NodeId=", &(node->nodeId));
+		printf("node.browseName='%.*s'\n", node->browseName.name.length, node->browseName.name.data);
+	}
+}
+
+UA_Int32 UA_NodeSetAlias_decodeXML(XML_Stack_t* s, XML_Attr_t* attr, UA_NodeSetAlias* dst, _Bool isStart) {
+	DBG_VERBOSE(printf("UA_NodeSetAlias entered with dst=%p,isStart=%d\n", (void*) dst,isStart));
+	if (isStart) {
+		// create if necessary
+		if (dst == UA_NULL) {
+			UA_NodeSetAlias_new(&dst);
+			s->parent[s->depth - 1].children[s->parent[s->depth - 1].activeChild].obj = (void*) dst;
+		}
+		// set handlers
+		s->parent[s->depth].len = 0;
+		XML_Stack_addChildHandler(s, "Alias", (XML_decoder) UA_String_decodeXML, UA_STRING, &(dst->alias));
+		XML_Stack_addChildHandler(s, "Value", (XML_decoder) UA_String_decodeXML, UA_STRING, &(dst->value));
+		XML_Stack_handleTextAs(s, "Data", 1);
+
+		// set attributes
+		UA_Int32 i;
+		for (i = 0; attr[i]; i += 2) {
+			if (0 == strncmp("Alias", attr[i], strlen("Alias"))) {
+				UA_String_copycstring(attr[i + 1], &(dst->alias));
+			} else if (0 == strncmp("Value", attr[i], strlen("Value"))) {
+				UA_String_copycstring(attr[i + 1], &(dst->value));
+			} else {
+				DBG_ERR(XML_Stack_print(s));DBG_ERR(printf("%s - unknown attribute\n",attr[i]));
+			}
+		}
+	} else {
+		// sub element is ready
+		// TODO: It is a design flaw that we need to do this here, isn't it?
+		DBG_VERBOSE(printf("UA_NodeSetAlias clears %p\n", (void*) (s->parent[s->depth - 1].children[s->parent[s->depth - 1].activeChild].obj)));
+		s->parent[s->depth - 1].children[s->parent[s->depth - 1].activeChild].obj = UA_NULL;
+	}
+	return UA_SUCCESS;
+}
+
+UA_Int32 UA_NodeSetAliases_decodeXML(XML_Stack_t* s, XML_Attr_t* attr, UA_NodeSetAliases* dst, _Bool isStart) {
+	DBG_VERBOSE(printf("UA_NodeSetALiases entered with dst=%p,isStart=%d\n", (void*) dst,isStart));
+	if (isStart) {
+		if (dst == UA_NULL) {
+			UA_NodeSetAliases_new(&dst);
+			s->parent[s->depth - 1].children[s->parent[s->depth - 1].activeChild].obj = (void*) dst;
+		}
+		s->parent[s->depth].len = 0;
+		XML_Stack_addChildHandler(s, "Alias", (XML_decoder) UA_NodeSetAlias_decodeXML, UA_INVALIDTYPE, UA_NULL);
+	} else {
+		// sub element is ready, add to array
+		if (dst->size < 0 || dst->size == 0) {
+			dst->size = 1;
+			UA_alloc((void** )&(dst->aliases), dst->size * sizeof(UA_NodeSetAlias*));
+			DBG_VERBOSE(printf("allocate aliases:dst=%p, aliases=%p, size=%d\n",(void*)dst,(void*)(dst->aliases),dst->size));
+		} else {
+			dst->size++;
+			dst->aliases = realloc(dst->aliases, dst->size * sizeof(UA_NodeSetAlias*));
+			DBG_VERBOSE(printf("reallocate aliases:dst=%p, aliases=%p, size=%d\n",(void*)dst,(void*)(dst->aliases),dst->size));
+		}
+		// index starts with 0, therefore size-1
+		DBG_VERBOSE(printf("assign alias:dst=%p, src=%p\n",(void*)dst->aliases[dst->size - 1],(void*)attr));
+		dst->aliases[dst->size - 1] = (UA_NodeSetAlias*) attr;
+		// TODO: It is a design flaw that we need to do this here, isn't it?
+		DBG_VERBOSE(printf("UA_NodeSetAliases clears %p\n", (void*) (s->parent[s->depth - 1].children[s->parent[s->depth - 1].activeChild].obj)));
+		s->parent[s->depth - 1].children[s->parent[s->depth - 1].activeChild].obj =
+		UA_NULL;
+	}
+	return UA_SUCCESS;
+}
+
+UA_Int32 UA_NodeSet_decodeXML(XML_Stack_t* s, XML_Attr_t* attr, UA_NodeSet* dst, _Bool isStart) {
+	DBG_VERBOSE(printf("UA_NodeSet entered with dst=%p,isStart=%d\n", (void*) dst,isStart));
+	if (isStart) {
+		if (dst == UA_NULL) {
+			UA_NodeSet_new(&dst);
+			s->parent[s->depth - 1].children[s->parent[s->depth - 1].activeChild].obj = (void*) dst;
+		}
+		s->parent[s->depth].len = 0;
+		XML_Stack_addChildHandler(s, "Aliases", (XML_decoder) UA_NodeSetAliases_decodeXML, UA_INVALIDTYPE, &(dst->aliases));
+		XML_Stack_addChildHandler(s, "UADataType", (XML_decoder) UA_DataTypeNode_decodeXML, UA_DATATYPENODE, UA_NULL);
+	} else {
+		switch (s->parent[s->depth - 1].activeChild) {
+		case 0: // Aliases
+			if (attr != UA_NULL) {
+				UA_NodeSetAliases* aliases = (UA_NodeSetAliases*) attr;
+				DBG_VERBOSE(printf("finished aliases: aliases=%p, size=%d\n",(void*)aliases,(aliases==UA_NULL)?-1:aliases->size));
+				s->aliases = aliases;
+			}
+			break;
+		case 1:
+			if (attr != UA_NULL) {
+				UA_Node* node = (UA_Node*) attr;
+				DBG_VERBOSE(printf("finished node: node=%p\n",(void*)node));
+				insert_node(dst->ns, node);
+				DBG_VERBOSE(printf("Inserting "));DBG_VERBOSE(print_node(node));
+			}
+			break;
+		default:
+			break;
+		}
+		// TODO: It is a design flaw that we need to do this here, isn't it?
+		DBG_VERBOSE(printf("UA_NodeSet clears %p\n", (void*) (s->parent[s->depth - 1].children[s->parent[s->depth - 1].activeChild].obj)));
+		s->parent[s->depth - 1].children[s->parent[s->depth - 1].activeChild].obj = UA_NULL;
+	}
+	return UA_SUCCESS;
+}
+
+/** lookup if element is a known child of parent, if yes go for it otherwise ignore */
+void XML_Stack_startElement(void * data, const char *el, const char **attr) {
+	XML_Stack_t* s = (XML_Stack_t*) data;
+	int i;
+
+// scan expected children
+	XML_Parent_t* cp = &s->parent[s->depth];
+	for (i = 0; i < cp->len; i++) {
+		if (0 == strncmp(cp->children[i].name, el, strlen(cp->children[i].name))) {
+			DBG_VERBOSE(XML_Stack_print(s));DBG_VERBOSE(printf("%s - processing\n",el));
+
+			cp->activeChild = i;
+
+			s->depth++;
+			s->parent[s->depth].name = el;
+			s->parent[s->depth].len = 0;
+			s->parent[s->depth].textAttribIdx = -1;
+			s->parent[s->depth].activeChild = -1;
+
+			// finally call the elementHandler and return
+			cp->children[i].elementHandler(data, attr, cp->children[i].obj,
+			TRUE);
+			return;
+		}
+	}
+// if we come here we rejected the processing of el
+	DBG_VERBOSE(XML_Stack_print(s));DBG_VERBOSE(printf("%s - rejected\n",el));
+	s->depth++;
+	s->parent[s->depth].name = el;
+// this should be sufficient to reject the children as well
+	s->parent[s->depth].len = 0;
+}
+
+UA_Int32 XML_isSpace(cstring_t s, int len) {
+	int i;
+	for (i = 0; i < len; i++) {
+		if (!isspace(s[i])) {
+			return UA_FALSE;
+		}
+	}
+	return UA_TRUE;
+}
+
+/* simulates startElement, endElement behaviour */
+void XML_Stack_handleText(void * data, const char *txt, int len) {
+	XML_Stack_t* s = (XML_Stack_t*) data;
+
+	if (len > 0 && !XML_isSpace(txt, len)) {
+		XML_Parent_t* cp = &(s->parent[s->depth]);
+		if (cp->textAttribIdx >= 0) {
+			cp->activeChild = cp->textAttribIdx;
+			char* buf; // need to copy txt to add 0 as string terminator
+			UA_alloc((void** )&buf, len + 1);
+			strncpy(buf, txt, len);
+			buf[len] = 0;
+			XML_Attr_t attr[3] = { cp->textAttrib, buf, UA_NULL };
+			DBG_VERBOSE(printf("handleText calls start elementHandler %s with dst=%p, attr=%p\n", cp->children[cp->activeChild].name, cp->children[cp->activeChild].obj, (void*) attr));
+			// cp->children[cp->activeChild].elementHandler(s, attr, cp->children[cp->activeChild].obj, TRUE);
+			DBG_VERBOSE(printf("handleText calls finish elementHandler %s with dst=%p, attr=(nil)\n", cp->children[cp->activeChild].name, cp->children[cp->activeChild].obj));
+			// cp->children[cp->activeChild].elementHandler(s, UA_NULL, cp->children[cp->activeChild].obj, FALSE);
+			UA_free(buf);
+		} else {
+			DBG_VERBOSE(XML_Stack_print(s));DBG_VERBOSE(printf("textData - ignore text data '%.*s'\n",len,txt));
+		}
+	}
+}
+
+/** if we are an activeChild of a parent we call the child-handler */
+void XML_Stack_endElement(void *data, const char *el) {
+	XML_Stack_t* s = (XML_Stack_t*) data;
+
+// the parent of the parent of the element knows the elementHandler, therefore depth-2!
+	if (s->depth > 1) {
+		// inform parents elementHandler that everything is done
+		XML_Parent_t* cp = &(s->parent[s->depth - 1]);
+		XML_Parent_t* cpp = &(s->parent[s->depth - 2]);
+		if (cpp->activeChild >= 0 && cp->activeChild >= 0) {
+			DBG_VERBOSE(XML_Stack_print(s));DBG_VERBOSE(printf(" - inform pop %s, arg=%p\n", cpp->children[cpp->activeChild].name, (void*) cp->children[cp->activeChild].obj));
+			cpp->children[cpp->activeChild].elementHandler(s, (XML_Attr_t*) cp->children[cp->activeChild].obj, cpp->children[cpp->activeChild].obj, FALSE);
+		}
+		// reset
+		cp->activeChild = -1;
+	}
+	s->depth--;
+}
+
+int main() {
+	char buf[1024];
+	int len; /* len is the number of bytes in the current bufferful of data */
+	XML_Stack_t s;
+	XML_Stack_init(&s, "ROOT");
+	UA_NodeSet n;
+	UA_NodeSet_init(&n);
+	XML_Stack_addChildHandler(&s, "UANodeSet", (XML_decoder) UA_NodeSet_decodeXML, UA_INVALIDTYPE, &n);
+
+	XML_Parser parser = XML_ParserCreate(NULL);
+	XML_SetUserData(parser, &s);
+	XML_SetElementHandler(parser, XML_Stack_startElement, XML_Stack_endElement);
+	XML_SetCharacterDataHandler(parser, XML_Stack_handleText);
+	while ((len = read(0, buf, 1024)) > 0) {
+		if (!XML_Parse(parser, buf, len, (len < 1024))) {
+			return 1;
+		}
+	}
+	XML_ParserFree(parser);
+	iterate_ns(n.ns, print_node);
+	DBG_VERBOSE(printf("aliases addr=%p\n",(void*)&(n.aliases)));
+	DBG_VERBOSE(UA_NodeSetAliases_println("aliases in nodeset: ",&n.aliases));
+	return 0;
+}

+ 1 - 1
include/Makefile.am

@@ -1,4 +1,4 @@
-TOOL_DIR = ../tool
+TOOL_DIR = ../tools
 
 all-local: opcua.h ua_namespace_0.h
 

+ 1 - 1
src/Makefile.am

@@ -2,7 +2,7 @@
 AM_CFLAGS = $(GLOBAL_AM_CFLAGS) -I$(top_builddir)/include -I$(top_builddir)/src -I. -I$(top_builddir)/src/util
 
 
-TOOL_DIR = ../tool
+TOOL_DIR = ../tools
 #__top_builddir__bin_stackTest_out_SOURCES =	opcuaServer.c\
 #											opcua_builtInDatatypes.c\
 #											opcua_binaryEncDec.c\

+ 1 - 1
src/ua_basictypes.c

@@ -1188,7 +1188,7 @@ UA_TYPE_END_XXCODEBINARY
 UA_TYPE_METHOD_DELETE_STRUCT(UA_DiagnosticInfo)
 UA_Int32 UA_DiagnosticInfo_deleteMembers(UA_DiagnosticInfo *p) {
 	UA_Int32 retval = UA_SUCCESS;
-	if (p->encodingMask & UA_DIAGNOSTICINFO_ENCODINGMASK_INNERDIAGNOSTICINFO && p->innerDiagnosticInfo != UA_NULL) {
+	if ((p->encodingMask & UA_DIAGNOSTICINFO_ENCODINGMASK_INNERDIAGNOSTICINFO) && p->innerDiagnosticInfo != UA_NULL) {
 		retval |= UA_DiagnosticInfo_deleteMembers(p->innerDiagnosticInfo);
 		retval |= UA_free(p->innerDiagnosticInfo);
 	}

+ 10 - 0
src/ua_namespace.c

@@ -392,6 +392,16 @@ static UA_Int32 find_slot (const namespace *ns, ns_entry **slot, const UA_NodeId
 	return UA_SUCCESS;
 }
 
+UA_Int32 iterate_ns (const namespace *ns, node_visitor visitor) {
+	uint32_t i;
+	for (i=0;i<ns->size;i++) {
+		ns_entry* entry = &ns->entries[i];
+		if (entry != UA_NULL && visitor != UA_NULL)
+			visitor(entry->node);
+    }
+	return UA_SUCCESS;
+}
+
 /* Always returns an empty slot. This is inevitable if the entries are not
    completely full. */
 static ns_entry * find_empty_slot(const namespace *ns, hash_t h) {

+ 3 - 0
src/ua_namespace.h

@@ -56,6 +56,9 @@ UA_Int32 get_writable_node(namespace const *ns, const UA_NodeId *nodeid, UA_Node
 UA_Int32 get_tc_node(namespace *ns, transaction_context *tc, const UA_NodeId *nodeid, UA_Node ** const result, ns_lock ** lock);
 UA_Int32 get_tc_writable_node(namespace *ns, transaction_context *tc, const UA_NodeId *nodeid, UA_Node **result, ns_lock ** lock); // use only for _single_ writes.
 
+typedef void (*node_visitor)(UA_Node const * node);
+UA_Int32 iterate_ns(const namespace *ns, node_visitor visitor);
+
 // inline void release_node(ns_lock *lock);
 // portable solution, see http://www.greenend.org.uk/rjk/tech/inline.html
 static inline void release_node(ns_lock *lock) {

tool/Makefile.am → tools/Makefile.am


tool/NodeIds.csv → tools/NodeIds.csv


tool/Opc.Ua.Types.bsd → tools/Opc.Ua.Types.bsd


tool/UA_stackInternalTypes → tools/UA_stackInternalTypes.bsd


tool/generate_builtin.py → tools/generate_builtin.py


tool/generate_namespace.py → tools/generate_namespace.py


+ 54 - 0
tools/indent.sh

@@ -0,0 +1,54 @@
+#!/bin/bash
+if [ $# -eq 0 ]; then
+echo "usage: $0 <file1 file2 ...>"
+   exit 1
+fi
+if [ "$(type -t indent)" = "" ]; then
+echo "Please install GNU indent first."
+   exit 1
+fi
+
+# Assume a width of 4 spaces per tab.
+# E.g. when indenting to the opening braces of an argument list.
+
+indent \
+--line-length120 \
+--comment-line-length100 \
+--indent-level4 \
+--use-tabs \
+--tab-size4 \
+--case-indentation0 \
+--declaration-indentation1 \
+--ignore-newlines \
+--swallow-optional-blank-lines \
+--blank-lines-after-procedures \
+--no-blank-lines-after-commas \
+--break-after-boolean-operator \
+--no-space-after-for \
+--no-space-after-if \
+--no-space-after-while \
+--no-space-after-casts \
+--braces-on-if-line \
+--braces-on-func-def-line \
+--braces-on-struct-decl-line \
+--cuddle-do-while \
+--cuddle-else \
+--dont-break-procedure-type \
+--continue-at-parentheses \
+--no-space-after-function-call-names \
+--no-space-after-parentheses \
+--no-comment-delimiters-on-blank-lines \
+--comment-indentation0 \
+--format-first-column-comments \
+--declaration-comment-column0 \
+--format-all-comments \
+--line-comments-indentation0 \
+--blank-lines-before-block-comments \
+--space-special-semicolon \
+$@
+
+
+# Remove trailing whitespace
+for file in $@; do
+	sed -i -e's/[[:space:]]*$//' "$file"
+done

tool/plugin_Node.py → tools/plugin_Node.py