From 76fc88efc74bc9e9bd16d709d68d75eb9b633110 Mon Sep 17 00:00:00 2001
From: Markus Frank <Markus.Frank@cern.ch>
Date: Fri, 17 Mar 2017 19:24:25 +0100
Subject: [PATCH] Cleanup and extending the data parsers for XML/JSON add
 example ClientTests/MiniTel_json

---
 DDCore/include/DD4hep/DetFactoryHelper.h      |   42 +-
 DDCore/include/DD4hep/Factories.h             |   93 +-
 DDCore/include/JSON/ChildValue.h              |   15 +-
 DDCore/include/JSON/ChildValue.inl            |    7 +-
 DDCore/include/JSON/Conversions.h             |   20 +
 DDCore/include/JSON/Detector.h                |   15 +-
 DDCore/include/JSON/Dimension.h               |   11 +-
 DDCore/include/JSON/Dimension.inl             |    7 +-
 DDCore/include/JSON/DocumentHandler.h         |   47 +
 DDCore/include/JSON/Elements.h                |   12 +-
 DDCore/include/JSON/Helper.h                  |   56 +
 DDCore/include/JSON/config.h                  |    1 -
 DDCore/include/XML/Conversions.h              |   53 +-
 DDCore/include/XML/Helper.h                   |   58 +
 DDCore/include/XML/XMLChildValue.h            |   12 +-
 DDCore/include/XML/XMLChildValue.inl          |   12 +-
 DDCore/include/XML/XMLDetector.h              |   14 +-
 DDCore/include/XML/XMLDimension.h             |   13 +-
 DDCore/include/XML/XMLDimension.inl           |    7 +-
 DDCore/include/XML/detail/ChildValue.h        |  658 +++++-----
 DDCore/include/XML/detail/Conversions.h       |   66 +
 DDCore/include/XML/detail/Detector.h          |  141 ++-
 DDCore/include/XML/detail/Dimension.h         | 1097 +++++++++--------
 DDCore/include/XML/detail/Dimension.imp       |   20 +-
 DDCore/include/XML/detail/Dimension.inl       |   18 +-
 DDCore/include/XML/detail/README.txt          |   16 +-
 DDCore/src/JSON/DocumentHandler.cpp           |   46 +
 DDCore/src/JSON/Elements.cpp                  |   46 +-
 DDCore/src/JSON/Helpers.cpp                   |    1 +
 DDCore/src/XML/XMLHelpers.cpp                 |    1 +
 DDCore/src/plugins/Compact2Objects.cpp        |   65 +-
 DDCore/src/plugins/JsonProcessor.cpp          |  162 +++
 DDDB/src/DDDBDimension.cpp                    |    1 +
 doc/release.notes                             |    9 +
 examples/ClientTests/CMakeLists.txt           |   10 +
 examples/ClientTests/compact/MiniTel.json     |  247 +++-
 examples/ClientTests/compact/MiniTel_json.xml |   93 ++
 examples/ClientTests/src_boost/JsonTest.cpp   |    8 +-
 .../ClientTests/src_boost/MiniTel_json.cpp    |  115 ++
 39 files changed, 2095 insertions(+), 1220 deletions(-)
 create mode 100644 DDCore/include/JSON/Conversions.h
 create mode 100644 DDCore/include/JSON/DocumentHandler.h
 create mode 100644 DDCore/include/JSON/Helper.h
 create mode 100644 DDCore/include/XML/Helper.h
 create mode 100644 DDCore/include/XML/detail/Conversions.h
 create mode 100644 DDCore/src/JSON/DocumentHandler.cpp
 create mode 100644 DDCore/src/plugins/JsonProcessor.cpp
 create mode 100644 examples/ClientTests/compact/MiniTel_json.xml
 create mode 100644 examples/ClientTests/src_boost/MiniTel_json.cpp

diff --git a/DDCore/include/DD4hep/DetFactoryHelper.h b/DDCore/include/DD4hep/DetFactoryHelper.h
index f08a3c199..06e3ffb37 100644
--- a/DDCore/include/DD4hep/DetFactoryHelper.h
+++ b/DDCore/include/DD4hep/DetFactoryHelper.h
@@ -13,46 +13,8 @@
 #ifndef DD4hep_DETECTOR_DETFACTORYHELPER_H
 #define DD4hep_DETECTOR_DETFACTORYHELPER_H
 
-// Framework include files
-#include "XML/XMLDetector.h"
-#include "XML/XMLChildValue.h"
-#include "DD4hep/LCDD.h"
-#include "DD4hep/Factories.h"
-#include "DD4hep/DD4hepUnits.h"
+/** Obsolete header. Better use XML/Helper.h instead !  */
 
-// Shortcuts to elements of the XML namespace
-typedef DD4hep::XML::Tag_t xml_tag_t;
-typedef DD4hep::XML::Attribute xml_attr_t;
-typedef DD4hep::XML::Collection_t xml_coll_t;
-typedef DD4hep::XML::Handle_t xml_h;
-typedef DD4hep::XML::Element xml_elt_t;
-typedef DD4hep::XML::RefElement xml_ref_t;
-typedef DD4hep::XML::DetElement xml_det_t;
-typedef DD4hep::XML::Component xml_comp_t;
-typedef DD4hep::XML::Dimension xml_dim_t;
-typedef DD4hep::XML::ChildValue xml_val_t;
-typedef DD4hep::XML::Document xml_doc_t;
-typedef DD4hep::XML::DocumentHolder xml_doc_holder_t;
-typedef DD4hep::XML::DocumentHandler xml_handler_t;
-typedef DD4hep::XML::Strng_t Unicode;
-typedef DD4hep::Geometry::LCDD lcdd_t;
-
-/// Namespace for the AIDA detector description toolkit
-namespace DD4hep {
-
-  /// Namespace for the geometry part of the AIDA detector description toolkit
-  namespace Geometry {
-
-    /// std::string conversion of XML strings (e.g. Unicode for Xerces-C)
-    static inline std::string _toString(const DD4hep::XML::XmlChar* value) {
-      return XML::_toString(value);
-    }
-
-    /// std::string conversion of arbitrary entities including user defined formatting.
-    template <typename T> inline std::string _toString(T value, const char* fmt) {
-      return XML::_toString(value, fmt);
-    }
-  }
-}
+#include "XML/Helper.h"
 
 #endif // DD4hep_DETECTOR_DETFACTORYHELPER_H
diff --git a/DDCore/include/DD4hep/Factories.h b/DDCore/include/DD4hep/Factories.h
index 6a252c1c1..15a15e893 100644
--- a/DDCore/include/DD4hep/Factories.h
+++ b/DDCore/include/DD4hep/Factories.h
@@ -17,7 +17,6 @@
 #include "DD4hep/Plugins.h"
 #include "DD4hep/Detector.h"
 #include "DD4hep/NamedObject.h"
-#include "XML/XMLElements.h"
 
 // C/C++ include files
 #include <cstdarg>
@@ -25,9 +24,14 @@
 /// Namespace for the AIDA detector description toolkit
 namespace DD4hep {
 
+  /// Namespace for the AIDA detector description toolkit supporting JSON utilities
+  namespace JSON {
+    class Handle_t;
+  }
   /// Namespace for the AIDA detector description toolkit supporting XML utilities
   namespace XML {
     class Handle_t;
+    class RefElement;
   }
   class NamedObject;
 
@@ -105,7 +109,7 @@ namespace DD4hep {
    */
   template <typename T> class XMLElementFactory : public PluginFactoryBase {
   public:
-    static ref_t create(Geometry::LCDD& lcdd, xml_h e);
+    static ref_t create(Geometry::LCDD& lcdd, XML::Handle_t e);
   };
 
   ///  Read an arbitrary XML document and analyze it's content
@@ -118,7 +122,7 @@ namespace DD4hep {
    */
   template <typename T> class XMLDocumentReaderFactory : public PluginFactoryBase {
   public:
-    static long create(Geometry::LCDD& lcdd, xml_h e);
+    static long create(Geometry::LCDD& lcdd, XML::Handle_t e);
   };
 
   /// Read an arbitrary XML document and analyze it's content
@@ -131,7 +135,7 @@ namespace DD4hep {
    */
   template <typename T> class XMLConversionFactory : public PluginFactoryBase {
   public:
-    static long create(Geometry::LCDD& lcdd, ref_t& handle, xml_h element);
+    static long create(Geometry::LCDD& lcdd, XML::RefElement& handle, XML::Handle_t element);
   };
 
   /// Standard factory to create Detector elements from the compact XML representation.
@@ -142,10 +146,23 @@ namespace DD4hep {
    *  \date    2012/07/31
    *  \ingroup DD4HEP_GEOMETRY
    */
-  template <typename T> class DetElementFactory : public PluginFactoryBase {
+  template <typename T> class XmlDetElementFactory : public PluginFactoryBase {
   public:
     static Geometry::Ref_t create(Geometry::LCDD& lcdd, XML::Handle_t e, Geometry::Ref_t sens);
   };
+
+  /// Standard factory to create Detector elements from the compact XML representation.
+  /**
+   *
+   *  \author  M.Frank
+   *  \version 1.0
+   *  \date    2012/07/31
+   *  \ingroup DD4HEP_GEOMETRY
+   */
+  template <typename T> class JsonDetElementFactory : public PluginFactoryBase {
+  public:
+    static Geometry::Ref_t create(Geometry::LCDD& lcdd, JSON::Handle_t e, Geometry::Ref_t sens);
+  };
 }
 
 namespace {
@@ -154,10 +171,11 @@ namespace {
   template <typename P, typename S> class Factory;
 
   struct ns  {
-    typedef DD4hep::NamedObject     Named;
-    typedef DD4hep::Geometry::LCDD  LCDD;
-    typedef DD4hep::XML::Handle_t   xml_h;
-    typedef DD4hep::Geometry::Ref_t ref_t;
+    typedef DD4hep::NamedObject       Named;
+    typedef DD4hep::Geometry::LCDD    LCDD;
+    typedef DD4hep::XML::Handle_t     xml_h;
+    typedef DD4hep::JSON::Handle_t    json_h;
+    typedef DD4hep::Geometry::Ref_t   ref_t;
     typedef DD4hep::Geometry::SegmentationObject SegmentationObject;
     typedef DD4hep::DDSegmentation::BitField64   BitField64;
   };
@@ -184,23 +202,26 @@ namespace {
   {    return make_return<long>(DD4hep::XMLDocumentReaderFactory<P>::create(*a0,*a1));  }
 
   DD4HEP_PLUGIN_FACTORY_ARGS_3(ns::Named*,ns::LCDD*,ns::xml_h*,ns::ref_t*)
-  {    return DD4hep::DetElementFactory<P>::create(*a0,*a1,*a2).ptr();                  }
+  {    return DD4hep::XmlDetElementFactory<P>::create(*a0,*a1,*a2).ptr();               }
+
+  DD4HEP_PLUGIN_FACTORY_ARGS_3(ns::Named*,ns::LCDD*,ns::json_h*,ns::ref_t*)
+  {    return DD4hep::JsonDetElementFactory<P>::create(*a0,*a1,*a2).ptr();              }
 }
 
 #define DECLARE_DETELEMENT_FACTORY(x)               namespace DD4hep    \
-  { DD4HEP_PLUGINSVC_FACTORY(x,x,DD4hep::NamedObject*(Geometry::LCDD*,XML::Handle_t*,Geometry::Ref_t*),__LINE__) }
+  { DD4HEP_PLUGINSVC_FACTORY(x,x,DD4hep::NamedObject*(ns::LCDD*,XML::Handle_t*,Geometry::Ref_t*),__LINE__) }
 #define DECLARE_NAMESPACE_DETELEMENT_FACTORY(n,x)   namespace DD4hep    \
-  { DD4HEP_PLUGINSVC_FACTORY(n::x,x,NamedObject*(Geometry::LCDD*,XML::Handle_t*,Geometry::Ref_t*),__LINE__)      }
+  { DD4HEP_PLUGINSVC_FACTORY(n::x,x,NamedObject*(ns::LCDD*,XML::Handle_t*,Geometry::Ref_t*),__LINE__)      }
 #define DECLARE_NAMED_APPLY_FACTORY(n,x)            namespace DD4hep    \
-  { DD4HEP_PLUGINSVC_FACTORY(n::x,x,long(Geometry::LCDD*,int, char**),__LINE__) }
+  { DD4HEP_PLUGINSVC_FACTORY(n::x,x,long(ns::LCDD*,int, char**),__LINE__) }
 #define DECLARE_NAMED_TRANSLATION_FACTORY(n,x)      namespace DD4hep    \
-  { DD4HEP_PLUGINSVC_FACTORY(n::x,x,DD4hep::NamedObject*(Geometry::LCDD*),__LINE__) }
+  { DD4HEP_PLUGINSVC_FACTORY(n::x,x,DD4hep::NamedObject*(ns::LCDD*),__LINE__) }
 #define DECLARE_NAMED_XMLELEMENT_FACTORY(n,x)       namespace DD4hep    \
-  { DD4HEP_PLUGINSVC_FACTORY(n::x,x,DD4hep::NamedObject*(Geometry::LCDD*,XML::Handle_t*),__LINE__) }
+  { DD4HEP_PLUGINSVC_FACTORY(n::x,x,DD4hep::NamedObject*(ns::LCDD*,XML::Handle_t*),__LINE__) }
 #define DECLARE_NAMED_DETELEMENT_FACTORY(n,x)       namespace DD4hep    \
   { DD4HEP_PLUGINSVC_FACTORY(n::x,x,DD4hep::*(),__LINE__) }
 
-// Call function of the type [Geometry::SegmentationObject (*func)(Geometry::LCDD*,DDSegmentation::BitField64*)]
+// Call function of the type [Geometry::SegmentationObject (*func)(ns::LCDD*,DDSegmentation::BitField64*)]
 #define DECLARE_SEGMENTATION(name,func)        DD4HEP_OPEN_PLUGIN(DD4hep,name)   { \
     template <> Geometry::SegmentationObject*                           \
       SegmentationFactory<name>::create(DDSegmentation::BitField64* d) { return func(d); } \
@@ -209,44 +230,52 @@ namespace {
 
 // Call function of the type [long (*func)(const char* arg)]
 #define DECLARE_APPLY(name,func)        DD4HEP_OPEN_PLUGIN(DD4hep,name)   { \
-    template <> long ApplyFactory<name>::create(Geometry::LCDD& l,int n,char** a) {return func(l,n,a);} \
-    DD4HEP_PLUGINSVC_FACTORY(name,name,long(Geometry::LCDD*,int,char**),__LINE__)}
+    template <> long ApplyFactory<name>::create(ns::LCDD& l,int n,char** a) {return func(l,n,a);} \
+    DD4HEP_PLUGINSVC_FACTORY(name,name,long(ns::LCDD*,int,char**),__LINE__)}
 
 // Call function of the type [void* (*func)(const char* arg)]
 #define DECLARE_CONSTRUCTOR(name,func)  DD4HEP_OPEN_PLUGIN(DD4hep,name) { \
     template <> void* ConstructionFactory<name>::create(const char* n) { return func(n);} \
     DD4HEP_PLUGINSVC_FACTORY(name,name,void*(const char*),__LINE__) }
 
-// Call function of the type [void* (*func)(Geometry::LCDD& lcdd, int argc,char** argv)]
+// Call function of the type [void* (*func)(ns::LCDD& lcdd, int argc,char** argv)]
 #define DECLARE_LCDD_CONSTRUCTOR(name,func)  DD4HEP_OPEN_PLUGIN(DD4hep,name) { \
-    template <> void* LCDDConstructionFactory<name>::create(Geometry::LCDD& l, int n,char** a) { return func(l,n,a);} \
-    DD4HEP_PLUGINSVC_FACTORY(name,name,void*(Geometry::LCDD*,int,char**),__LINE__) }
+    template <> void* LCDDConstructionFactory<name>::create(ns::LCDD& l, int n,char** a) { return func(l,n,a);} \
+    DD4HEP_PLUGINSVC_FACTORY(name,name,void*(ns::LCDD*,int,char**),__LINE__) }
 
-// Call function of the type [void* (*func)(Geometry::LCDD& lcdd)]
+// Call function of the type [void* (*func)(ns::LCDD& lcdd)]
 #define DECLARE_TRANSLATION(name,func)  DD4HEP_OPEN_PLUGIN(DD4hep,name)  { \
-    template <> Geometry::Ref_t TranslationFactory<name>::create(Geometry::LCDD& l) {return func(l);} \
+    template <> Geometry::Ref_t TranslationFactory<name>::create(ns::LCDD& l) {return func(l);} \
     DECLARE_NAMED_TRANSLATION_FACTORY(Geometry,name)  }
 
-// Call function of the type [void* (*func)(Geometry::LCDD& lcdd, xml_h handle)]
+// Call function of the type [void* (*func)(ns::LCDD& lcdd, xml_h handle)]
 #define DECLARE_XMLELEMENT(name,func)  DD4HEP_OPEN_PLUGIN(DD4hep,xml_element_##name)  {\
-    template <> Geometry::Ref_t XMLElementFactory<xml_element_##name>::create(Geometry::LCDD& l,xml_h e) {return func(l,e);} \
-    DD4HEP_PLUGINSVC_FACTORY(xml_element_##name,name,NamedObject*(Geometry::LCDD*,XML::Handle_t*),__LINE__)  }
+    template <> Geometry::Ref_t XMLElementFactory<xml_element_##name>::create(ns::LCDD& l,ns::xml_h e) {return func(l,e);} \
+    DD4HEP_PLUGINSVC_FACTORY(xml_element_##name,name,NamedObject*(ns::LCDD*,ns::xml_h*),__LINE__)  }
 
-// Call function of the type [long (*func)(Geometry::LCDD& lcdd, xml_h handle)]
+// Call function of the type [long (*func)(ns::LCDD& lcdd, xml_h handle)]
 #define DECLARE_XML_DOC_READER(name,func)  DD4HEP_OPEN_PLUGIN(DD4hep,xml_document_##name)  { \
-    template <> long XMLDocumentReaderFactory<xml_document_##name>::create(Geometry::LCDD& l,xml_h e) {return func(l,e);} \
-    DD4HEP_PLUGINSVC_FACTORY(xml_document_##name,name##_XML_reader,long(Geometry::LCDD*,XML::Handle_t*),__LINE__)  }
+    template <> long XMLDocumentReaderFactory<xml_document_##name>::create(ns::LCDD& l,ns::xml_h e) {return func(l,e);} \
+    DD4HEP_PLUGINSVC_FACTORY(xml_document_##name,name##_XML_reader,long(ns::LCDD*,ns::xml_h*),__LINE__)  }
 
-// Call function of the type [NamedObject* (*func)(Geometry::LCDD& lcdd, xml_h handle, ref_t reference)]
+// Call function of the type [NamedObject* (*func)(ns::LCDD& lcdd, xml_h handle, ref_t reference)]
 #define DECLARE_XML_PROCESSOR_BASIC(name,func,deprecated)  DD4HEP_OPEN_PLUGIN(DD4hep,det_element_##name) {\
-    template <> Geometry::Ref_t DetElementFactory< det_element_##name >::create(Geometry::LCDD& l,xml_h e,ref_t h) \
+    template <> Geometry::Ref_t XmlDetElementFactory< det_element_##name >::create(ns::LCDD& l,ns::xml_h e,ns::ref_t h) \
     { if (deprecated) warning_deprecated_xml_factory(#name); return func(l,e,h);} \
-    DD4HEP_PLUGINSVC_FACTORY(det_element_##name,name,NamedObject*(Geometry::LCDD*,XML::Handle_t*,Geometry::Ref_t*),__LINE__)  }
+    DD4HEP_PLUGINSVC_FACTORY(det_element_##name,name,NamedObject*(ns::LCDD*,ns::xml_h*,Geometry::Ref_t*),__LINE__)  }
+
+// Call function of the type [NamedObject* (*func)(ns::LCDD& lcdd, json_h handle, ref_t reference)]
+#define DECLARE_JSON_PROCESSOR_BASIC(name,func)  DD4HEP_OPEN_PLUGIN(DD4hep,det_element_##name) { \
+    template <> Geometry::Ref_t JsonDetElementFactory< det_element_##name >::create(ns::LCDD& l,ns::json_h e,ns::ref_t h) \
+    { return func(l,e,h);}                                              \
+    DD4HEP_PLUGINSVC_FACTORY(det_element_##name,name,NamedObject*(ns::LCDD*,ns::json_h*,ns::ref_t*),__LINE__)  }
 
 #define DECLARE_XML_PROCESSOR(name,func)          DECLARE_XML_PROCESSOR_BASIC(name,func,0)
 #define DECLARE_SUBDETECTOR(name,func)            DECLARE_XML_PROCESSOR_BASIC(name,func,0)
 #define DECLARE_DETELEMENT(name,func)             DECLARE_XML_PROCESSOR_BASIC(name,func,0)
 #define DECLARE_DEPRECATED_DETELEMENT(name,func)  DECLARE_XML_PROCESSOR_BASIC(name,func,1)
 
+#define DECLARE_JSON_DETELEMENT(name,func)        DECLARE_JSON_PROCESSOR_BASIC(name,func)
+
 #endif // DD4HEP_FACTORIES_H
 
diff --git a/DDCore/include/JSON/ChildValue.h b/DDCore/include/JSON/ChildValue.h
index 794a6e89a..6300377d8 100644
--- a/DDCore/include/JSON/ChildValue.h
+++ b/DDCore/include/JSON/ChildValue.h
@@ -16,18 +16,9 @@
 // Framework include files
 #include "JSON/Dimension.h"
 
-/// Namespace for the AIDA detector description toolkit
-namespace DD4hep {
-
-  // Forward declarations
-  class NamedObject;
-
-  /// Namespace for the AIDA detector description toolkit supporting JSON utilities
-  namespace JSON {
-
-    /// Include the implementation in the proper namespace
+#define DD4HEP_DIMENSION_NS JSON
 #include "XML/detail/ChildValue.h"
+#undef  DD4HEP_DIMENSION_NS
+
 
-  }       /* End namespace JSON         */
-}         /* End namespace DD4hep       */
 #endif    /* DD4HEP_JSON_CHILDVALUE_H   */
diff --git a/DDCore/include/JSON/ChildValue.inl b/DDCore/include/JSON/ChildValue.inl
index 0b727b5de..744eeff89 100644
--- a/DDCore/include/JSON/ChildValue.inl
+++ b/DDCore/include/JSON/ChildValue.inl
@@ -10,15 +10,14 @@
 // Author     : M.Frank
 //
 //==========================================================================
-
 #ifndef DD4HEP_JSONCHILDVALUE_INL
 #define DD4HEP_JSONCHILDVALUE_INL
 
-// Configuration definitions
-#define CHILDVALUE_NS JSON
-
 // Framework include files
 #include "JSON/ChildValue.h"
+
+#define DD4HEP_DIMENSION_NS JSON
 #include "XML/detail/ChildValue.inl"
+#undef  DD4HEP_DIMENSION_NS
 
 #endif /* DD4HEP_JSONCHILDVALUE_INL  */
diff --git a/DDCore/include/JSON/Conversions.h b/DDCore/include/JSON/Conversions.h
new file mode 100644
index 000000000..37627560d
--- /dev/null
+++ b/DDCore/include/JSON/Conversions.h
@@ -0,0 +1,20 @@
+//==========================================================================
+//  AIDA Detector description implementation for LCD
+//--------------------------------------------------------------------------
+// Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
+// All rights reserved.
+//
+// For the licensing terms see $DD4hepINSTALL/LICENSE.
+// For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
+//
+// Author     : M.Frank
+//
+//==========================================================================
+#ifndef DD4HEP_JSON_CONVERSIONS_H
+#define DD4HEP_JSON_CONVERSIONS_H
+
+#define DD4HEP_CONVERSION_NS JSON
+#include "XML/detail/Conversions.h"
+#undef  DD4HEP_CONVERSION_NS
+
+#endif /* DD4HEP_JSON_CONVERSIONS_H  */
diff --git a/DDCore/include/JSON/Detector.h b/DDCore/include/JSON/Detector.h
index 19f35c299..c0fced1da 100644
--- a/DDCore/include/JSON/Detector.h
+++ b/DDCore/include/JSON/Detector.h
@@ -16,18 +16,9 @@
 // Framework include files
 #include "JSON/Dimension.h"
 
-/// Namespace for the AIDA detector description toolkit
-namespace DD4hep {
-
-  // Forward declarations
-  class NamedObject;
-
-  /// Namespace for the AIDA detector description toolkit supporting JSON utilities
-  namespace JSON {
-
-    /// Include the implementation in the proper namespace
+/// Include the implementation in the proper namespace
+#define DD4HEP_DIMENSION_NS JSON
 #include "XML/detail/Detector.h"
+#undef DD4HEP_DIMENSION_NS
 
-  }       /* End namespace JSON       */
-}         /* End namespace DD4hep     */
 #endif    /* DD4HEP_JSON_DETECTOR_H   */
diff --git a/DDCore/include/JSON/Dimension.h b/DDCore/include/JSON/Dimension.h
index 2b8b06c6e..20281d041 100644
--- a/DDCore/include/JSON/Dimension.h
+++ b/DDCore/include/JSON/Dimension.h
@@ -17,15 +17,8 @@
 #include "JSON/Elements.h"
 #include "JSON/Tags.h"
 
-/// Namespace for the AIDA detector description toolkit
-namespace DD4hep {
-
-  /// Namespace for the AIDA detector description toolkit supporting JSON utilities
-  namespace JSON {
-
-    /// Re-use the defined interface for the XML data access
+#define DD4HEP_DIMENSION_NS JSON
 #include "XML/detail/Dimension.h"
+#undef DD4HEP_DIMENSION_NS
 
-  }       /* End namespace JSON        */
-}         /* End namespace DD4hep      */
 #endif    /* DD4HEP_JSON_DIMENSION_H   */
diff --git a/DDCore/include/JSON/Dimension.inl b/DDCore/include/JSON/Dimension.inl
index 74f13ccf9..514a0d58c 100644
--- a/DDCore/include/JSON/Dimension.inl
+++ b/DDCore/include/JSON/Dimension.inl
@@ -10,15 +10,14 @@
 // Author     : M.Frank
 //
 //==========================================================================
-
 #ifndef DD4HEP_JSONDIMENSION_INL
 #define DD4HEP_JSONDIMENSION_INL
 
-// Configuration definitions
-#define DIMENSION_NS JSON
-
 // Framework include files
 #include "JSON/Dimension.h"
+
+#define DD4HEP_DIMENSION_NS JSON
 #include "XML/detail/Dimension.inl"
+#undef DD4HEP_DIMENSION_NS
 
 #endif /* DD4HEP_JSONDIMENSION_INL  */
diff --git a/DDCore/include/JSON/DocumentHandler.h b/DDCore/include/JSON/DocumentHandler.h
new file mode 100644
index 000000000..a60c3f7b0
--- /dev/null
+++ b/DDCore/include/JSON/DocumentHandler.h
@@ -0,0 +1,47 @@
+//==========================================================================
+//  AIDA Detector description implementation for LCD
+//--------------------------------------------------------------------------
+// Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
+// All rights reserved.
+//
+// For the licensing terms see $DD4hepINSTALL/LICENSE.
+// For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
+//
+// Author     : M.Frank
+//
+//==========================================================================
+#ifndef DD4HEP_DDCORE_JSON_DOCUMENTHANDLER_H
+#define DD4HEP_DDCORE_JSON_DOCUMENTHANDLER_H
+
+/// Framework include files
+#include "JSON/Elements.h"
+
+/// Namespace for the AIDA detector description toolkit
+namespace DD4hep {
+
+  /// Namespace for the AIDA detector description toolkit supporting JSON utilities
+  namespace JSON {
+
+    /// Class supporting to read and parse XML documents.
+    /**
+     *  Wrapper object around the document parser.
+     *
+     *  \author   M.Frank
+     *  \version  1.0
+     *  \ingroup DD4HEP_JSON
+     */
+    class DocumentHandler {
+    public:
+      /// Default constructor
+      DocumentHandler();
+      /// Default destructor
+      virtual ~DocumentHandler();
+      /// Load XML file and parse it.
+      virtual Document load(const std::string& fname) const;
+      /// Parse a standalong XML string into a document.
+      virtual Document parse(const char* doc_string, size_t length) const;
+    };
+
+  }       /* End namespace JSON                    */
+}         /* End namespace DD4hep                  */
+#endif    /* DD4HEP_DDCORE_JSON_DOCUMENTHANDLER_H  */
diff --git a/DDCore/include/JSON/Elements.h b/DDCore/include/JSON/Elements.h
index 383b4cd4d..1c86b7582 100644
--- a/DDCore/include/JSON/Elements.h
+++ b/DDCore/include/JSON/Elements.h
@@ -295,11 +295,11 @@ namespace DD4hep {
      */
     class Document {
     public:
-      typedef JsonDocument* DOC;
+      typedef JsonElement* DOC;
       DOC m_doc;
 
       /// Constructor
-      Document(DOC d) : m_doc(d) {
+      Document(DOC d=0) : m_doc(d) {
       }
       /// Auto-conversion to DOM document
       operator DOC() const {
@@ -313,6 +313,8 @@ namespace DD4hep {
       DOC ptr() const {
         return m_doc;
       }
+      /// Access the ROOT eleemnt of the DOM document
+      Handle_t root() const;
     };
 
     /// Class supporting the basic functionality of an JSON document including ownership
@@ -330,7 +332,7 @@ namespace DD4hep {
     class DocumentHolder : public Document {
     public:
       /// Default Constructor
-      DocumentHolder() : Document(0) {
+      DocumentHolder() : Document() {
       }
       /// Constructor
       DocumentHolder(DOC d) : Document(d) {
@@ -419,6 +421,10 @@ namespace DD4hep {
       {  return m_element.hasChild(tag_value);                                }
     };
 
+    /// Forward declarations
+    class DocumentHandler;
+
+    
 #undef INLINE
 
   }       /* End namespace XML               */
diff --git a/DDCore/include/JSON/Helper.h b/DDCore/include/JSON/Helper.h
new file mode 100644
index 000000000..78a329845
--- /dev/null
+++ b/DDCore/include/JSON/Helper.h
@@ -0,0 +1,56 @@
+//==========================================================================
+//  AIDA Detector description implementation for LCD
+//--------------------------------------------------------------------------
+// Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
+// All rights reserved.
+//
+// For the licensing terms see $DD4hepINSTALL/LICENSE.
+// For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
+//
+// Author     : M.Frank
+//
+//==========================================================================
+#ifndef DD4HEP_JSON_HELPER_H
+#define DD4HEP_JSON_HELPER_H
+
+// Framework include files
+#include "JSON/Detector.h"
+#include "JSON/ChildValue.h"
+#include "DD4hep/LCDD.h"
+#include "DD4hep/Factories.h"
+#include "DD4hep/DD4hepUnits.h"
+
+// Shortcuts to elements of the JSON namespace
+typedef DD4hep::JSON::Attribute       json_attr_t;
+typedef DD4hep::JSON::Collection_t    json_coll_t;
+typedef DD4hep::JSON::Handle_t        json_h;
+typedef DD4hep::JSON::Element         json_elt_t;
+typedef DD4hep::JSON::Element         json_ref_t;
+typedef DD4hep::JSON::DetElement      json_det_t;
+typedef DD4hep::JSON::Component       json_comp_t;
+typedef DD4hep::JSON::Dimension       json_dim_t;
+typedef DD4hep::JSON::ChildValue      json_val_t;
+typedef DD4hep::JSON::Document        json_doc_t;
+typedef DD4hep::JSON::DocumentHolder  json_doc_holder_t;
+typedef DD4hep::JSON::DocumentHandler json_handler_t;
+typedef DD4hep::Geometry::LCDD        lcdd_t;
+
+/// Namespace for the AIDA detector description toolkit
+namespace DD4hep {
+
+  /// Namespace for the geometry part of the AIDA detector description toolkit
+  namespace Geometry {
+
+    /// std::string conversion of JSON strings (e.g. Unicode for Xerces-C)
+    static inline std::string _toString(const char* value) {
+      return JSON::_toString(value);
+    }
+
+    /// std::string conversion of arbitrary entities including user defined formatting.
+    template <typename T> inline std::string _toString(T value, const char* fmt) {
+      return JSON::_toString(value, fmt);
+    }
+  }
+}
+
+#endif // DD4HEP_JSON_HELPER_H
diff --git a/DDCore/include/JSON/config.h b/DDCore/include/JSON/config.h
index 1036aeb45..22d69b61d 100644
--- a/DDCore/include/JSON/config.h
+++ b/DDCore/include/JSON/config.h
@@ -15,7 +15,6 @@
 
 #define DD4HEP_USE_BOOST_JSON 1
 
-#include "boost/property_tree/json_parser.hpp"
 #include "boost/property_tree/ptree.hpp"
 
 /// Namespace for the AIDA detector description toolkit
diff --git a/DDCore/include/XML/Conversions.h b/DDCore/include/XML/Conversions.h
index 9f4a7ba61..2a4e0cfe1 100644
--- a/DDCore/include/XML/Conversions.h
+++ b/DDCore/include/XML/Conversions.h
@@ -10,52 +10,11 @@
 // Author     : M.Frank
 //
 //==========================================================================
-#ifndef DD4hep_COMPACT_CONVERSION_H
-#define DD4hep_COMPACT_CONVERSION_H
+#ifndef DD4HEP_COMPACT_CONVERSION_H
+#define DD4HEP_COMPACT_CONVERSION_H
 
-// C/C++ include files
-#include <map>
-#include <iostream>
+#define DD4HEP_CONVERSION_NS XML
+#include "XML/detail/Conversions.h"
+#undef  DD4HEP_CONVERSION_NS
 
-// Framework include files
-#include "DD4hep/LCDD.h"
-
-/// Namespace for the AIDA detector description toolkit
-namespace DD4hep {
-
-  /// Namespace for the AIDA detector description toolkit supporting XML utilities
-  namespace XML {
-    class Handle_t;
-  }
-
-  /// Basic conversion objects for handling DD4hep XML files.
-  /**
-   *  \author   M.Frank
-   *  \version  1.0
-   *  \ingroup DD4HEP_XML
-   */
-  template <typename T, typename ARG=XML::Handle_t> struct Converter {
-    typedef T to_type;
-    typedef void* user_param;
-    /// Reference to the detector description object
-    Geometry::LCDD& lcdd;
-    /// Reference to optional user defined parameter
-    user_param param;
-    user_param optional;
-    /// Initializing constructor of the functor
-    Converter(Geometry::LCDD& l) : lcdd(l), param(0), optional(0) { }
-    /// Initializing constructor of the functor with initialization of the user parameter
-    Converter(Geometry::LCDD& l, user_param p) : lcdd(l), param(p), optional(0) { }
-    /// Initializing constructor of the functor with initialization of the user parameter
-    Converter(Geometry::LCDD& l, user_param p, user_param o) : lcdd(l), param(p), optional(o)  { }
-    /// Callback operator to be specialized depending on the element type
-    void operator()(ARG handle) const;
-    /// Typed access to the 1rst. user parameter (unchecked)
-    template <typename TYPE> TYPE* _param() const  {    return (TYPE*) param;     }
-    /// Typed object access to the 1rst. user parameter (unchecked)
-    template <typename TYPE> TYPE& _object() const {    return *(TYPE*) param;    }
-    /// Typed access to the 2nd. user parameter (unchecked)
-    template <typename TYPE> TYPE* _option() const {    return (TYPE*) optional;  }
-  };
-} /* End namespace DD4hep           */
-#endif    /* DD4hep_COMPACT_CONVERSION_H    */
+#endif    /* DD4HEP_COMPACT_CONVERSION_H    */
diff --git a/DDCore/include/XML/Helper.h b/DDCore/include/XML/Helper.h
new file mode 100644
index 000000000..52994a63c
--- /dev/null
+++ b/DDCore/include/XML/Helper.h
@@ -0,0 +1,58 @@
+//==========================================================================
+//  AIDA Detector description implementation for LCD
+//--------------------------------------------------------------------------
+// Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
+// All rights reserved.
+//
+// For the licensing terms see $DD4hepINSTALL/LICENSE.
+// For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
+//
+// Author     : M.Frank
+//
+//==========================================================================
+#ifndef DD4HEP_XML_HELPER_H
+#define DD4HEP_XML_HELPER_H
+
+// Framework include files
+#include "XML/XMLDetector.h"
+#include "XML/XMLChildValue.h"
+#include "DD4hep/LCDD.h"
+#include "DD4hep/Factories.h"
+#include "DD4hep/DD4hepUnits.h"
+
+// Shortcuts to elements of the XML namespace
+typedef DD4hep::XML::Tag_t xml_tag_t;
+typedef DD4hep::XML::Attribute xml_attr_t;
+typedef DD4hep::XML::Collection_t xml_coll_t;
+typedef DD4hep::XML::Handle_t xml_h;
+typedef DD4hep::XML::Element xml_elt_t;
+typedef DD4hep::XML::RefElement xml_ref_t;
+typedef DD4hep::XML::DetElement xml_det_t;
+typedef DD4hep::XML::Component xml_comp_t;
+typedef DD4hep::XML::Dimension xml_dim_t;
+typedef DD4hep::XML::ChildValue xml_val_t;
+typedef DD4hep::XML::Document xml_doc_t;
+typedef DD4hep::XML::DocumentHolder xml_doc_holder_t;
+typedef DD4hep::XML::DocumentHandler xml_handler_t;
+typedef DD4hep::XML::Strng_t Unicode;
+typedef DD4hep::Geometry::LCDD lcdd_t;
+
+/// Namespace for the AIDA detector description toolkit
+namespace DD4hep {
+
+  /// Namespace for the geometry part of the AIDA detector description toolkit
+  namespace Geometry {
+
+    /// std::string conversion of XML strings (e.g. Unicode for Xerces-C)
+    static inline std::string _toString(const DD4hep::XML::XmlChar* value) {
+      return XML::_toString(value);
+    }
+
+    /// std::string conversion of arbitrary entities including user defined formatting.
+    template <typename T> inline std::string _toString(T value, const char* fmt) {
+      return XML::_toString(value, fmt);
+    }
+  }
+}
+
+#endif // DD4HEP_XML_HELPER_H
diff --git a/DDCore/include/XML/XMLChildValue.h b/DDCore/include/XML/XMLChildValue.h
index 84e27066c..62ee0e688 100644
--- a/DDCore/include/XML/XMLChildValue.h
+++ b/DDCore/include/XML/XMLChildValue.h
@@ -17,14 +17,8 @@
 // Framework include files
 #include "XML/XMLTags.h"
 
-/// Namespace for the AIDA detector description toolkit
-namespace DD4hep {
-
-  /// Namespace for the AIDA detector description toolkit supporting XML utilities
-  namespace XML {
-
+#define DD4HEP_DIMENSION_NS XML
 #include "XML/detail/ChildValue.h"
-    
-  }       /* End namespace XML            */
-}         /* End namespace DD4hep         */
+#undef  DD4HEP_DIMENSION_NS
+
 #endif    /* DD4HEP_XML_XMLCHILDVALUE_H   */
diff --git a/DDCore/include/XML/XMLChildValue.inl b/DDCore/include/XML/XMLChildValue.inl
index 201a90eb1..2e9d54180 100644
--- a/DDCore/include/XML/XMLChildValue.inl
+++ b/DDCore/include/XML/XMLChildValue.inl
@@ -17,14 +17,8 @@
 // Framework include files
 #include "XML/XMLChildValue.h"
 
-/// Namespace for the AIDA detector description toolkit
-namespace DD4hep {
-
-  /// Namespace for the AIDA detector description toolkit supporting XML utilities
-  namespace XML {
-
+#define DD4HEP_DIMENSION_NS XML
 #include "XML/detail/ChildValue.inl"
-    
-  }       /* End namespace XML            */
-}         /* End namespace DD4hep         */
+#undef  DD4HEP_DIMENSION_NS
+
 #endif    /* DD4HEP_XML_XMLCHILDVALUE_INL */
diff --git a/DDCore/include/XML/XMLDetector.h b/DDCore/include/XML/XMLDetector.h
index f5c3eb550..164cefdb7 100644
--- a/DDCore/include/XML/XMLDetector.h
+++ b/DDCore/include/XML/XMLDetector.h
@@ -16,18 +16,8 @@
 // Framework include files
 #include "XML/XMLDimension.h"
 
-/// Namespace for the AIDA detector description toolkit
-namespace DD4hep {
-
-  // Forward declarations
-  class NamedObject;
-
-  /// Namespace for the AIDA detector description toolkit supporting XML utilities
-  namespace XML {
-
-    /// Include the implementation in the proper namespace
+#define DD4HEP_DIMENSION_NS XML
 #include "XML/detail/Detector.h"
+#undef  DD4HEP_DIMENSION_NS
 
-  }
-}         /* End namespace DD4hep    */
 #endif    /* DD4HEP_XMLDETECTOR_H    */
diff --git a/DDCore/include/XML/XMLDimension.h b/DDCore/include/XML/XMLDimension.h
index 9bbc9d361..7af7c2452 100644
--- a/DDCore/include/XML/XMLDimension.h
+++ b/DDCore/include/XML/XMLDimension.h
@@ -17,15 +17,8 @@
 #include "XML/XMLElements.h"
 #include "XML/XMLTags.h"
 
-/// Namespace for the AIDA detector description toolkit
-namespace DD4hep {
-
-  /// Namespace for the AIDA detector description toolkit supporting XML utilities
-  namespace XML {
-
-    /// Re-use the defined interface for the XML data access
+#define DD4HEP_DIMENSION_NS XML
 #include "XML/detail/Dimension.h"
-    
-  }       /* End namespace XML           */
-}         /* End namespace DD4hep        */
+#undef  DD4HEP_DIMENSION_NS
+
 #endif    /* DD4HEP_XML_XMLDIMENSION_H   */
diff --git a/DDCore/include/XML/XMLDimension.inl b/DDCore/include/XML/XMLDimension.inl
index 1a1620a81..cda64b76c 100644
--- a/DDCore/include/XML/XMLDimension.inl
+++ b/DDCore/include/XML/XMLDimension.inl
@@ -14,11 +14,10 @@
 #ifndef DD4HEP_XMLDIMENSION_INL
 #define DD4HEP_XMLDIMENSION_INL
 
-
-#define DIMENSION_NS XML
-
-// Framework include files
 #include "XML/XMLDimension.h"
+
+#define DD4HEP_DIMENSION_NS XML
 #include "XML/detail/Dimension.inl"
+#undef  DD4HEP_DIMENSION_NS
 
 #endif /* DD4HEP_XMLDIMENSION_INL  */
diff --git a/DDCore/include/XML/detail/ChildValue.h b/DDCore/include/XML/detail/ChildValue.h
index e7ae23ad5..99d12a144 100644
--- a/DDCore/include/XML/detail/ChildValue.h
+++ b/DDCore/include/XML/detail/ChildValue.h
@@ -19,347 +19,359 @@
  */
 
 
-/// XML Handle to xml elements with predefined child access
-/**
- *  Helper class to access any field in a xml tag in a
- *  very easy way.
- *  - You may assign any xml handle to a childvalue object
- *  - Any child with the name and the value attribute set may then be accessed
- *    by it's natural way. All possible child names are
- *    reflected by the object's member functions.
- *
- *    IMPORTANT NOTE:
- *    to be understood, the child elements MUST have structure like:
- *    <inner_r value="76*cm" ....other attributes...../>
- *    Other attributes may e.g. be a comment describing the variable.
- *    The 'other attributes' are ignored. The 'value' attribute
- *    is mandatory.
- *
- *  - If an child is requested and not present, a exception
- *    is thrown.
- *  - Functions, which accept a default value do NOT throw
- *    an exception if the child is not present. These
- *    rather return the default value.
- *  - If a often used function is not present - the
- *    implementation thereof is simple.
- *
- *  Such helper classes may be defined locally by any user
- *  since XML element handles may easily be transferred.
- *  Run-time exceptions occur however, if non-exiting child elements
- *  are accessed.
- *
- *  \author  M.Frank
- *  \version 1.0
- *  \ingroup DD4HEP_XML
- */
-struct ChildValue: public Element {
-  /// Default constructor
-  ChildValue()
-    : Element(Handle_t(0)) {
-  }
-  /// Constructor from Handle
-  ChildValue(Handle_t e)
-    : Element(e) {
-  }
-  /// Constructor from Element
-  ChildValue(const Element& e)
-    : Element(e) {
-  }
+/// Namespace for the AIDA detector description toolkit
+namespace DD4hep {
+
+  // Forward declarations
+  class NamedObject;
+
+  /// Namespace for the AIDA detector description toolkit supporting JSON utilities
+  namespace DD4HEP_DIMENSION_NS {
+
+    /// XML Handle to xml elements with predefined child access
+    /**
+     *  Helper class to access any field in a xml tag in a
+     *  very easy way.
+     *  - You may assign any xml handle to a childvalue object
+     *  - Any child with the name and the value attribute set may then be accessed
+     *    by it's natural way. All possible child names are
+     *    reflected by the object's member functions.
+     *
+     *    IMPORTANT NOTE:
+     *    to be understood, the child elements MUST have structure like:
+     *    <inner_r value="76*cm" ....other attributes...../>
+     *    Other attributes may e.g. be a comment describing the variable.
+     *    The 'other attributes' are ignored. The 'value' attribute
+     *    is mandatory.
+     *
+     *  - If an child is requested and not present, a exception
+     *    is thrown.
+     *  - Functions, which accept a default value do NOT throw
+     *    an exception if the child is not present. These
+     *    rather return the default value.
+     *  - If a often used function is not present - the
+     *    implementation thereof is simple.
+     *
+     *  Such helper classes may be defined locally by any user
+     *  since XML element handles may easily be transferred.
+     *  Run-time exceptions occur however, if non-exiting child elements
+     *  are accessed.
+     *
+     *  \author  M.Frank
+     *  \version 1.0
+     *  \ingroup DD4HEP_XML
+     */
+    struct ChildValue: public Element {
+      /// Default constructor
+      ChildValue()
+        : Element(Handle_t(0)) {
+      }
+      /// Constructor from Handle
+      ChildValue(Handle_t e)
+        : Element(e) {
+      }
+      /// Constructor from Element
+      ChildValue(const Element& e)
+        : Element(e) {
+      }
+
+      /// Access parameters: id
+      int id() const;
+      /// Access parameters: id, if not present returns default
+      int id(int default_value) const;
 
-  /// Access parameters: id
-  int id() const;
-  /// Access parameters: id, if not present returns default
-  int id(int default_value) const;
+      /// Access parameters: type
+      int type() const;
+      /// Access rotation constants: combineHits
+      bool combineHits() const;
 
-  /// Access parameters: type
-  int type() const;
-  /// Access rotation constants: combineHits
-  bool combineHits() const;
+      /// Access rotation constants: angle
+      double angle() const;
+      /// Access rotation constants: angle
+      double alpha() const;
+      /// Access rotation constants: angle
+      double beta() const;
+      /// Access rotation constants: angle
+      double gamma() const;
+      /// Access rotation constants: angle
+      double delta() const;
+      /// Access rotation constants: angle
+      double epsilon() const;
+      /// Access rotation constants: theta
+      double theta() const;
+      /// Access rotation constants: thetaBins
+      int thetaBins() const;
 
-  /// Access rotation constants: angle
-  double angle() const;
-  /// Access rotation constants: angle
-  double alpha() const;
-  /// Access rotation constants: angle
-  double beta() const;
-  /// Access rotation constants: angle
-  double gamma() const;
-  /// Access rotation constants: angle
-  double delta() const;
-  /// Access rotation constants: angle
-  double epsilon() const;
-  /// Access rotation constants: theta
-  double theta() const;
-  /// Access rotation constants: thetaBins
-  int thetaBins() const;
+      /// Access rotation constants: phi
+      double phi() const;
+      /// Access rotation constants: phiBins
+      int phiBins() const;
+      /// Access rotation constants: phi0
+      double phi0() const;
+      /// Access parameters: phi0, if not present returns default
+      double phi0(double default_value) const;
+      /// Access rotation constants: phi0_offset
+      double phi0_offset() const;
+      /// Access parameters: phi0_offset, if not present returns default
+      double phi0_offset(double default_value) const;
+      /// Access rotation constants: phi1
+      double phi1() const;
+      /// Access parameters: phi1, if not present returns default
+      double phi1(double default_value) const;
+      /// Access rotation constants: psi
+      double psi() const;
 
-  /// Access rotation constants: phi
-  double phi() const;
-  /// Access rotation constants: phiBins
-  int phiBins() const;
-  /// Access rotation constants: phi0
-  double phi0() const;
-  /// Access parameters: phi0, if not present returns default
-  double phi0(double default_value) const;
-  /// Access rotation constants: phi0_offset
-  double phi0_offset() const;
-  /// Access parameters: phi0_offset, if not present returns default
-  double phi0_offset(double default_value) const;
-  /// Access rotation constants: phi1
-  double phi1() const;
-  /// Access parameters: phi1, if not present returns default
-  double phi1(double default_value) const;
-  /// Access rotation constants: psi
-  double psi() const;
+      /// Access Tube parameters: zhalf
+      double zhalf() const;
+      /// Access Tube parameters: deltaphi
+      double deltaphi() const;
 
-  /// Access Tube parameters: zhalf
-  double zhalf() const;
-  /// Access Tube parameters: deltaphi
-  double deltaphi() const;
+      /// Access parameters: b
+      double b() const;
+      /// Access parameters: B
+      double B() const;
+      /// Access parameters: g
+      double g() const;
+      /// Access parameters: G
+      double G() const;
 
-  /// Access parameters: b
-  double b() const;
-  /// Access parameters: B
-  double B() const;
-  /// Access parameters: g
-  double g() const;
-  /// Access parameters: G
-  double G() const;
+      /// Access parameters: r
+      double r() const;
+      /// Access parameters: r, if not present returns default
+      double r(double default_value) const;
+      /// Access parameters: R
+      double R() const;
+      /// Access parameters: dr
+      double dr() const;
+      /// Access parameters: r0
+      double r0() const;
+      /// Access parameters: dr, if not present returns default
+      double dr(double default_value) const;
+      /// Access min/max parameters: rmin
+      double rmin() const;
+      /// Access min/max parameters: rmax
+      double rmax() const;
+      /// Access min/max parameters: rmin1
+      double rmin1() const;
+      /// Access min/max parameters: rmax1
+      double rmax1() const;
+      /// Access min/max parameters: rmin2
+      double rmin2() const;
+      /// Access min/max parameters: rmax2
+      double rmax2() const;
+      /// Access parameters: radius
+      double radius() const;
+      /// Access attribute values: distance
+      double distance() const;
+      /// Access attribute values: outer_radius
+      double outer_radius() const;
+      /// Access attribute values: outer_r
+      double outer_r() const;
+      /// Access attribute values: inner_radius
+      double inner_radius() const;
+      /// Access attribute values: inner_r
+      double inner_r() const;
 
-  /// Access parameters: r
-  double r() const;
-  /// Access parameters: r, if not present returns default
-  double r(double default_value) const;
-  /// Access parameters: R
-  double R() const;
-  /// Access parameters: dr
-  double dr() const;
-  /// Access parameters: r0
-  double r0() const;
-  /// Access parameters: dr, if not present returns default
-  double dr(double default_value) const;
-  /// Access min/max parameters: rmin
-  double rmin() const;
-  /// Access min/max parameters: rmax
-  double rmax() const;
-  /// Access min/max parameters: rmin1
-  double rmin1() const;
-  /// Access min/max parameters: rmax1
-  double rmax1() const;
-  /// Access min/max parameters: rmin2
-  double rmin2() const;
-  /// Access min/max parameters: rmax2
-  double rmax2() const;
-  /// Access parameters: radius
-  double radius() const;
-  /// Access attribute values: distance
-  double distance() const;
-  /// Access attribute values: outer_radius
-  double outer_radius() const;
-  /// Access attribute values: outer_r
-  double outer_r() const;
-  /// Access attribute values: inner_radius
-  double inner_radius() const;
-  /// Access attribute values: inner_r
-  double inner_r() const;
+      /// Access parameters: x
+      double x() const;
+      /// Access parameters: x, if not present returns default
+      double x(double default_val) const;
+      /// Access parameters: X
+      double X() const;
+      /// Access parameters: x0
+      double x0() const;
+      /// Access parameters: x1
+      double x1() const;
+      /// Access parameters: x2
+      double x2() const;
+      /// Access parameters: dx
+      double dx() const;
+      /// Access parameters: dx, if not present returns default
+      double dx(double default_value) const;
+      /// Access min/max parameters: xmax
+      double xmin() const;
+      /// Access min/max parameters: xmax
+      double xmax() const;
+      /// Access min/max parameters: x_offset
+      double x_offset() const;
+      /// Access min/max parameters: dim_x
+      double dim_x() const;
 
-  /// Access parameters: x
-  double x() const;
-  /// Access parameters: x, if not present returns default
-  double x(double default_val) const;
-  /// Access parameters: X
-  double X() const;
-  /// Access parameters: x0
-  double x0() const;
-  /// Access parameters: x1
-  double x1() const;
-  /// Access parameters: x2
-  double x2() const;
-  /// Access parameters: dx
-  double dx() const;
-  /// Access parameters: dx, if not present returns default
-  double dx(double default_value) const;
-  /// Access min/max parameters: xmax
-  double xmin() const;
-  /// Access min/max parameters: xmax
-  double xmax() const;
-  /// Access min/max parameters: x_offset
-  double x_offset() const;
-  /// Access min/max parameters: dim_x
-  double dim_x() const;
+      /// Access parameters: y
+      double y() const;
+      /// Access parameters: y, if not present returns default
+      double y(double default_val) const;
+      /// Access parameters: Y
+      double Y() const;
+      /// Access parameters: y0
+      double y0() const;
+      /// Access parameters: y1
+      double y1() const;
+      /// Access parameters: y2
+      double y2() const;
+      /// Access parameters: dy
+      double dy() const;
+      /// Access parameters: dz, if not present returns default
+      double dy(double default_value) const;
+      /// Access min/max parameters: ymax
+      double ymin() const;
+      /// Access min/max parameters: ymax
+      double ymax() const;
+      /// Access min/max parameters: y_offset
+      double y_offset() const;
+      /// Access min/max parameters: dim_y
+      double dim_y() const;
 
-  /// Access parameters: y
-  double y() const;
-  /// Access parameters: y, if not present returns default
-  double y(double default_val) const;
-  /// Access parameters: Y
-  double Y() const;
-  /// Access parameters: y0
-  double y0() const;
-  /// Access parameters: y1
-  double y1() const;
-  /// Access parameters: y2
-  double y2() const;
-  /// Access parameters: dy
-  double dy() const;
-  /// Access parameters: dz, if not present returns default
-  double dy(double default_value) const;
-  /// Access min/max parameters: ymax
-  double ymin() const;
-  /// Access min/max parameters: ymax
-  double ymax() const;
-  /// Access min/max parameters: y_offset
-  double y_offset() const;
-  /// Access min/max parameters: dim_y
-  double dim_y() const;
+      /// Access parameters: z
+      double z() const;
+      /// Access parameters: z, if not present returns default
+      double z(double default_val) const;
+      /// Access parameters: Z
+      double Z() const;
+      /// Access parameters: z0
+      double z0() const;
+      /// Access parameters: z1
+      double z1() const;
+      /// Access parameters: z2
+      double z2() const;
+      /// Access parameters: dz
+      double dz() const;
+      /// Access parameters: dz, if not present returns default
+      double dz(double default_value) const;
+      /// Access min/max parameters: zmax
+      double zmin() const;
+      /// Access min/max parameters: zmax
+      double zmax() const;
+      /// Access attribute values: outer_z
+      double outer_z() const;
+      /// Access attribute values: inner_z
+      double inner_z() const;
+      /// Access min/max parameters: z_offset
+      double z_offset() const;
+      /// Access min/max parameters: dim_z
+      double dim_z() const;
 
-  /// Access parameters: z
-  double z() const;
-  /// Access parameters: z, if not present returns default
-  double z(double default_val) const;
-  /// Access parameters: Z
-  double Z() const;
-  /// Access parameters: z0
-  double z0() const;
-  /// Access parameters: z1
-  double z1() const;
-  /// Access parameters: z2
-  double z2() const;
-  /// Access parameters: dz
-  double dz() const;
-  /// Access parameters: dz, if not present returns default
-  double dz(double default_value) const;
-  /// Access min/max parameters: zmax
-  double zmin() const;
-  /// Access min/max parameters: zmax
-  double zmax() const;
-  /// Access attribute values: outer_z
-  double outer_z() const;
-  /// Access attribute values: inner_z
-  double inner_z() const;
-  /// Access min/max parameters: z_offset
-  double z_offset() const;
-  /// Access min/max parameters: dim_z
-  double dim_z() const;
+      /// Access attribute values: length
+      double length() const;
+      /// Access attribute values: width
+      double width() const;
+      /// Access attribute values: height
+      double height() const;
+      /// Access attribute values: depth
+      double depth() const;
+      /// Access attribute values: thickness
+      double thickness() const;
 
-  /// Access attribute values: length
-  double length() const;
-  /// Access attribute values: width
-  double width() const;
-  /// Access attribute values: height
-  double height() const;
-  /// Access attribute values: depth
-  double depth() const;
-  /// Access attribute values: thickness
-  double thickness() const;
+      /// Access attribute values: z_length
+      double z_length() const;
+      /// Access attribute values: gap
+      double gap() const;
+      /// Access attribute values: r_size
+      double r_size() const;
+      /// Access attribute values: phi_size_max
+      double phi_size_max() const;
+      /// Access attribute values: reflect
+      bool reflect() const;
+      /// Access attribute values: reflect
+      bool reflect(bool default_value) const;
+      /// Access attribute values: crossing_angle
+      double crossing_angle() const;
+      /// Access attribute values: repeat
+      int repeat() const;
 
-  /// Access attribute values: z_length
-  double z_length() const;
-  /// Access attribute values: gap
-  double gap() const;
-  /// Access attribute values: r_size
-  double r_size() const;
-  /// Access attribute values: phi_size_max
-  double phi_size_max() const;
-  /// Access attribute values: reflect
-  bool reflect() const;
-  /// Access attribute values: reflect
-  bool reflect(bool default_value) const;
-  /// Access attribute values: crossing_angle
-  double crossing_angle() const;
-  /// Access attribute values: repeat
-  int repeat() const;
+      /// Access attribute values: outgoing_r
+      double outgoing_r() const;
+      /// Access attribute values: incoming_r
+      double incoming_r() const;
+      /// Access attribute values: offset
+      double offset() const;
+      /// Access attribute values: offset
+      double offset(double default_value) const;
+      /// Access attribute values: number
+      int number() const;
 
-  /// Access attribute values: outgoing_r
-  double outgoing_r() const;
-  /// Access attribute values: incoming_r
-  double incoming_r() const;
-  /// Access attribute values: offset
-  double offset() const;
-  /// Access attribute values: offset
-  double offset(double default_value) const;
-  /// Access attribute values: number
-  int number() const;
+      /// Access attribute values: nmodules
+      int nmodules() const;
+      /// Access attribute values: nModules
+      int nModules() const;
+      /// Access attribute values: RowID
+      int RowID() const;
+      /// Access attribute values: moduleHeight
+      double moduleHeight() const;
+      /// Access attribute values: moduleWidth
+      double moduleWidth() const;
+      /// Access attribute values: modulePitch
+      double modulePitch() const;
+      /// Access attribute values: modulePosX
+      double modulePosX() const;
+      /// Access attribute values: modulePosY
+      double modulePosY() const;
 
-  /// Access attribute values: nmodules
-  int nmodules() const;
-  /// Access attribute values: nModules
-  int nModules() const;
-  /// Access attribute values: RowID
-  int RowID() const;
-  /// Access attribute values: moduleHeight
-  double moduleHeight() const;
-  /// Access attribute values: moduleWidth
-  double moduleWidth() const;
-  /// Access attribute values: modulePitch
-  double modulePitch() const;
-  /// Access attribute values: modulePosX
-  double modulePosX() const;
-  /// Access attribute values: modulePosY
-  double modulePosY() const;
+      /// Access attribute values: nPads
+      int nPads() const;
+      /// Access attribute values: rowPitch
+      double rowPitch() const;
+      /// Access attribute values: padPitch
+      double padPitch() const;
+      /// Access attribute values: rowHeight
+      double rowHeight() const;
+      /// Access attribute values: padType
+      std::string padType() const;
 
-  /// Access attribute values: nPads
-  int nPads() const;
-  /// Access attribute values: rowPitch
-  double rowPitch() const;
-  /// Access attribute values: padPitch
-  double padPitch() const;
-  /// Access attribute values: rowHeight
-  double rowHeight() const;
-  /// Access attribute values: padType
-  std::string padType() const;
+      /// Access attribute values: numsides
+      int numsides() const;
+      /// Access attribute values: nsides
+      int nsides() const;
+      /// Access attribute values: nsides_inner
+      int nsides_inner() const;
+      /// Access attribute values: nsides_outer
+      int nsides_outer() const;
 
-  /// Access attribute values: numsides
-  int numsides() const;
-  /// Access attribute values: nsides
-  int nsides() const;
-  /// Access attribute values: nsides_inner
-  int nsides_inner() const;
-  /// Access attribute values: nsides_outer
-  int nsides_outer() const;
+      /// Access attribute values: phi_tilt
+      double phi_tilt() const;
+      /// Access attribute values: nphi
+      int nphi() const;
+      /// Access attribute values: rc
+      double rc() const;
 
-  /// Access attribute values: phi_tilt
-  double phi_tilt() const;
-  /// Access attribute values: nphi
-  int nphi() const;
-  /// Access attribute values: rc
-  double rc() const;
+      /// Access attribute values: zstart
+      double zstart() const;
+      /// Access attribute values: nz
+      int nz() const;
 
-  /// Access attribute values: zstart
-  double zstart() const;
-  /// Access attribute values: nz
-  int nz() const;
+      /// Access attribute values: start
+      double start() const;
+      /// Access attribute values: end
+      double end() const;
+      /// Access attribute values: inner_field
+      double inner_field() const;
+      /// Access attribute values: outer_field
+      double outer_field() const;
 
-  /// Access attribute values: start
-  double start() const;
-  /// Access attribute values: end
-  double end() const;
-  /// Access attribute values: inner_field
-  double inner_field() const;
-  /// Access attribute values: outer_field
-  double outer_field() const;
+      /// Access attribute values: visible
+      bool visible() const;
+      /// Access attribute values: show_daughters
+      bool show_daughters() const;
 
-  /// Access attribute values: visible
-  bool visible() const;
-  /// Access attribute values: show_daughters
-  bool show_daughters() const;
+      /// Access "name" attribute as STL string
+      std::string nameStr() const;
+      /// Access "ref" attribute as a string
+      std::string refStr() const;
+      /// Access "type" attribute as STL string
+      std::string typeStr() const;
+      /// Access "value" attribute as STL string
+      std::string valueStr() const;
+      /// Access "module" attribute as STL string
+      std::string moduleStr() const;
+      /// Access "readout" attribute as STL string
+      std::string readoutStr() const;
+      /// Access vis attribute as STL string. If not present empty return empty string
+      std::string visStr() const;
+      /// Access region attribute as STL string. If not present empty return empty string
+      std::string regionStr() const;
+      /// Access limits attribute as STL string. If not present empty return empty string
+      std::string limitsStr() const;
+    };
 
-  /// Access "name" attribute as STL string
-  std::string nameStr() const;
-  /// Access "ref" attribute as a string
-  std::string refStr() const;
-  /// Access "type" attribute as STL string
-  std::string typeStr() const;
-  /// Access "value" attribute as STL string
-  std::string valueStr() const;
-  /// Access "module" attribute as STL string
-  std::string moduleStr() const;
-  /// Access "readout" attribute as STL string
-  std::string readoutStr() const;
-  /// Access vis attribute as STL string. If not present empty return empty string
-  std::string visStr() const;
-  /// Access region attribute as STL string. If not present empty return empty string
-  std::string regionStr() const;
-  /// Access limits attribute as STL string. If not present empty return empty string
-  std::string limitsStr() const;
-};
+  }       /* End namespace DD4HEP_DIMENSION_NS       */
+}         /* End namespace DD4hep                    */
diff --git a/DDCore/include/XML/detail/Conversions.h b/DDCore/include/XML/detail/Conversions.h
new file mode 100644
index 000000000..53bbe761e
--- /dev/null
+++ b/DDCore/include/XML/detail/Conversions.h
@@ -0,0 +1,66 @@
+//==========================================================================
+//  AIDA Detector description implementation for LCD
+//--------------------------------------------------------------------------
+// Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
+// All rights reserved.
+//
+// For the licensing terms see $DD4hepINSTALL/LICENSE.
+// For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
+//
+// Author     : M.Frank
+//
+//==========================================================================
+
+/** 
+ *  Note: Do NEVER include this file directly!
+ *
+ *  Use the specific include files in the XML or JSON directory!
+ *  Also NO header guards!
+ */
+
+
+// C/C++ include files
+#include <map>
+#include <iostream>
+
+// Framework include files
+#include "DD4hep/LCDD.h"
+
+/// Namespace for the AIDA detector description toolkit
+namespace DD4hep {
+
+  /// Namespace for the AIDA detector description toolkit supporting XML utilities
+  namespace DD4HEP_CONVERSION_NS {
+    class Handle_t;
+  }
+
+  /// Basic conversion objects for handling DD4hep XML files.
+  /**
+   *  \author   M.Frank
+   *  \version  1.0
+   *  \ingroup DD4HEP_XML
+   */
+  template <typename T, typename ARG=DD4HEP_CONVERSION_NS::Handle_t> struct Converter {
+    typedef T to_type;
+    typedef void* user_param;
+    /// Reference to the detector description object
+    Geometry::LCDD& lcdd;
+    /// Reference to optional user defined parameter
+    user_param param;
+    user_param optional;
+    /// Initializing constructor of the functor
+    Converter(Geometry::LCDD& l) : lcdd(l), param(0), optional(0) { }
+    /// Initializing constructor of the functor with initialization of the user parameter
+    Converter(Geometry::LCDD& l, user_param p) : lcdd(l), param(p), optional(0) { }
+    /// Initializing constructor of the functor with initialization of the user parameter
+    Converter(Geometry::LCDD& l, user_param p, user_param o) : lcdd(l), param(p), optional(o)  { }
+    /// Callback operator to be specialized depending on the element type
+    void operator()(ARG handle) const;
+    /// Typed access to the 1rst. user parameter (unchecked)
+    template <typename TYPE> TYPE* _param() const  {    return (TYPE*) param;     }
+    /// Typed object access to the 1rst. user parameter (unchecked)
+    template <typename TYPE> TYPE& _object() const {    return *(TYPE*) param;    }
+    /// Typed access to the 2nd. user parameter (unchecked)
+    template <typename TYPE> TYPE* _option() const {    return (TYPE*) optional;  }
+  };
+} /* End namespace DD4hep           */
diff --git a/DDCore/include/XML/detail/Detector.h b/DDCore/include/XML/detail/Detector.h
index ccf4d9a69..ff6a86331 100644
--- a/DDCore/include/XML/detail/Detector.h
+++ b/DDCore/include/XML/detail/Detector.h
@@ -18,71 +18,84 @@
  *  Include XML/XMLDetector.h or JSON/Detector.h !
  */
 
-/// Generic Handle class extending the generic handle Dimension
-/**
- *  Helper class to access any field in a xml tag.
- *  Specialized for attributes of a detector sub-element.
- *
- *  \author   M.Frank
- *  \version  1.0
- *  \ingroup DD4HEP_XML
- */
-struct Component: public Dimension {
-  /// Constructor from Handle
-  Component(Handle_t e)
-    : Dimension(e) {
-  }
-  /// Constructor from Element
-  Component(const Element& e)
-    : Dimension(e) {
-  }
-  /// Access material attribute as STL string
-  std::string materialStr() const;
-  /// Check if component is sensitive
-  bool isSensitive() const;
+
+/// Namespace for the AIDA detector description toolkit
+namespace DD4hep {
+
+  // Forward declarations
+  class NamedObject;
+
+  /// Namespace for the AIDA detector description toolkit supporting JSON utilities
+  namespace DD4HEP_DIMENSION_NS {
+
+    /// Generic Handle class extending the generic handle Dimension
+    /**
+     *  Helper class to access any field in a xml tag.
+     *  Specialized for attributes of a detector sub-element.
+     *
+     *  \author   M.Frank
+     *  \version  1.0
+     *  \ingroup DD4HEP_XML
+     */
+    struct Component: public Dimension {
+      /// Constructor from Handle
+      Component(Handle_t e)
+        : Dimension(e) {
+      }
+      /// Constructor from Element
+      Component(const Element& e)
+        : Dimension(e) {
+      }
+      /// Access material attribute as STL string
+      std::string materialStr() const;
+      /// Check if component is sensitive
+      bool isSensitive() const;
       
-  /// Check if component is a radiator (absorber)
-  bool isRadiator() const;
+      /// Check if component is a radiator (absorber)
+      bool isRadiator() const;
       
-  /// Create a shape using the plugin mechanism from an XML element
-  NamedObject* createShape() const;
-};
+      /// Create a shape using the plugin mechanism from an XML element
+      NamedObject* createShape() const;
+    };
 
-/// XML Handle class extending the XML handle Dimension
-/**
- *  Helper class to access any field in a xml tag.
- *  Specialized for some of the attributes of a detector element.
- *
- *  \author   M.Frank
- *  \version  1.0
- *  \ingroup DD4HEP_XML
- */
-struct DetElement: public Dimension {
-  /// Constructor from Handle
-  DetElement(Handle_t e)
-    : Dimension(e) {
-  }
-  /// Access underlying XML handle object
-  Handle_t handle() const {
-    return m_element;
-  }
+    /// XML Handle class extending the XML handle Dimension
+    /**
+     *  Helper class to access any field in a xml tag.
+     *  Specialized for some of the attributes of a detector element.
+     *
+     *  \author   M.Frank
+     *  \version  1.0
+     *  \ingroup DD4HEP_XML
+     */
+    struct DetElement: public Dimension {
+      /// Constructor from Handle
+      DetElement(Handle_t e)
+        : Dimension(e) {
+      }
+      /// Access underlying XML handle object
+      Handle_t handle() const {
+        return m_element;
+      }
+
+      /// Access parameters: id
+      int id() const;
+      /// Access material attribute as STL string. If not present empty return empty string
+      std::string materialStr() const;
+      /// Check if xml detector element is sensitive
+      bool isSensitive() const;
+      /// Check if element describes a tracking detector
+      bool isTracker() const;
+      /// Check if element describes a calorimetric detector
+      bool isCalorimeter() const;
+      /// Check if element is inside the tracking volume
+      bool isInsideTrackingVolume() const;
+      /// Helper to check a condition (for debugging)
+      void check(bool condition, const std::string& msg) const;
+      /// Access attribute by type
+      template <typename T> T attr(const XmlChar* tag_value) const {
+        return m_element.attr < T > (tag_value);
+      }
+    };
 
-  /// Access parameters: id
-  int id() const;
-  /// Access material attribute as STL string. If not present empty return empty string
-  std::string materialStr() const;
-  /// Check if xml detector element is sensitive
-  bool isSensitive() const;
-  /// Check if element describes a tracking detector
-  bool isTracker() const;
-  /// Check if element describes a calorimetric detector
-  bool isCalorimeter() const;
-  /// Check if element is inside the tracking volume
-  bool isInsideTrackingVolume() const;
-  /// Helper to check a condition (for debugging)
-  void check(bool condition, const std::string& msg) const;
-  /// Access attribute by type
-  template <typename T> T attr(const XmlChar* tag_value) const {
-    return m_element.attr < T > (tag_value);
-  }
-};
+  }       /* End namespace DD4HEP_DIMENSION_NS       */
+}         /* End namespace DD4hep                    */
diff --git a/DDCore/include/XML/detail/Dimension.h b/DDCore/include/XML/detail/Dimension.h
index 09e524fdf..7256c29d4 100644
--- a/DDCore/include/XML/detail/Dimension.h
+++ b/DDCore/include/XML/detail/Dimension.h
@@ -19,547 +19,556 @@
  */
 
 
-/// XML Handle to xml elements with predefined attribute access
-/**
- *  Helper class to access any field in a xml tag in a
- *  very easy way.
- *  - You may assign any xml handle to a dimension object
- *  - Any attribute of this xml element may then be accessed
- *    by it's natural way. All possible attribute names are
- *    reflected by the Dimension object's member functions.
- *  - If an attribute is requested and not present, a exception
- *    is thrown.
- *  - Functions, which accept a default value do NOT throw
- *    an exception if the attribute is not present. These
- *    rather return the default value.
- *  - If a often used function is not present - the
- *    implementation thereof is simple.
- *
- *  Such helper classes may be defined locally by any user
- *  since XML element handles may easily be transferred.
- *  Run-time exceptions occur however, if non-exiting attributes
- *  are accessed.
- *
- *  \author  M.Frank
- *  \version 1.0
- *  \ingroup DD4HEP_XML
- */
-struct Dimension: public Element {
-  /// Default constructor
-  Dimension()
-    : Element(Handle_t(0)) {
-  }
-  /// Constructor from Handle
-  Dimension(Handle_t e)
-    : Element(e) {
-  }
-  /// Constructor from Element
-  Dimension(const Element& e)
-    : Element(e) {
-  }
-
-  /// Access parameters: id
-  int id() const;
-  /// Access parameters: id, if not present returns default
-  int id(int default_value) const;
-
-  /// Access parameters: type
-  int type() const;
-  /// Access rotation constants: combineHits
-  bool combineHits() const;
-
-  /// Access rotation constants: angle
-  double angle() const;
-  /// Access rotation constants: alpha
-  double alpha() const;
-  /// Access rotation constants: alpha
-  double alpha(double default_value) const;
-  /// Access rotation constants: alpha1
-  double alpha1() const;
-  /// Access rotation constants: alpha1
-  double alpha1(double default_value) const;
-  /// Access rotation constants: alpha2
-  double alpha2() const;
-  /// Access rotation constants: alpha2
-  double alpha2(double default_value) const;
-  /// Access rotation constants: angle
-  double beta() const;
-  /// Access rotation constants: angle
-  double beta(double default_value) const;
-  /// Access rotation constants: angle
-  double gamma() const;
-  /// Access rotation constants: angle
-  double gamma(double default_value) const;
-  /// Access rotation constants: angle
-  double delta() const;
-  /// Access rotation constants: angle
-  double delta(double default_value) const;
-  /// Access rotation constants: angle
-  double epsilon() const;
-  /// Access rotation constants: angle
-  double epsilon(double default_value) const;
-  /// Access rotation constants: theta
-  double theta() const;
-  /// Access rotation constants: theta
-  double theta(double default_value) const;
-  /// Access rotation constants: deltatheta
-  double deltatheta() const;
-  /// Access rotation constants: deltatheta
-  double deltatheta(double default_value) const;
-  /// Access rotation constants: thetaBins
-  int thetaBins() const;
-
-  /// Access rotation constants: phi
-  double phi() const;
-  /// Access rotation constants: phi
-  double phi(double default_value) const;
-  /// Access rotation constants: phiBins
-  int phiBins() const;
-  /// Access rotation constants: phi0
-  double phi0() const;
-  /// Access parameters: phi0, if not present returns default
-  double phi0(double default_value) const;
-  /// Access rotation constants: phi0_offset
-  double phi0_offset() const;
-  /// Access parameters: phi0_offset, if not present returns default
-  double phi0_offset(double default_value) const;
-  /// Access rotation constants: phi1
-  double phi1() const;
-  /// Access parameters: phi1, if not present returns default
-  double phi1(double default_value) const;
-  /// Access rotation constants: psi
-  double psi() const;
-  /// Access rotation constants: psi
-  double psi(double default_value) const;
-
-  /// Access Tube parameters: zhalf
-  double zhalf() const;
-  /// Access Tube parameters: deltaphi
-  double deltaphi() const;
-  /// Access Tube parameters: deltaphi
-  double deltaphi(double default_value) const;
-  /// Access rotation constants: startphi
-  double startphi() const;
-  /// Access rotation constants: startphi
-  double startphi(double default_value) const;
-
-  /// Access parameters: a
-  double a() const;
-  /// Access parameters: a
-  double a(double default_value) const;
-  /// Access parameters: A
-  double A() const;
-  /// Access parameters: A
-  double A(double default_value) const;
-  /// Access parameters: b
-  double b() const;
-  /// Access parameters: b
-  double b(double default_value) const;
-  /// Access parameters: c
-  double c() const;
-  /// Access parameters: c
-  double c(double default_value) const;
-  ///Access parameters: distance
-  double distance() const;
-  ///Access parameters: distance
-  double distance(double default_value) const;
-  /// Access parameters: B
-  double B() const;
-  /// Access parameters: B
-  double B(double default_value) const;
-  /// Access parameters: g
-  double g() const;
-  /// Access parameters: g
-  double g(double default_value) const;
-  /// Access parameters: G
-  double G() const;
-  /// Access parameters: G
-  double G(double default_value) const;
-  /// Access parameters: I
-  double I() const;
-  /// Access parameters: I
-  double I(double default_value) const;
-
-  /// Access parameters: r
-  double r() const;
-  /// Access parameters: r, if not present returns default
-  double r(double default_value) const;
-  /// Access parameters: R
-  double R() const;
-  /// Access parameters: R
-  double R(double default_value) const;
-  /// Access parameters: dr
-  double dr() const;
-  /// Access parameters: dr, if not present returns default
-  double dr(double default_value) const;
-  /// Access parameters: r0
-  double r0() const;
-  /// Access parameters: r0
-  double r0(double default_value) const;
-  /// Access min/max parameters: rmin
-  double rmin() const;
-  /// Access min/max parameters: rmin
-  double rmin(double default_val) const;
-  /// Access min/max parameters: rmax
-  double rmax() const;
-  /// Access min/max parameters: rmax
-  double rmax(double default_val) const;
-  /// Access min/max parameters: rmin1
-  double rmin1() const;
-  /// Access min/max parameters: rmin1
-  double rmin1(double default_val) const;
-  /// Access min/max parameters: rmax1
-  double rmax1() const;
-  /// Access min/max parameters: rmax1
-  double rmax1(double default_val) const;
-  /// Access min/max parameters: rmin2
-  double rmin2() const;
-  /// Access min/max parameters: rmin2
-  double rmin2(double default_val) const;
-  /// Access min/max parameters: rmax2
-  double rmax2() const;
-  /// Access min/max parameters: rmax2
-  double rmax2(double default_val) const;
-  /// Access parameters: radius
-  double radius() const;
-  /// Access parameters: radius
-  double radius(double default_val) const;
-  /// Access attribute values: outer_radius
-  double outer_radius() const;
-  /// Access attribute values: outer_r
-  double outer_r() const;
-  /// Access attribute values: inner_radius
-  double inner_radius() const;
-  /// Access attribute values: inner_r
-  double inner_r() const;
-
-  /// Access parameters: x
-  double x() const;
-  /// Access parameters: x, if not present returns default
-  double x(double default_val) const;
-  /// Access parameters: X
-  double X() const;
-  /// Access parameters: X
-  double X(double default_val) const;
-  /// Access parameters: x0
-  double x0() const;
-  /// Access parameters: x0
-  double x0(double default_val) const;
-  /// Access parameters: x1
-  double x1() const;
-  /// Access parameters: x1
-  double x1(double default_val) const;
-  /// Access parameters: x2
-  double x2() const;
-  /// Access parameters: x2
-  double x2(double default_val) const;
-  /// Access parameters: x3
-  double x3() const;
-  /// Access parameters: x3
-  double x3(double default_val) const;
-  /// Access parameters: x4
-  double x4() const;
-  /// Access parameters: x4
-  double x4(double default_val) const;
-  /// Access parameters: dx
-  double dx() const;
-  /// Access parameters: dx, if not present returns default
-  double dx(double default_value) const;
-  /// Access min/max parameters: xmax
-  double xmin() const;
-  /// Access min/max parameters: xmax
-  double xmin(double default_value) const;
-  /// Access min/max parameters: xmax
-  double xmax() const;
-  /// Access min/max parameters: xmax
-  double xmax(double default_value) const;
-  /// Access min/max parameters: x_offset
-  double x_offset() const;
-  /// Access min/max parameters: x_offset
-  double x_offset(double default_value) const;
-  /// Access min/max parameters: dim_x
-  double dim_x() const;
-  /// Access min/max parameters: dim_x
-  double dim_x(double default_value) const;
-
-  /// Access parameters: y
-  double y() const;
-  /// Access parameters: y, if not present returns default
-  double y(double default_val) const;
-  /// Access parameters: Y
-  double Y() const;
-  /// Access parameters: Y
-  double Y(double default_val) const;
-  /// Access parameters: y0
-  double y0() const;
-  /// Access parameters: y0
-  double y0(double default_value) const;
-  /// Access parameters: y1
-  double y1() const;
-  /// Access parameters: y1
-  double y1(double default_value) const;
-  /// Access parameters: y2
-  double y2() const;
-  /// Access parameters: y2
-  double y2(double default_value) const;
-  /// Access parameters: dy
-  double dy() const;
-  /// Access parameters: dz, if not present returns default
-  double dy(double default_value) const;
-  /// Access min/max parameters: ymax
-  double ymin() const;
-  /// Access min/max parameters: ymax
-  double ymin(double default_value) const;
-  /// Access min/max parameters: ymax
-  double ymax() const;
-  /// Access min/max parameters: ymax
-  double ymax(double default_value) const;
-  /// Access min/max parameters: y_offset
-  double y_offset() const;
-  /// Access min/max parameters: y_offset
-  double y_offset(double default_value) const;
-  /// Access min/max parameters: dim_y
-  double dim_y() const;
-  /// Access min/max parameters: dim_y
-  double dim_y(double default_value) const;
-
-  /// Access parameters: z
-  double z() const;
-  /// Access parameters: z, if not present returns default
-  double z(double default_val) const;
-  /// Access parameters: Z
-  double Z() const;
-  /// Access parameters: Z
-  double Z(double default_val) const;
-  /// Access parameters: z0
-  double z0() const;
-  /// Access parameters: z0
-  double z0(double default_val) const;
-  /// Access parameters: z1
-  double z1() const;
-  /// Access parameters: z1
-  double z1(double default_val) const;
-  /// Access parameters: z2
-  double z2() const;
-  /// Access parameters: z2
-  double z2(double default_val) const;
-  /// Access parameters: dz
-  double dz() const;
-  /// Access parameters: dz, if not present returns default
-  double dz(double default_value) const;
-  /// Access min/max parameters: zmax
-  double zmin() const;
-  /// Access min/max parameters: zmax
-  double zmin(double default_value) const;
-  /// Access min/max parameters: zmax
-  double zmax() const;
-  /// Access min/max parameters: zmax
-  double zmax(double default_value) const;
-  /// Access attribute values: outer_z
-  double outer_z() const;
-  /// Access attribute values: inner_z
-  double inner_z() const;
-  /// Access attribute values: outer_stereo
-  double outer_stereo() const;
-  /// Access attribute values: inner_stereo
-  double inner_stereo() const;
-  /// Access min/max parameters: z_offset
-  double z_offset() const;
-  /// Access min/max parameters: z_offset
-  double z_offset(double default_value) const;
-  /// Access min/max parameters: dim_z
-  double dim_z() const;
-  /// Access min/max parameters: dim_z
-  double dim_z(double default_value) const;
-
-  /// Access attribute values: length
-  double length() const;
-  /// Access attribute values: width
-  double width() const;
-  /// Access attribute values: height
-  double height() const;
-  /// Access attribute values: depth
-  double depth() const;
-  /// Access attribute values: thickness
-  double thickness() const;
-
-  /// Access attribute values: z_length
-  double z_length() const;
-  /// Access attribute values: gap
-  double gap() const;
-  /// Access attribute values: r_size
-  double r_size() const;
-  /// Access attribute values: phi_size_max
-  double phi_size_max() const;
-  /// Access attribute values: reflect
-  bool reflect() const;
-  /// Access attribute values: reflect
-  bool reflect(bool default_value) const;
-  /// Access attribute values: crossing_angle
-  double crossing_angle() const;
-  /// Access attribute values: repeat
-  int repeat() const;
-
-  /// Access attribute values: coefficient
-  double coefficient() const;
-  /// Access attribute values: coefficient
-  double coefficient(double default_value) const;
-
-  /// Access attribute values: skew
-  double skew() const;
-  /// Access attribute values: skew
-  double skew(double default_value) const;
-
-  /// Access attribute values: outgoing_r
-  double outgoing_r() const;
-  /// Access attribute values: incoming_r
-  double incoming_r() const;
-  /// Access attribute values: offset
-  double offset() const;
-  /// Access attribute values: offset
-  double offset(double default_value) const;
-  /// Access attribute values: number
-  int number() const;
-
-  /// Access attribute values: nmodules
-  int nmodules() const;
-  /// Access attribute values: nModules
-  int nModules() const;
-  /// Access attribute values: RowID
-  int RowID() const;
-  /// Access attribute values: moduleHeight
-  double moduleHeight() const;
-  /// Access attribute values: moduleWidth
-  double moduleWidth() const;
-  /// Access attribute values: modulePitch
-  double modulePitch() const;
-  /// Access attribute values: modulePosX
-  double modulePosX() const;
-  /// Access attribute values: modulePosY
-  double modulePosY() const;
-
-  /// Access attribute values: nPads
-  int nPads() const;
-  /// Access attribute values: rowPitch
-  double rowPitch() const;
-  /// Access attribute values: padPitch
-  double padPitch() const;
-  /// Access attribute values: rowHeight
-  double rowHeight() const;
-  /// Access attribute values: padType
-  std::string padType() const;
-
-  /// Access attribute values: numsides
-  int numsides() const;
-  /// Access attribute values: nsides
-  int nsides() const;
-  /// Access attribute values: nsides_inner
-  int nsides_inner() const;
-  /// Access attribute values: nsides_outer
-  int nsides_outer() const;
-
-
-  /// Access attribute values: phi_tilt
-  double phi_tilt() const;
-  /// Access attribute values: nphi
-  int    nphi() const;
-  /// Access attribute values: rc
-  double rc() const;
-
-  /// Access attribute values: zstart
-  double zstart() const;
-  /// Access attribute values: nz
-  int    nz() const;
-  /// Access attribute values: key
-  int    key() const;
-  /// Access attribute values: key_min
-  int    key_min() const;
-  /// Access attribute values: key_max
-  int    key_max() const;
-  /// Access attribute values: key_val
-  int    key_val() const;
-  /// Access attribute values: key_value
-  int    key_value() const;
-
-  /// Access attribute values: start
-  double start() const;
-  /// Access attribute values: start
-  double start(double default_value) const;
-  /// Access attribute values: end
-  double end() const;
-  /// Access attribute values: end
-  double end(double default_value) const;
-  /// Access attribute values: inner_field
-  double inner_field() const;
-  /// Access attribute values: outer_field
-  double outer_field() const;
-
-  /// Access attribute values: visible
-  bool   visible() const;
-  /// Access attribute values: show_daughters
-  bool   show_daughters() const;
-
-  /// Access min/max parameters: cut
-  double cut() const;
-  /// Access min/max parameters: cut
-  double cut(double default_value) const;
-  /// Access min/max parameters: threshold
-  double threshold() const;
-  /// Access min/max parameters: threshold
-  double threshold(double default_value) const;
-  /// Access min/max parameters: eunit
-  double eunit() const;
-  /// Access min/max parameters: eunit
-  double eunit(double default_value) const;
-  /// Access min/max parameters: lunit
-  double lunit() const;
-  /// Access min/max parameters: lunit
-  double lunit(double default_value) const;
-
-  /// Access rotation constants: temperature
-  double temperature() const;
-  /// Access rotation constants: temperature
-  double temperature(double default_value) const;
-  /// Access rotation constants: pressure
-  double pressure() const;
-  /// Access rotation constants: pressure
-  double pressure(double default_value) const;
-  /// Access rotation constants: density
-  double density() const;
-  /// Access rotation constants: density
-  double density(double default_value) const;
-
-  /// Access child element with tag "dimensions" as Dimension object
-  Dimension dimensions(bool throw_if_not_present = true) const;
-  /// Child access: position
-  Dimension position(bool throw_if_not_present = true) const;
-  /// Child access: rotation
-  Dimension rotation(bool throw_if_not_present = true) const;
-  /// Child access: trd
-  Dimension trd(bool throw_if_not_present = true) const;
-  /// Child access: tubs
-  Dimension tubs(bool throw_if_not_present = true) const;
-  /// Child access: staves
-  Dimension staves(bool throw_if_not_present = true) const;
-  /// Child access: beampipe
-  Dimension beampipe(bool throw_if_not_present = true) const;
-
-  /// Access "name" attribute as STL string
-  std::string nameStr() const;
-  /// Access "ref" attribute as a string
-  std::string refStr() const;
-  /// Access "type" attribute as STL string
-  std::string typeStr() const;
-  /// Access "value" attribute as STL string
-  std::string valueStr() const;
-  /// Access "module" attribute as STL string
-  std::string moduleStr() const;
-  /// Access "readout" attribute as STL string
-  std::string readoutStr() const;
-  /// Access vis attribute as STL string. If not present empty return empty string
-  std::string visStr() const;
-  /// Access region attribute as STL string. If not present empty return empty string
-  std::string regionStr() const;
-  /// Access limits attribute as STL string. If not present empty return empty string
-  std::string limitsStr() const;
-};
+/// Namespace for the AIDA detector description toolkit
+namespace DD4hep {
+
+  /// Namespace for the AIDA detector description toolkit supporting JSON utilities
+  namespace DD4HEP_DIMENSION_NS  {
+
+    /// XML Handle to xml elements with predefined attribute access
+    /**
+     *  Helper class to access any field in a xml tag in a
+     *  very easy way.
+     *  - You may assign any xml handle to a dimension object
+     *  - Any attribute of this xml element may then be accessed
+     *    by it's natural way. All possible attribute names are
+     *    reflected by the Dimension object's member functions.
+     *  - If an attribute is requested and not present, a exception
+     *    is thrown.
+     *  - Functions, which accept a default value do NOT throw
+     *    an exception if the attribute is not present. These
+     *    rather return the default value.
+     *  - If a often used function is not present - the
+     *    implementation thereof is simple.
+     *
+     *  Such helper classes may be defined locally by any user
+     *  since XML element handles may easily be transferred.
+     *  Run-time exceptions occur however, if non-exiting attributes
+     *  are accessed.
+     *
+     *  \author  M.Frank
+     *  \version 1.0
+     *  \ingroup DD4HEP_XML
+     */
+    struct Dimension: public Element {
+      /// Default constructor
+      Dimension()
+        : Element(Handle_t(0)) {
+      }
+      /// Constructor from Handle
+      Dimension(Handle_t e)
+        : Element(e) {
+      }
+      /// Constructor from Element
+      Dimension(const Element& e)
+        : Element(e) {
+      }
+
+      /// Access parameters: id
+      int id() const;
+      /// Access parameters: id, if not present returns default
+      int id(int default_value) const;
+
+      /// Access parameters: type
+      int type() const;
+      /// Access rotation constants: combineHits
+      bool combineHits() const;
+
+      /// Access rotation constants: angle
+      double angle() const;
+      /// Access rotation constants: alpha
+      double alpha() const;
+      /// Access rotation constants: alpha
+      double alpha(double default_value) const;
+      /// Access rotation constants: alpha1
+      double alpha1() const;
+      /// Access rotation constants: alpha1
+      double alpha1(double default_value) const;
+      /// Access rotation constants: alpha2
+      double alpha2() const;
+      /// Access rotation constants: alpha2
+      double alpha2(double default_value) const;
+      /// Access rotation constants: angle
+      double beta() const;
+      /// Access rotation constants: angle
+      double beta(double default_value) const;
+      /// Access rotation constants: angle
+      double gamma() const;
+      /// Access rotation constants: angle
+      double gamma(double default_value) const;
+      /// Access rotation constants: angle
+      double delta() const;
+      /// Access rotation constants: angle
+      double delta(double default_value) const;
+      /// Access rotation constants: angle
+      double epsilon() const;
+      /// Access rotation constants: angle
+      double epsilon(double default_value) const;
+      /// Access rotation constants: theta
+      double theta() const;
+      /// Access rotation constants: theta
+      double theta(double default_value) const;
+      /// Access rotation constants: deltatheta
+      double deltatheta() const;
+      /// Access rotation constants: deltatheta
+      double deltatheta(double default_value) const;
+      /// Access rotation constants: thetaBins
+      int thetaBins() const;
+
+      /// Access rotation constants: phi
+      double phi() const;
+      /// Access rotation constants: phi
+      double phi(double default_value) const;
+      /// Access rotation constants: phiBins
+      int phiBins() const;
+      /// Access rotation constants: phi0
+      double phi0() const;
+      /// Access parameters: phi0, if not present returns default
+      double phi0(double default_value) const;
+      /// Access rotation constants: phi0_offset
+      double phi0_offset() const;
+      /// Access parameters: phi0_offset, if not present returns default
+      double phi0_offset(double default_value) const;
+      /// Access rotation constants: phi1
+      double phi1() const;
+      /// Access parameters: phi1, if not present returns default
+      double phi1(double default_value) const;
+      /// Access rotation constants: psi
+      double psi() const;
+      /// Access rotation constants: psi
+      double psi(double default_value) const;
+
+      /// Access Tube parameters: zhalf
+      double zhalf() const;
+      /// Access Tube parameters: deltaphi
+      double deltaphi() const;
+      /// Access Tube parameters: deltaphi
+      double deltaphi(double default_value) const;
+      /// Access rotation constants: startphi
+      double startphi() const;
+      /// Access rotation constants: startphi
+      double startphi(double default_value) const;
+
+      /// Access parameters: a
+      double a() const;
+      /// Access parameters: a
+      double a(double default_value) const;
+      /// Access parameters: A
+      double A() const;
+      /// Access parameters: A
+      double A(double default_value) const;
+      /// Access parameters: b
+      double b() const;
+      /// Access parameters: b
+      double b(double default_value) const;
+      /// Access parameters: c
+      double c() const;
+      /// Access parameters: c
+      double c(double default_value) const;
+      ///Access parameters: distance
+      double distance() const;
+      ///Access parameters: distance
+      double distance(double default_value) const;
+      /// Access parameters: B
+      double B() const;
+      /// Access parameters: B
+      double B(double default_value) const;
+      /// Access parameters: g
+      double g() const;
+      /// Access parameters: g
+      double g(double default_value) const;
+      /// Access parameters: G
+      double G() const;
+      /// Access parameters: G
+      double G(double default_value) const;
+      /// Access parameters: I
+      double I() const;
+      /// Access parameters: I
+      double I(double default_value) const;
+
+      /// Access parameters: r
+      double r() const;
+      /// Access parameters: r, if not present returns default
+      double r(double default_value) const;
+      /// Access parameters: R
+      double R() const;
+      /// Access parameters: R
+      double R(double default_value) const;
+      /// Access parameters: dr
+      double dr() const;
+      /// Access parameters: dr, if not present returns default
+      double dr(double default_value) const;
+      /// Access parameters: r0
+      double r0() const;
+      /// Access parameters: r0
+      double r0(double default_value) const;
+      /// Access min/max parameters: rmin
+      double rmin() const;
+      /// Access min/max parameters: rmin
+      double rmin(double default_val) const;
+      /// Access min/max parameters: rmax
+      double rmax() const;
+      /// Access min/max parameters: rmax
+      double rmax(double default_val) const;
+      /// Access min/max parameters: rmin1
+      double rmin1() const;
+      /// Access min/max parameters: rmin1
+      double rmin1(double default_val) const;
+      /// Access min/max parameters: rmax1
+      double rmax1() const;
+      /// Access min/max parameters: rmax1
+      double rmax1(double default_val) const;
+      /// Access min/max parameters: rmin2
+      double rmin2() const;
+      /// Access min/max parameters: rmin2
+      double rmin2(double default_val) const;
+      /// Access min/max parameters: rmax2
+      double rmax2() const;
+      /// Access min/max parameters: rmax2
+      double rmax2(double default_val) const;
+      /// Access parameters: radius
+      double radius() const;
+      /// Access parameters: radius
+      double radius(double default_val) const;
+      /// Access attribute values: outer_radius
+      double outer_radius() const;
+      /// Access attribute values: outer_r
+      double outer_r() const;
+      /// Access attribute values: inner_radius
+      double inner_radius() const;
+      /// Access attribute values: inner_r
+      double inner_r() const;
+
+      /// Access parameters: x
+      double x() const;
+      /// Access parameters: x, if not present returns default
+      double x(double default_val) const;
+      /// Access parameters: X
+      double X() const;
+      /// Access parameters: X
+      double X(double default_val) const;
+      /// Access parameters: x0
+      double x0() const;
+      /// Access parameters: x0
+      double x0(double default_val) const;
+      /// Access parameters: x1
+      double x1() const;
+      /// Access parameters: x1
+      double x1(double default_val) const;
+      /// Access parameters: x2
+      double x2() const;
+      /// Access parameters: x2
+      double x2(double default_val) const;
+      /// Access parameters: x3
+      double x3() const;
+      /// Access parameters: x3
+      double x3(double default_val) const;
+      /// Access parameters: x4
+      double x4() const;
+      /// Access parameters: x4
+      double x4(double default_val) const;
+      /// Access parameters: dx
+      double dx() const;
+      /// Access parameters: dx, if not present returns default
+      double dx(double default_value) const;
+      /// Access min/max parameters: xmax
+      double xmin() const;
+      /// Access min/max parameters: xmax
+      double xmin(double default_value) const;
+      /// Access min/max parameters: xmax
+      double xmax() const;
+      /// Access min/max parameters: xmax
+      double xmax(double default_value) const;
+      /// Access min/max parameters: x_offset
+      double x_offset() const;
+      /// Access min/max parameters: x_offset
+      double x_offset(double default_value) const;
+      /// Access min/max parameters: dim_x
+      double dim_x() const;
+      /// Access min/max parameters: dim_x
+      double dim_x(double default_value) const;
+
+      /// Access parameters: y
+      double y() const;
+      /// Access parameters: y, if not present returns default
+      double y(double default_val) const;
+      /// Access parameters: Y
+      double Y() const;
+      /// Access parameters: Y
+      double Y(double default_val) const;
+      /// Access parameters: y0
+      double y0() const;
+      /// Access parameters: y0
+      double y0(double default_value) const;
+      /// Access parameters: y1
+      double y1() const;
+      /// Access parameters: y1
+      double y1(double default_value) const;
+      /// Access parameters: y2
+      double y2() const;
+      /// Access parameters: y2
+      double y2(double default_value) const;
+      /// Access parameters: dy
+      double dy() const;
+      /// Access parameters: dz, if not present returns default
+      double dy(double default_value) const;
+      /// Access min/max parameters: ymax
+      double ymin() const;
+      /// Access min/max parameters: ymax
+      double ymin(double default_value) const;
+      /// Access min/max parameters: ymax
+      double ymax() const;
+      /// Access min/max parameters: ymax
+      double ymax(double default_value) const;
+      /// Access min/max parameters: y_offset
+      double y_offset() const;
+      /// Access min/max parameters: y_offset
+      double y_offset(double default_value) const;
+      /// Access min/max parameters: dim_y
+      double dim_y() const;
+      /// Access min/max parameters: dim_y
+      double dim_y(double default_value) const;
+
+      /// Access parameters: z
+      double z() const;
+      /// Access parameters: z, if not present returns default
+      double z(double default_val) const;
+      /// Access parameters: Z
+      double Z() const;
+      /// Access parameters: Z
+      double Z(double default_val) const;
+      /// Access parameters: z0
+      double z0() const;
+      /// Access parameters: z0
+      double z0(double default_val) const;
+      /// Access parameters: z1
+      double z1() const;
+      /// Access parameters: z1
+      double z1(double default_val) const;
+      /// Access parameters: z2
+      double z2() const;
+      /// Access parameters: z2
+      double z2(double default_val) const;
+      /// Access parameters: dz
+      double dz() const;
+      /// Access parameters: dz, if not present returns default
+      double dz(double default_value) const;
+      /// Access min/max parameters: zmax
+      double zmin() const;
+      /// Access min/max parameters: zmax
+      double zmin(double default_value) const;
+      /// Access min/max parameters: zmax
+      double zmax() const;
+      /// Access min/max parameters: zmax
+      double zmax(double default_value) const;
+      /// Access attribute values: outer_z
+      double outer_z() const;
+      /// Access attribute values: inner_z
+      double inner_z() const;
+      /// Access attribute values: outer_stereo
+      double outer_stereo() const;
+      /// Access attribute values: inner_stereo
+      double inner_stereo() const;
+      /// Access min/max parameters: z_offset
+      double z_offset() const;
+      /// Access min/max parameters: z_offset
+      double z_offset(double default_value) const;
+      /// Access min/max parameters: dim_z
+      double dim_z() const;
+      /// Access min/max parameters: dim_z
+      double dim_z(double default_value) const;
+
+      /// Access attribute values: length
+      double length() const;
+      /// Access attribute values: width
+      double width() const;
+      /// Access attribute values: height
+      double height() const;
+      /// Access attribute values: depth
+      double depth() const;
+      /// Access attribute values: thickness
+      double thickness() const;
+
+      /// Access attribute values: z_length
+      double z_length() const;
+      /// Access attribute values: gap
+      double gap() const;
+      /// Access attribute values: r_size
+      double r_size() const;
+      /// Access attribute values: phi_size_max
+      double phi_size_max() const;
+      /// Access attribute values: reflect
+      bool reflect() const;
+      /// Access attribute values: reflect
+      bool reflect(bool default_value) const;
+      /// Access attribute values: crossing_angle
+      double crossing_angle() const;
+      /// Access attribute values: repeat
+      int repeat() const;
+
+      /// Access attribute values: coefficient
+      double coefficient() const;
+      /// Access attribute values: coefficient
+      double coefficient(double default_value) const;
+
+      /// Access attribute values: skew
+      double skew() const;
+      /// Access attribute values: skew
+      double skew(double default_value) const;
+
+      /// Access attribute values: outgoing_r
+      double outgoing_r() const;
+      /// Access attribute values: incoming_r
+      double incoming_r() const;
+      /// Access attribute values: offset
+      double offset() const;
+      /// Access attribute values: offset
+      double offset(double default_value) const;
+      /// Access attribute values: number
+      int number() const;
+
+      /// Access attribute values: nmodules
+      int nmodules() const;
+      /// Access attribute values: nModules
+      int nModules() const;
+      /// Access attribute values: RowID
+      int RowID() const;
+      /// Access attribute values: moduleHeight
+      double moduleHeight() const;
+      /// Access attribute values: moduleWidth
+      double moduleWidth() const;
+      /// Access attribute values: modulePitch
+      double modulePitch() const;
+      /// Access attribute values: modulePosX
+      double modulePosX() const;
+      /// Access attribute values: modulePosY
+      double modulePosY() const;
+
+      /// Access attribute values: nPads
+      int nPads() const;
+      /// Access attribute values: rowPitch
+      double rowPitch() const;
+      /// Access attribute values: padPitch
+      double padPitch() const;
+      /// Access attribute values: rowHeight
+      double rowHeight() const;
+      /// Access attribute values: padType
+      std::string padType() const;
+
+      /// Access attribute values: numsides
+      int numsides() const;
+      /// Access attribute values: nsides
+      int nsides() const;
+      /// Access attribute values: nsides_inner
+      int nsides_inner() const;
+      /// Access attribute values: nsides_outer
+      int nsides_outer() const;
+
+
+      /// Access attribute values: phi_tilt
+      double phi_tilt() const;
+      /// Access attribute values: nphi
+      int    nphi() const;
+      /// Access attribute values: rc
+      double rc() const;
+
+      /// Access attribute values: zstart
+      double zstart() const;
+      /// Access attribute values: nz
+      int    nz() const;
+      /// Access attribute values: key
+      int    key() const;
+      /// Access attribute values: key_min
+      int    key_min() const;
+      /// Access attribute values: key_max
+      int    key_max() const;
+      /// Access attribute values: key_val
+      int    key_val() const;
+      /// Access attribute values: key_value
+      int    key_value() const;
+
+      /// Access attribute values: start
+      double start() const;
+      /// Access attribute values: start
+      double start(double default_value) const;
+      /// Access attribute values: end
+      double end() const;
+      /// Access attribute values: end
+      double end(double default_value) const;
+      /// Access attribute values: inner_field
+      double inner_field() const;
+      /// Access attribute values: outer_field
+      double outer_field() const;
+
+      /// Access attribute values: visible
+      bool   visible() const;
+      /// Access attribute values: show_daughters
+      bool   show_daughters() const;
+
+      /// Access min/max parameters: cut
+      double cut() const;
+      /// Access min/max parameters: cut
+      double cut(double default_value) const;
+      /// Access min/max parameters: threshold
+      double threshold() const;
+      /// Access min/max parameters: threshold
+      double threshold(double default_value) const;
+      /// Access min/max parameters: eunit
+      double eunit() const;
+      /// Access min/max parameters: eunit
+      double eunit(double default_value) const;
+      /// Access min/max parameters: lunit
+      double lunit() const;
+      /// Access min/max parameters: lunit
+      double lunit(double default_value) const;
+
+      /// Access rotation constants: temperature
+      double temperature() const;
+      /// Access rotation constants: temperature
+      double temperature(double default_value) const;
+      /// Access rotation constants: pressure
+      double pressure() const;
+      /// Access rotation constants: pressure
+      double pressure(double default_value) const;
+      /// Access rotation constants: density
+      double density() const;
+      /// Access rotation constants: density
+      double density(double default_value) const;
+
+      /// Access child element with tag "dimensions" as Dimension object
+      Dimension dimensions(bool throw_if_not_present = true) const;
+      /// Child access: position
+      Dimension position(bool throw_if_not_present = true) const;
+      /// Child access: rotation
+      Dimension rotation(bool throw_if_not_present = true) const;
+      /// Child access: trd
+      Dimension trd(bool throw_if_not_present = true) const;
+      /// Child access: tubs
+      Dimension tubs(bool throw_if_not_present = true) const;
+      /// Child access: staves
+      Dimension staves(bool throw_if_not_present = true) const;
+      /// Child access: beampipe
+      Dimension beampipe(bool throw_if_not_present = true) const;
+
+      /// Access "name" attribute as STL string
+      std::string nameStr() const;
+      /// Access "ref" attribute as a string
+      std::string refStr() const;
+      /// Access "type" attribute as STL string
+      std::string typeStr() const;
+      /// Access "value" attribute as STL string
+      std::string valueStr() const;
+      /// Access "module" attribute as STL string
+      std::string moduleStr() const;
+      /// Access "readout" attribute as STL string
+      std::string readoutStr() const;
+      /// Access vis attribute as STL string. If not present empty return empty string
+      std::string visStr() const;
+      /// Access region attribute as STL string. If not present empty return empty string
+      std::string regionStr() const;
+      /// Access limits attribute as STL string. If not present empty return empty string
+      std::string limitsStr() const;
+    };
+
+  }       /* End namespace DD4HEP_DIMENSION_NS        */
+}         /* End namespace DD4hep                     */
diff --git a/DDCore/include/XML/detail/Dimension.imp b/DDCore/include/XML/detail/Dimension.imp
index ee263302a..0a26b9415 100644
--- a/DDCore/include/XML/detail/Dimension.imp
+++ b/DDCore/include/XML/detail/Dimension.imp
@@ -185,43 +185,43 @@ XML_CHILD_ACCESSOR_XML_DIM(tubs)
 XML_CHILD_ACCESSOR_XML_DIM(staves)
 XML_CHILD_ACCESSOR_XML_DIM(beampipe)
 
-std::string DD4hep::DIMENSION_NS::Dimension::padType() const {
+std::string DD4hep::DD4HEP_DIMENSION_NS::Dimension::padType() const {
   return m_element.attr < std::string > (_U(pads));
 }
 
-std::string DD4hep::DIMENSION_NS::Dimension::nameStr() const {
+std::string DD4hep::DD4HEP_DIMENSION_NS::Dimension::nameStr() const {
   return m_element.attr < std::string > (_U(name));
 }
 
-std::string DD4hep::DIMENSION_NS::Dimension::refStr() const {
+std::string DD4hep::DD4HEP_DIMENSION_NS::Dimension::refStr() const {
   return m_element.attr < std::string > (_U(ref));
 }
 
-std::string DD4hep::DIMENSION_NS::Dimension::typeStr() const {
+std::string DD4hep::DD4HEP_DIMENSION_NS::Dimension::typeStr() const {
   return m_element.attr < std::string > (_U(type));
 }
 
 /// Access "value" attribute as STL std::string
-std::string DD4hep::DIMENSION_NS::Dimension::valueStr() const   {
+std::string DD4hep::DD4HEP_DIMENSION_NS::Dimension::valueStr() const   {
   return m_element.attr < std::string > (_U(value));
 }
 
-std::string DD4hep::DIMENSION_NS::Dimension::regionStr() const {
+std::string DD4hep::DD4HEP_DIMENSION_NS::Dimension::regionStr() const {
   return m_element.hasAttr(_U(region)) ? m_element.attr < std::string > (_U(region)) : std::string();
 }
 
-std::string DD4hep::DIMENSION_NS::Dimension::limitsStr() const {
+std::string DD4hep::DD4HEP_DIMENSION_NS::Dimension::limitsStr() const {
   return m_element.hasAttr(_U(limits)) ? m_element.attr < std::string > (_U(limits)) : std::string();
 }
 
-std::string DD4hep::DIMENSION_NS::Dimension::visStr() const {
+std::string DD4hep::DD4HEP_DIMENSION_NS::Dimension::visStr() const {
   return m_element.hasAttr(_U(vis)) ? m_element.attr < std::string > (_U(vis)) : std::string();
 }
 
-std::string DD4hep::DIMENSION_NS::Dimension::readoutStr() const {
+std::string DD4hep::DD4HEP_DIMENSION_NS::Dimension::readoutStr() const {
   return m_element.hasAttr(_U(readout)) ? m_element.attr < std::string > (_U(readout)) : std::string();
 }
 
-std::string DD4hep::DIMENSION_NS::Dimension::moduleStr() const {
+std::string DD4hep::DD4HEP_DIMENSION_NS::Dimension::moduleStr() const {
   return m_element.hasAttr(_U(module)) ? m_element.attr < std::string > (_U(module)) : std::string();
 }
diff --git a/DDCore/include/XML/detail/Dimension.inl b/DDCore/include/XML/detail/Dimension.inl
index a41da30a5..9c2f5de0d 100644
--- a/DDCore/include/XML/detail/Dimension.inl
+++ b/DDCore/include/XML/detail/Dimension.inl
@@ -28,24 +28,24 @@
 
 #define XML_ATTR_NS_ACCESSOR_DOUBLE(ns,name)			\
   XML_ATTR_NS_ACCESSOR(double,ns,name)				\
-  XML_ATTR_NS_ACCESSOR_DEFAULT(double,ns,name,DD4hep::DIMENSION_NS::_toDouble)
+  XML_ATTR_NS_ACCESSOR_DEFAULT(double,ns,name,DD4hep:: DD4HEP_DIMENSION_NS ::_toDouble)
 
 #define XML_ATTR_NS_ACCESSOR_INT(ns,name)			\
   XML_ATTR_NS_ACCESSOR(int,ns,name)				\
-  XML_ATTR_NS_ACCESSOR_DEFAULT(int,ns,name,DD4hep::DIMENSION_NS::_toInt)
+  XML_ATTR_NS_ACCESSOR_DEFAULT(int,ns,name,DD4hep:: DD4HEP_DIMENSION_NS ::_toInt)
 
 #define XML_ATTR_NS_ACCESSOR_STRING(ns,name)			\
   XML_ATTR_NS_ACCESSOR(std::string,ns,name)			\
-  XML_ATTR_NS_ACCESSOR_DEFAULT(std::string,ns,name,DD4hep::DIMENSION_NS::_toString)
+  XML_ATTR_NS_ACCESSOR_DEFAULT(std::string,ns,name,DD4hep:: DD4HEP_DIMENSION_NS ::_toString)
 
 
-#define XML_ATTR_ACCESSOR(type,name)                  XML_ATTR_NS_ACCESSOR(type,DD4hep::DIMENSION_NS::Dimension,name)
-#define XML_ATTR_ACCESSOR_DEFAULT(name,type,dressing) XML_ATTR_NS_ACCESSOR_DEFAULT(type,DD4hep::DIMENSION_NS::Dimension,name,dressing)
-#define XML_ATTR_ACCESSOR_DOUBLE(name)		      XML_ATTR_NS_ACCESSOR_DOUBLE(DD4hep::DIMENSION_NS::Dimension,name)
+#define XML_ATTR_ACCESSOR(type,name)                  XML_ATTR_NS_ACCESSOR(type,DD4hep:: DD4HEP_DIMENSION_NS ::Dimension,name)
+#define XML_ATTR_ACCESSOR_DEFAULT(name,type,dressing) XML_ATTR_NS_ACCESSOR_DEFAULT(type,DD4hep:: DD4HEP_DIMENSION_NS ::Dimension,name,dressing)
+#define XML_ATTR_ACCESSOR_DOUBLE(name)		      XML_ATTR_NS_ACCESSOR_DOUBLE(DD4hep:: DD4HEP_DIMENSION_NS ::Dimension,name)
 
-#define XML_ATTR_ACCESSOR_INT(name)                   XML_ATTR_NS_ACCESSOR_DEFAULT(int,DD4hep::DIMENSION_NS::Dimension,name,_toInt)
-#define XML_ATTR_ACCESSOR_BOOL(name)                  XML_ATTR_NS_ACCESSOR_DEFAULT(bool,DD4hep::DIMENSION_NS::Dimension,name,_toBool)
+#define XML_ATTR_ACCESSOR_INT(name)                   XML_ATTR_NS_ACCESSOR_DEFAULT(int,DD4hep:: DD4HEP_DIMENSION_NS ::Dimension,name,_toInt)
+#define XML_ATTR_ACCESSOR_BOOL(name)                  XML_ATTR_NS_ACCESSOR_DEFAULT(bool,DD4hep:: DD4HEP_DIMENSION_NS ::Dimension,name,_toBool)
 
 #define XML_CHILD_ACCESSOR_XML_DIM(name)                        		\
-    DD4hep::DIMENSION_NS::Dimension DD4hep::DIMENSION_NS::Dimension::name(bool throw_if_not_present) const {		\
+    DD4hep:: DD4HEP_DIMENSION_NS ::Dimension DD4hep:: DD4HEP_DIMENSION_NS ::Dimension::name(bool throw_if_not_present) const {		\
     return m_element.child(_DD4hep_Unicode_Item(name),throw_if_not_present); }
diff --git a/DDCore/include/XML/detail/README.txt b/DDCore/include/XML/detail/README.txt
index 2aeecc4ec..bf32aaf80 100644
--- a/DDCore/include/XML/detail/README.txt
+++ b/DDCore/include/XML/detail/README.txt
@@ -5,6 +5,15 @@ XML/detail
 This directory is used to implement helpers to input parsers.
 These common implementation of the helpers should ensure that all
 dependent parsers offer a rather identical interface to users.
+The header files in this directory should NEVER be included
+directly. There are corresponding specialized wrappers present
+in the XML or JSON branch, which allow to use the required
+functionalities.
+
+JSON should become however a valid alternative to parsing XML files
+with a small maintenance overhead, since the enhancement implementation
+present in XMLDimesion.h, XMLDetector.h and XMLChildValue.h is shared
+and instantiated for both.
 
 The base interface is implemented in the Element header file,
 but all derived classes such as Dimension, Component or Detector
@@ -12,12 +21,11 @@ have the identical interface and are supposed to ease the access
 to inditvidual attributes or child elements independent if the
 underlying implementation is based on:
 
--- XercesC  --> uses the XML branch
--- TinyXML  --> uses the XML branch
--- JSON     --> Uses the JSON branch
+-- XercesC  --> uses the XML branch  (requires compiler definition)
+-- TinyXML  --> uses the XML branch  (default)
+-- JSON     --> Uses the JSON branch (requires boost presence)
                 with the implementation of boost::property_tree
 -- RapitXML --> Not implmented.
                 Would be a jiffy to implement using the JSON branch and
                 the implementation of boost::property_tree.
                 Only the document handling is different.
-
diff --git a/DDCore/src/JSON/DocumentHandler.cpp b/DDCore/src/JSON/DocumentHandler.cpp
new file mode 100644
index 000000000..c55683c52
--- /dev/null
+++ b/DDCore/src/JSON/DocumentHandler.cpp
@@ -0,0 +1,46 @@
+//==========================================================================
+//  AIDA Detector description implementation for LCD
+//--------------------------------------------------------------------------
+// Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
+// All rights reserved.
+//
+// For the licensing terms see $DD4hepINSTALL/LICENSE.
+// For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
+//
+// Author     : M.Frank
+//
+//==========================================================================
+
+// Framework include files
+#include "JSON/DocumentHandler.h"
+
+// C/C++ include files
+#include "boost/property_tree/json_parser.hpp"
+#include <memory>
+#include <stdexcept>
+
+using namespace std;
+using namespace DD4hep::JSON;
+
+/// Default constructor
+DocumentHandler::DocumentHandler()  {
+}
+                                    
+/// Default destructor
+DocumentHandler::~DocumentHandler()   {
+}
+
+/// Load XML file and parse it.
+Document DocumentHandler::load(const string& fname) const   {
+  string fn = fname;
+  if ( fname.find("://") != string::npos ) fn = fname.substr(fname.find("://")+3);
+  unique_ptr<JsonElement> doc(new JsonElement(fn, ptree()));
+  boost::property_tree::read_json(fn,doc->second);
+  return doc.release();
+}
+
+/// Parse a standalong XML string into a document.
+Document DocumentHandler::parse(const char* doc_string, size_t length) const   {
+  if ( doc_string && length ) {}
+  throw runtime_error("Bla");
+}
diff --git a/DDCore/src/JSON/Elements.cpp b/DDCore/src/JSON/Elements.cpp
index c80f74d3d..8b740290a 100644
--- a/DDCore/src/JSON/Elements.cpp
+++ b/DDCore/src/JSON/Elements.cpp
@@ -42,30 +42,39 @@ namespace {
 
 namespace {
 
+  // This should ensure we are not passing temporaries of std::string and then
+  // returning the "const char*" content calling .c_str()
+  const ptree::data_type& value_data(const ptree& entry)  {
+    return entry.data();
+  }
+
   JsonElement* node_first(JsonElement* e, const char* tag) {
     if ( e )  {
       string t(tag);
       if ( t == "*" )  {
-        auto i = e->second.begin();
+        ptree::iterator i = e->second.begin();
         return i != e->second.end() ? &(*i) : 0;
       }
-      auto i = e->second.find(t);
+      ptree::assoc_iterator i = e->second.find(t);
       return i != e->second.not_found() ? &(*i) : 0;
     }
     return 0;
   }
+
   size_t node_count(JsonElement* e, const string& t) {
     return e ? (t=="*" ? e->second.size() : e->second.count(t)) : 0;
   }
-}
 
-namespace {
   Attribute attribute_node(JsonElement* n, const char* t)  {
-    auto i = n->second.find(t);
-    return i != n->second.not_found() ? &(*i) : 0;
+    if ( n )  {
+      auto i = n->second.find(t);
+      return i != n->second.not_found() ? &(*i) : 0;
+    }
+    return 0;
   }
+
   const char* attribute_value(Attribute a) {
-    return a->second.get_value<std::string>().c_str();
+    return value_data(a->second).c_str();
   }
 }
 
@@ -321,17 +330,17 @@ NodeList& NodeList::operator=(const NodeList& l) {
 
 /// Unicode text access to the element's tag. This must be wrong ....
 const char* Handle_t::rawTag() const {
-  return (*m_node).first.c_str();
+  return m_node->first.c_str();
 }
 
 /// Unicode text access to the element's text
 const char* Handle_t::rawText() const {
-  return (*m_node).second.get_value<string>().c_str();
+  return value_data(m_node->second).c_str();
 }
 
 /// Unicode text access to the element's value
 const char* Handle_t::rawValue() const {
-  return (*m_node).second.get_value<string>().c_str();
+  return value_data(m_node->second).c_str();
 }
 
 /// Access attribute pointer by the attribute's unicode name (no exception thrown if not present)
@@ -407,7 +416,7 @@ Attribute Handle_t::attr_ptr(const char* t) const {
 /// Access attribute name (throws exception if not present)
 const char* Handle_t::attr_name(const Attribute a) const {
   if (a) {
-    return (*a).first.c_str();
+    return a->first.c_str();
   }
   throw runtime_error("Attempt to access invalid XML attribute object!");
 }
@@ -428,10 +437,19 @@ const char* Handle_t::attr_value_nothrow(const char* attr_tag) const {
   return a ? attribute_value(a) : 0;
 }
 
+
+/// Access the ROOT eleemnt of the DOM document
+Handle_t Document::root() const   {
+  if ( m_doc )   {
+    return m_doc;
+  }
+  throw runtime_error("Document::root: Invalid handle!");
+}
+
 /// Assign new document. Old document is dropped.
 DocumentHolder& DocumentHolder::assign(DOC d)   {
-  if (m_doc)   {
-    printout(DEBUG,"DocumentHolder","+++ Release DOM document....");
+  if ( m_doc )   {
+    printout(DEBUG,"DocumentHolder","+++ Release JSON document....");
     delete m_doc;
   }
   m_doc = d;
@@ -439,7 +457,7 @@ DocumentHolder& DocumentHolder::assign(DOC d)   {
 }
 
 /// Standard destructor - releases the document
-DocumentHolder::~DocumentHolder() {
+DocumentHolder::~DocumentHolder()   {
   assign(0);
 }
 
diff --git a/DDCore/src/JSON/Helpers.cpp b/DDCore/src/JSON/Helpers.cpp
index d8ae985d7..2c61740f1 100644
--- a/DDCore/src/JSON/Helpers.cpp
+++ b/DDCore/src/JSON/Helpers.cpp
@@ -19,6 +19,7 @@
 using namespace DD4hep::JSON;
 
 // Instantiate here the concrete implementations
+#define DD4HEP_DIMENSION_NS JSON
 #include "XML/detail/Detector.imp"
 #include "XML/detail/Dimension.imp"
 #include "XML/detail/ChildValue.imp"
diff --git a/DDCore/src/XML/XMLHelpers.cpp b/DDCore/src/XML/XMLHelpers.cpp
index 539005094..2b1c2e07b 100644
--- a/DDCore/src/XML/XMLHelpers.cpp
+++ b/DDCore/src/XML/XMLHelpers.cpp
@@ -19,6 +19,7 @@
 using namespace DD4hep::XML;
 
 // Instantiate here the concrete implementations
+#define DD4HEP_DIMENSION_NS XML
 #include "XML/detail/Detector.imp"
 #include "XML/detail/Dimension.imp"
 #include "XML/detail/ChildValue.imp"
diff --git a/DDCore/src/plugins/Compact2Objects.cpp b/DDCore/src/plugins/Compact2Objects.cpp
index 760afdacd..2a2e0823e 100644
--- a/DDCore/src/plugins/Compact2Objects.cpp
+++ b/DDCore/src/plugins/Compact2Objects.cpp
@@ -47,6 +47,7 @@ namespace DD4hep {
     struct GdmlFile;
     struct Property;
     struct XMLFile;
+    struct JsonFile;
     struct AlignmentFile;
     struct DetElementInclude {};
   }
@@ -65,6 +66,7 @@ namespace DD4hep {
   template <> void Converter<SensitiveDetector>::operator()(xml_h element) const;
   template <> void Converter<DetElement>::operator()(xml_h element) const;
   template <> void Converter<GdmlFile>::operator()(xml_h element) const;
+  template <> void Converter<JsonFile>::operator()(xml_h element) const;
   template <> void Converter<XMLFile>::operator()(xml_h element) const;
   template <> void Converter<AlignmentFile>::operator()(xml_h element) const;
   template <> void Converter<Header>::operator()(xml_h element) const;
@@ -857,7 +859,7 @@ template <> void Converter<SensitiveDetector>::operator()(xml_h element) const {
   }
 }
 
-void setChildTitles(const pair<string, DetElement>& e) {
+static void setChildTitles(const pair<string, DetElement>& e) {
   DetElement parent = e.second.parent();
   const DetElement::Children& children = e.second.children();
   if (::strlen(e.second->GetTitle()) == 0) {
@@ -958,6 +960,14 @@ template <> void Converter<GdmlFile>::operator()(xml_h element) const {
   xml_coll_t(materials, _U(material)).for_each(Converter<Material>(this->lcdd));
 }
 
+/// Read material entries from a seperate file in one of the include sections of the geometry
+template <> void Converter<JsonFile>::operator()(xml_h element) const {
+  string base = XML::DocumentHandler::system_directory(element);
+  string file = element.attr<string>(_U(ref));
+  vector<char*>  argv{&file[0],&base[0]};
+  lcdd.apply("DD4hep_JsonProcessor",int(argv.size()), &argv[0]);
+}
+
 /// Read alignment entries from a seperate file in one of the include sections of the geometry
 template <> void Converter<XMLFile>::operator()(xml_h element) const {
   this->lcdd.fromXML(element.attr<string>(_U(ref)));
@@ -973,25 +983,40 @@ template <> void Converter<AlignmentFile>::operator()(xml_h element) const {
 
 /// Read material entries from a seperate file in one of the include sections of the geometry
 template <> void Converter<DetElementInclude>::operator()(xml_h element) const {
-  XML::DocumentHolder doc(XML::DocumentHandler().load(element, element.attr_value(_U(ref))));
-  xml_h node = doc.root();
-  string tag = node.tag();
-  if ( tag == "lccdd" )
-    Converter<Compact>(this->lcdd)(node);
-  else if ( tag == "define" )
-    xml_coll_t(node, _U(constant)).for_each(Converter<Constant>(this->lcdd));
-  else if ( tag == "readouts" )
-    xml_coll_t(node, _U(readout)).for_each(Converter<Readout>(this->lcdd));
-  else if ( tag == "regions" )
-    xml_coll_t(node, _U(region)).for_each(Converter<Region>(this->lcdd));
-  else if ( tag == "limitsets" )
-    xml_coll_t(node, _U(limitset)).for_each(Converter<LimitSet>(this->lcdd));
-  else if ( tag == "display" )
-    xml_coll_t(node,_U(vis)).for_each(Converter<VisAttr>(this->lcdd));
-  else if ( tag == "detector" )
-    Converter<DetElement>(this->lcdd)(node);
-  else if ( tag == "detectors" )
-    xml_coll_t(node,_U(detector)).for_each(Converter<DetElement>(this->lcdd));
+  string type = element.hasAttr(_U(type)) ? element.attr<string>(_U(type)) : string("xml");
+  if ( type == "xml" )  {
+    XML::DocumentHolder doc(XML::DocumentHandler().load(element, element.attr_value(_U(ref))));
+    xml_h node = doc.root();
+    string tag = node.tag();
+    if ( tag == "lccdd" )
+      Converter<Compact>(this->lcdd)(node);
+    else if ( tag == "define" )
+      xml_coll_t(node, _U(constant)).for_each(Converter<Constant>(this->lcdd));
+    else if ( tag == "readouts" )
+      xml_coll_t(node, _U(readout)).for_each(Converter<Readout>(this->lcdd));
+    else if ( tag == "regions" )
+      xml_coll_t(node, _U(region)).for_each(Converter<Region>(this->lcdd));
+    else if ( tag == "limitsets" )
+      xml_coll_t(node, _U(limitset)).for_each(Converter<LimitSet>(this->lcdd));
+    else if ( tag == "display" )
+      xml_coll_t(node,_U(vis)).for_each(Converter<VisAttr>(this->lcdd));
+    else if ( tag == "detector" )
+      Converter<DetElement>(this->lcdd)(node);
+    else if ( tag == "detectors" )
+      xml_coll_t(node,_U(detector)).for_each(Converter<DetElement>(this->lcdd));
+  }
+  else if ( type == "json" )  {
+    Converter<JsonFile>(this->lcdd)(element);
+  }
+  else if ( type == "gdml" )  {
+    Converter<GdmlFile>(this->lcdd)(element);
+  }
+  else if ( type == "xml-extended" )  {
+    Converter<XMLFile>(this->lcdd)(element);
+  }
+  else  {
+    except("Compact","++ FAILED    Invalid file type:%s. This cannot be processed!",type.c_str());
+  }
 }
 
 template <> void Converter<Compact>::operator()(xml_h element) const {
diff --git a/DDCore/src/plugins/JsonProcessor.cpp b/DDCore/src/plugins/JsonProcessor.cpp
new file mode 100644
index 000000000..a52dbdcc4
--- /dev/null
+++ b/DDCore/src/plugins/JsonProcessor.cpp
@@ -0,0 +1,162 @@
+//==========================================================================
+//  AIDA Detector description implementation for LCD
+//--------------------------------------------------------------------------
+// Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
+// All rights reserved.
+//
+// For the licensing terms see $DD4hepINSTALL/LICENSE.
+// For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
+//
+// Author     : M.Frank
+//
+//==========================================================================
+#ifdef DD4HEP_USE_BOOST
+
+/**
+   Note:
+   This is experimental playground.
+
+   It should only proof the concept, that actually input parsers may be mixed:
+   The MiniTel_json example starts with xml, then inputs a json file, which
+   is processed here....
+
+   If json is supposed to be really used, then the corresponding machinery
+   first has to be implemented, similar to simething like Compact or DDDB.
+
+   M. Frank
+*/
+
+// Framework inlcude files
+#include "JSON/Helper.h"
+#include "JSON/DocumentHandler.h"
+#include "JSON/Conversions.h"
+#include "DD4hep/Plugins.h"
+#include "DD4hep/Printout.h"
+#include "DD4hep/IDDescriptor.h"
+#include "DD4hep/objects/SegmentationsInterna.h"
+#include "DD4hep/objects/DetectorInterna.h"
+#include "DD4hep/objects/ObjectsInterna.h"
+
+// C/C++ include files
+#include <iostream>
+#include "boost/property_tree/json_parser.hpp"
+
+namespace {
+  class Json;
+  class detector;
+}
+
+using namespace std;
+using namespace DD4hep;
+using namespace DD4hep::Geometry;
+
+static void setChildTitles(const pair<string, DetElement>& e) {
+  DetElement parent = e.second.parent();
+  const DetElement::Children& children = e.second.children();
+  if (::strlen(e.second->GetTitle()) == 0) {
+    e.second->SetTitle(parent.isValid() ? parent.type().c_str() : e.first.c_str());
+  }
+  for_each(children.begin(), children.end(), setChildTitles);
+}
+
+namespace DD4hep  {
+    template <> void Converter<detector>::operator()(json_h element) const;
+}
+
+/// This is the identical converter as it is used for the XML compact!
+template <> void Converter<detector>::operator()(json_h element) const {
+  string type = element.attr<string>(_U(type));
+  string name = element.attr<string>(_U(name));
+  string name_match = ":" + name + ":";
+  string type_match = ":" + type + ":";
+
+  try {
+    json_attr_t attr_par = element.attr_nothrow(_U(parent));
+    if (attr_par) {
+      // We have here a nested detector. If the mother volume is not yet registered
+      // it must be done here, so that the detector constructor gets the correct answer from
+      // the call to LCDD::pickMotherVolume(DetElement).
+      string par_name = element.attr<string>(attr_par);
+      DetElement parent_detector = lcdd.detector(par_name);
+      if ( !parent_detector.isValid() )  {
+        except("Compact","Failed to access valid parent detector of %s",name.c_str());
+      }
+      Volume parent_volume = parent_detector.placement().volume();
+      if ( !parent_volume.isValid() )   {
+        except("Compact","Failed to access valid parent volume of %s from %s",
+               name.c_str(), par_name.c_str());
+      }
+      lcdd.declareMotherVolume(name, parent_volume);
+    }
+    json_attr_t attr_ro  = element.attr_nothrow(_U(readout));
+    SensitiveDetector sd;
+    Segmentation seg;
+    if ( attr_ro )   {
+      Readout ro = lcdd.readout(element.attr<string>(attr_ro));
+      if (!ro.isValid()) {
+        throw runtime_error("No Readout structure present for detector:" + name);
+      }
+      seg = ro.segmentation();
+      sd = SensitiveDetector(name, "sensitive");
+      sd.setHitsCollection(ro.name());
+      sd.setReadout(ro);
+      lcdd.addSensitiveDetector(sd);
+    }
+    Ref_t sens = sd;
+    DetElement det(Ref_t(PluginService::Create<NamedObject*>(type, &lcdd, &element, &sens)));
+    if (det.isValid()) {
+      setChildTitles(make_pair(name, det));
+      if ( sd.isValid() )  {
+        det->flag |= DetElement::Object::HAVE_SENSITIVE_DETECTOR;
+      }
+      if ( seg.isValid() )  {
+        seg->sensitive = sd;
+        seg->detector  = det;
+      }
+    }
+    printout(det.isValid() ? INFO : ERROR, "Compact", "%s subdetector:%s of type %s %s",
+             (det.isValid() ? "++ Converted" : "FAILED    "), name.c_str(), type.c_str(),
+             (sd.isValid() ? ("[" + sd.type() + "]").c_str() : ""));
+
+    if (!det.isValid()) {
+      PluginDebug dbg;
+      PluginService::Create<NamedObject*>(type, &lcdd, &element, &sens);
+      throw runtime_error("Failed to execute subdetector creation plugin. " + dbg.missingFactory(type));
+    }
+    lcdd.addDetector(det);
+    return;
+  }
+  catch (const exception& e) {
+    printout(ERROR, "Compact", "++ FAILED    to convert subdetector: %s: %s", name.c_str(), e.what());
+    terminate();
+  }
+  catch (...) {
+    printout(ERROR, "Compact", "++ FAILED    to convert subdetector: %s: %s", name.c_str(), "UNKNONW Exception");
+    terminate();
+  }
+}
+
+static long handle_json(lcdd_t& lcdd, int argc, char** argv) {
+  if ( argc < 1 || (argc<2 && argv[0][0] != '/') )  {
+    ::printf("DD4hep_JsonProcessor <file> <directory>                \n"
+             "  If file is an absolute path (does NOT start with '/')\n"
+             "  the directory path is mandatory.                     \n"
+             "  The file name is then assumed to be relative.        \n"
+             "\n");
+    exit(EINVAL);
+  }
+  string file = argv[0];
+  if ( file[0] != '/' ) file = string(argv[1]) + "/" + file;
+
+  printout(INFO,"JsonProcessor","++ Processing JSON input: %s",file.c_str());
+  JSON::DocumentHolder doc(JSON::DocumentHandler().load(file.c_str()));
+  JSON::Element elt = doc.root();
+
+  json_coll_t(elt,_U(detector)).for_each(Converter<detector>(lcdd));
+  printout(INFO,"JsonProcessor","++ ... Successfully processed JSON input: %s",file.c_str());
+  return 1;
+}
+DECLARE_APPLY(DD4hep_JsonProcessor,handle_json)
+
+#endif  // DD4HEP_USE_BOOST
+
diff --git a/DDDB/src/DDDBDimension.cpp b/DDDB/src/DDDBDimension.cpp
index 38a7d6488..12737e93a 100644
--- a/DDDB/src/DDDBDimension.cpp
+++ b/DDDB/src/DDDBDimension.cpp
@@ -22,6 +22,7 @@
 #include "DDDB/DDDBDimension.h"
 #include "DDDB/DDDBTags.h"
 
+#define DD4HEP_DIMENSION_NS XML
 using namespace DD4hep::XML;
 
 XML_ATTR_NS_ACCESSOR_DOUBLE(DD4hep::DDDB::dddb_dim_t, alp1)
diff --git a/doc/release.notes b/doc/release.notes
index 106b80a0b..8f6072ecd 100644
--- a/doc/release.notes
+++ b/doc/release.notes
@@ -5,6 +5,15 @@ DD4hep  ----  Release Notes
 
 
 
+ Markus Frank 2017-03-17
+ -- Add a new input type by parsing JSON files. The basic json interpreter
+    is present and offers essentially the same interface as the XML persers.
+    The integration to the compact dialect however is not yet done.
+    It should become however a valid alternative to parsing XML files
+    with a small maintenance overhead, since the enhancement implementation
+    present in XMLDimesion.h, XMLDetector.h and XMLChildValue.h is shared
+    and instantiated for both.
+
  Markus Frank 2017-03-10
  -- New round to kill coverity deficiencies.
  -- Add exception try-catch clauses around various main programs in UtilityApps
diff --git a/examples/ClientTests/CMakeLists.txt b/examples/ClientTests/CMakeLists.txt
index 6da564919..e4aa705c1 100644
--- a/examples/ClientTests/CMakeLists.txt
+++ b/examples/ClientTests/CMakeLists.txt
@@ -29,6 +29,16 @@ dd4hep_install_dir( compact scripts DESTINATION ${DD4hep_DIR}/examples/ClientTes
 dd4hep_configure_scripts( ClientTests DEFAULT_SETUP WITH_TESTS)
 #---  Testing  ------------------------------------------------------------
 #
+#  Test JSON based detector construction
+dd4hep_add_test_reg( ClientTests_MiniTel_JSON
+  COMMAND    "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh"
+  EXEC_ARGS  geoDisplay
+  -input file:${CMAKE_CURRENT_SOURCE_DIR}/compact/MiniTel_json.xml -volmgr -destroy -load_only
+  REGEX_PASS "Successfully processed JSON input"
+  REGEX_FAIL "Exception"
+  REGEX_FAIL "FAILED"
+  )
+#
 #  Test readout strings of the form: <id>system:8,barrel:-2</id>
 dd4hep_add_test_reg( ClientTests_DumpElements
   COMMAND    "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh"
diff --git a/examples/ClientTests/compact/MiniTel.json b/examples/ClientTests/compact/MiniTel.json
index e2d474c6e..ffe00a5fa 100644
--- a/examples/ClientTests/compact/MiniTel.json
+++ b/examples/ClientTests/compact/MiniTel.json
@@ -11,26 +11,233 @@
 //
 //==========================================================================
 {
-    "detectors":  {
-        "detector1":  {
-            "id":        1,
-            "type":     "MiniTelPixel",
-            "material": "Silicon",
-            "vis":      "DetVis",
-            "readout":  "MyLHCBdetector1Hits",
-            "dimensions": { "z": "1*mm", "y": "10*cm", "x": "10*cm" },
-            "module": {
-                "name":     "pixel",
-                "type:":    "MiniTelPixel",
-                "material": "Silicon",
-                "x":        "6*mm",
-                "y":        "6*mm",
-                "z":        "1*mm",
-                "vis":      "ModVis",
-                "alpha":    "-2.*radian",
-                "beta":     "-2.*radian",
-                "gamma":    "-0.*radian"
-            }
+    "detector":  {
+        "id":       1,
+        "name":     "detector1",
+        "type":     "MiniTelPixel_json",
+        "material": "Silicon",
+        "vis":      "DetVis",
+        "readout":  "MyLHCBdetector1Hits",
+        "dimensions": { "z": "1*mm", "y": "10*cm", "x": "10*cm" },
+        "position":   { "z": "0*mm", "y": "0*cm", "x": "0*cm" },
+        "module": {
+            "name":     "pixel",
+            "type:":    "MiniTelPixel",
+            "material": "Silicon",
+            "x":        "6*mm",
+            "y":        "6*mm",
+            "z":        "1*mm",
+            "vis":      "ModVis",
+            "alpha":    "-2.*radian",
+            "beta":     "-2.*radian",
+            "gamma":    "-0.*radian"
+        }
+    },
+
+    "detector":  {
+        "id":       2,
+        "name":     "detector2",
+        "type":     "MiniTelPixel_json",
+        "material": "Silicon",
+        "vis":      "DetVis",
+        "readout":  "MyLHCBdetector1Hits",
+        "dimensions": { "z": "1*mm",  "y": "10*cm", "x": "10*cm" },
+        "position":   { "z": "10*mm", "y": "0*cm", "x": "0*cm" },
+        "module": {
+            "name":     "pixel",
+            "type:":    "MiniTelPixel",
+            "material": "Silicon",
+            "x":        "6*mm",
+            "y":        "6*mm",
+            "z":        "1*mm",
+            "vis":      "ModVis",
+            "alpha":    "-2.*radian",
+            "beta":     "-2.*radian",
+            "gamma":    "-0.*radian"
+        }
+    },
+
+    "detector":  {
+        "id":       3,
+        "name":     "detector3",
+        "type":     "MiniTelPixel_json",
+        "material": "Silicon",
+        "vis":      "DetVis",
+        "readout":  "MyLHCBdetector1Hits",
+        "dimensions": { "z": "1*mm",  "y": "10*cm", "x": "10*cm" },
+        "position":   { "z": "20*mm", "y": "0*cm", "x": "0*cm" },
+        "module": {
+            "name":     "pixel",
+            "type:":    "MiniTelPixel",
+            "material": "Silicon",
+            "x":        "6*mm",
+            "y":        "6*mm",
+            "z":        "1*mm",
+            "vis":      "ModVis",
+            "alpha":    "-2.*radian",
+            "beta":     "-2.*radian",
+            "gamma":    "-0.*radian"
+        }
+    },
+
+    "detector":  {
+        "id":       4,
+        "name":     "detector4",
+        "type":     "MiniTelPixel_json",
+        "material": "Silicon",
+        "vis":      "DetVis",
+        "readout":  "MyLHCBdetector1Hits",
+        "dimensions": { "z": "1*mm",  "y": "10*cm", "x": "10*cm" },
+        "position":   { "z": "30*mm", "y": "0*cm", "x": "0*cm" },
+        "module": {
+            "name":     "pixel",
+            "type:":    "MiniTelPixel",
+            "material": "Silicon",
+            "x":        "6*mm",
+            "y":        "6*mm",
+            "z":        "1*mm",
+            "vis":      "ModVis",
+            "alpha":    "-2.*radian",
+            "beta":     "-2.*radian",
+            "gamma":    "-0.*radian"
+        }
+    },
+
+    "detector":  {
+        "id":       5,
+        "name":     "detector5",
+        "type":     "MiniTelPixel_json",
+        "material": "Silicon",
+        "vis":      "DetVis",
+        "readout":  "MyLHCBdetector1Hits",
+        "dimensions": { "z": "1*mm",  "y": "10*cm", "x": "10*cm" },
+        "position":   { "z": "40*mm", "y": "0*cm", "x": "0*cm" },
+        "module": {
+            "name":     "pixel",
+            "type:":    "MiniTelPixel",
+            "material": "Silicon",
+            "x":        "6*mm",
+            "y":        "6*mm",
+            "z":        "1*mm",
+            "vis":      "ModVis",
+            "alpha":    "-2.*radian",
+            "beta":     "-2.*radian",
+            "gamma":    "-0.*radian"
+        }
+    },
+
+    "detector":  {
+        "id":       6,
+        "name":     "detector6",
+        "type":     "MiniTelPixel_json",
+        "material": "Silicon",
+        "vis":      "DetVis",
+        "readout":  "MyLHCBdetector1Hits",
+        "dimensions": { "z": "1*mm",  "y": "10*cm", "x": "10*cm" },
+        "position":   { "z": "50*mm", "y": "0*cm", "x": "0*cm" },
+        "module": {
+            "name":     "pixel",
+            "type:":    "MiniTelPixel",
+            "material": "Silicon",
+            "x":        "6*mm",
+            "y":        "6*mm",
+            "z":        "1*mm",
+            "vis":      "ModVis",
+            "alpha":    "-2.*radian",
+            "beta":     "-2.*radian",
+            "gamma":    "-0.*radian"
+        }
+    },
+
+    "detector":  {
+        "id":       7,
+        "name":     "detector7",
+        "type":     "MiniTelPixel_json",
+        "material": "Silicon",
+        "vis":      "DetVis",
+        "readout":  "MyLHCBdetector1Hits",
+        "dimensions": { "z": "1*mm",  "y": "10*cm", "x": "10*cm" },
+        "position":   { "z": "60*mm", "y": "0*cm", "x": "0*cm" },
+        "module": {
+            "name":     "pixel",
+            "type:":    "MiniTelPixel",
+            "material": "Silicon",
+            "x":        "6*mm",
+            "y":        "6*mm",
+            "z":        "1*mm",
+            "vis":      "ModVis",
+            "alpha":    "-2.*radian",
+            "beta":     "-2.*radian",
+            "gamma":    "-0.*radian"
+        }
+    },
+
+    "detector":  {
+        "id":       8,
+        "name":     "detector8",
+        "type":     "MiniTelPixel_json",
+        "material": "Silicon",
+        "vis":      "DetVis",
+        "readout":  "MyLHCBdetector1Hits",
+        "dimensions": { "z": "1*mm",  "y": "10*cm", "x": "10*cm" },
+        "position":   { "z": "70*mm", "y": "0*cm", "x": "0*cm" },
+        "module": {
+            "name":     "pixel",
+            "type:":    "MiniTelPixel",
+            "material": "Silicon",
+            "x":        "6*mm",
+            "y":        "6*mm",
+            "z":        "1*mm",
+            "vis":      "ModVis",
+            "alpha":    "-2.*radian",
+            "beta":     "-2.*radian",
+            "gamma":    "-0.*radian"
+        }
+    },
+
+    "detector":  {
+        "id":       9,
+        "name":     "detector9",
+        "type":     "MiniTelPixel_json",
+        "material": "Silicon",
+        "vis":      "DetVis",
+        "readout":  "MyLHCBdetector1Hits",
+        "dimensions": { "z": "1*mm",  "y": "10*cm", "x": "10*cm" },
+        "position":   { "z": "80*mm", "y": "0*cm", "x": "0*cm" },
+        "module": {
+            "name":     "pixel",
+            "type:":    "MiniTelPixel",
+            "material": "Silicon",
+            "x":        "6*mm",
+            "y":        "6*mm",
+            "z":        "1*mm",
+            "vis":      "ModVis",
+            "alpha":    "-2.*radian",
+            "beta":     "-2.*radian",
+            "gamma":    "-0.*radian"
+        }
+    },
+
+    "detector":  {
+        "id":       10,
+        "name":     "detector10",
+        "type":     "MiniTelPixel_json",
+        "material": "Silicon",
+        "vis":      "DetVis",
+        "readout":  "MyLHCBdetector1Hits",
+        "dimensions": { "z": "1*mm",  "y": "10*cm", "x": "10*cm" },
+        "position":   { "z": "90*mm", "y": "0*cm", "x": "0*cm" },
+        "module": {
+            "name":     "pixel",
+            "type:":    "MiniTelPixel",
+            "material": "Silicon",
+            "x":        "6*mm",
+            "y":        "6*mm",
+            "z":        "1*mm",
+            "vis":      "ModVis",
+            "alpha":    "-2.*radian",
+            "beta":     "-2.*radian",
+            "gamma":    "-0.*radian"
         }
     }
 }
diff --git a/examples/ClientTests/compact/MiniTel_json.xml b/examples/ClientTests/compact/MiniTel_json.xml
new file mode 100644
index 000000000..37ab8c348
--- /dev/null
+++ b/examples/ClientTests/compact/MiniTel_json.xml
@@ -0,0 +1,93 @@
+<?xml version="1.0" encoding="utf-8"?>
+<lccdd xmlns:compact="http://www.lcsim.org/schemas/compact/1.0"
+       xmlns:xs="http://www.w3.org/2001/XMLSchema"
+       xs:noNamespaceSchemaLocation="http://www.lcsim.org/schemas/compact/1.0/compact.xsd">
+
+  <info name="Sensor"
+	title="Sensor for New experiment"
+        author="Anastasia Karachaliou"
+        status="development"
+        url="/afs/cern.ch/user/a/akaracha/workspace/MyExperiment/DetDesc/xmlDDescr/geometry_myexper.xml"
+        version= "v0r1">
+    <comment>simple Detector as a small box</comment>
+  </info>
+
+  <includes>
+    <gdmlFile  ref="${DD4hepINSTALL}/DDDetectors/compact/elements.xml"/>
+    <gdmlFile  ref="${DD4hepINSTALL}/DDDetectors/compact/materials.xml"/>
+  </includes>
+
+  <define>
+    <constant name="world_side"             value="2*m"/>
+    <constant name="world_x"                value="world_side/2"/>
+    <constant name="world_y"                value="world_side/2"/>
+    <constant name="world_z"                value="world_side/2"/>
+    <constant name="CrossingAngle"          value="0.020"/>
+  </define>
+
+  <materials>
+  </materials>
+
+
+  <display>
+    <vis name="DetVis"  alpha="1.0"    r="0"   g="1.0" b="0.0"  showDaughters="true"   visible="true" />
+    <vis name="ModVis"  alpha="1.0"   r="1"   g="0.0" b="0.0"  showDaughters="true"  visible="false" />
+
+  </display>
+
+
+  <include type="json" ref="MiniTel.json"/>
+
+  <readouts>
+    <readout name="MyLHCBdetector1Hits">
+      <segmentation type="CartesianGridXY" grid_size_x="6*mm" grid_size_y="6*mm" />
+      <id>system:6,x:12:-6,y:24:-6</id>
+    </readout>
+    <readout name="MyLHCBdetector2Hits">
+      <segmentation type="CartesianGridXY" grid_size_x="6*mm" grid_size_y="6*mm" />
+      <id>system:6,x:12:-6,y:24:-6</id>
+    </readout>
+    <readout name="MyLHCBdetector3Hits">
+      <segmentation type="CartesianGridXY" grid_size_x="6*mm" grid_size_y="6*mm" />
+      <id>system:6,x:12:-6,y:24:-6</id>
+    </readout>
+    <readout name="MyLHCBdetector4Hits">
+      <segmentation type="CartesianGridXY" grid_size_x="6*mm" grid_size_y="6*mm" />
+      <id>system:6,x:12:-6,y:24:-6</id>
+    </readout>
+    <readout name="MyLHCBdetector5Hits">
+      <segmentation type="CartesianGridXY" grid_size_x="6*mm" grid_size_y="6*mm" />
+      <id>system:6,x:12:-6,y:24:-6</id>
+    </readout>
+    <readout name="MyLHCBdetector6Hits">
+      <segmentation type="CartesianGridXY" grid_size_x="6*mm" grid_size_y="6*mm" />
+      <id>system:6,x:12:-6,y:24:-6</id>
+    </readout>
+    <readout name="MyLHCBdetector7Hits">
+      <segmentation type="CartesianGridXY" grid_size_x="6*mm" grid_size_y="6*mm" />
+      <id>system:6,x:12:-6,y:24:-6</id>
+    </readout>
+    <readout name="MyLHCBdetector8Hits">
+      <segmentation type="CartesianGridXY" grid_size_x="6*mm" grid_size_y="6*mm" />
+      <id>system:6,x:12:-6,y:24:-6</id>
+    </readout>
+    <readout name="MyLHCBdetector9Hits">
+      <segmentation type="CartesianGridXY" grid_size_x="6*mm" grid_size_y="6*mm" />
+      <id>system:6,x:12:-6,y:24:-6</id>
+    </readout>
+    <readout name="MyLHCBdetector10Hits">
+      <segmentation type="CartesianGridXY" grid_size_x="6*mm" grid_size_y="6*mm" />
+      <id>system:6,x:12:-6,y:24:-6</id>
+    </readout>
+  </readouts>
+
+  <fields>
+    <field name="GlobalSolenoid" type="solenoid" 
+	   inner_field="0.0*tesla"
+	   outer_field="0.0*tesla" 
+	   zmax="2*m"
+	   outer_radius="2*m">
+    </field>
+  </fields>
+
+</lccdd>
diff --git a/examples/ClientTests/src_boost/JsonTest.cpp b/examples/ClientTests/src_boost/JsonTest.cpp
index 880570f2b..456940aa1 100644
--- a/examples/ClientTests/src_boost/JsonTest.cpp
+++ b/examples/ClientTests/src_boost/JsonTest.cpp
@@ -14,9 +14,9 @@
 
 // Framework include files
 #include "JSON/Elements.h"
+#include "JSON/DocumentHandler.h"
 #include "DD4hep/Factories.h"
 
-
 using namespace std;
 using namespace DD4hep;
 using namespace DD4hep::JSON;
@@ -26,10 +26,10 @@ static long json_dump(LCDD& lcdd, int argc, char** argv)   {
   if ( argc < 1 )  {
     return 0;
   }
-  boost::property_tree::ptree pt;
-	boost::property_tree::read_json(argv[0], pt);
+  DocumentHolder doc(JSON::DocumentHandler().load(argv[0]));
+  Element        elt = doc.root();
 
-  for( boost::property_tree::ptree::value_type const& rowPair : pt.get_child( "" ) ) 
+  for( boost::property_tree::ptree::value_type const& rowPair : elt.ptr()->second.get_child( "" ) ) 
 	{
 		cout << "1--" << rowPair.first << ": " << endl;
     cout << rowPair.second.get_value<string>() << " " << endl;
diff --git a/examples/ClientTests/src_boost/MiniTel_json.cpp b/examples/ClientTests/src_boost/MiniTel_json.cpp
new file mode 100644
index 000000000..77f0116f3
--- /dev/null
+++ b/examples/ClientTests/src_boost/MiniTel_json.cpp
@@ -0,0 +1,115 @@
+//==========================================================================
+//  AIDA Detector description implementation for LCD
+//--------------------------------------------------------------------------
+// Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
+// All rights reserved.
+//
+// For the licensing terms see $DD4hepINSTALL/LICENSE.
+// For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
+//
+// Author     : M.Frank
+//
+//==========================================================================
+
+// Include files
+#include "JSON/Helper.h"
+#include "DD4hep/Printout.h"
+#include "DD4hep/LCDD.h"
+
+#include <iostream>
+#include <map>
+
+using namespace std;
+using namespace DD4hep;
+using namespace DD4hep::Geometry;
+
+namespace  {
+
+  struct MyDetExtension  {
+    int idD, Ni, Nj;
+    double posDX, posDY, posDZ;
+    double dimDX, dimDY, dimDZ;
+    double pixelX, pixelY, pixelZ;
+    DetElement detector;
+
+    MyDetExtension(DetElement e) : idD(0), Ni(0), Nj(0),
+        posDX(0.0), posDY(0.0), posDZ(0.0),
+        dimDX(0.0), dimDY(0.0), dimDZ(0.0),
+        pixelX(0.0), pixelY(0.0), pixelZ(0.0), detector(e) {}
+    MyDetExtension(const MyDetExtension& e, DetElement d) 
+      : idD(e.idD), Ni(e.Ni), Nj(e.Nj),
+        posDX(e.posDX), posDY(e.posDY), posDZ(e.posDZ),
+        dimDX(e.dimDX), dimDY(e.dimDY), dimDZ(e.dimDZ),
+        pixelX(e.pixelX), pixelY(e.pixelY), pixelZ(e.pixelZ),
+        detector(d)						       
+    {
+    }
+  };
+}
+typedef MyDetExtension DetectorExtension;
+
+static Ref_t create_detector(LCDD &lcdd, json_h e, SensitiveDetector sens)  {
+  json_det_t x_det = e;             	//json-detelemnt of the detector taken as an argument
+  string det_name = x_det.nameStr();	//det_name is the name of the json-detelement
+  Assembly assembly (det_name);
+  int detectors_id = x_det.id();
+
+  DetElement sdet(det_name,x_det.id());        //sdet is the detelement of the detector!!(actually is a Handle,already a pointer to m_element)
+  DetectorExtension* ext = new MyDetExtension(sdet);
+  sdet.addExtension<MyDetExtension>(ext);
+  ext->idD= detectors_id;
+
+  json_comp_t det_po = x_det.child(_U(position));
+
+  double det_y = det_po.y();     // det_y is the y dimension of the json-detelement
+  double det_x = det_po.x();     // det_x is the x dimension of  the json-detelement
+  double det_z = det_po.z();     // det_z is the z dimension of the json-detelement
+  ext->posDY = det_y;
+  ext->posDX = det_x;
+  ext->posDZ = det_z;
+
+  json_comp_t det_dim = x_det.child(_U(dimensions));
+  double dim_x = det_dim.x();    // det_x is the x dimension of  the json-detelement
+  double dim_y = det_dim.y();    // det_y is the y dimension of the json-detelement
+  double dim_z = det_dim.z();    // det_z is the z dimension of the json-detelement
+
+  Material mat = lcdd.material("Silicon");
+
+  Volume motherVol = lcdd.pickMotherVolume(sdet); //the mothers volume of our detector
+
+  PlacedVolume pv;	//struct of Handle giving the volume id(ayto pou 8a kanw volume kai 8a to steilw me setplacement),dld o detector mou
+  json_comp_t dtc_mod = x_det.child(_U(module));	    // considering the module-pixel of the detector
+  double pixelX = dtc_mod.x();  // The x dimension of the module
+  double pixelY = dtc_mod.y();  // The y dimension of the module
+  double pixelZ = dtc_mod.z();  // The z dimension of the module
+
+  int Ni = dim_x/pixelX;         // how many pixels in the x dimension
+  int Nj = dim_y/pixelY;
+
+  ext->dimDX = dim_x;
+  ext->dimDY = dim_y;
+  ext->dimDZ = dim_z;
+  ext->pixelX = pixelX;
+  ext->pixelY = pixelY;
+  ext->pixelZ = pixelZ;
+  ext->Ni= Ni;
+  ext->Nj= Nj;
+
+
+  Volume m_volume(det_name, Box(dim_x, dim_y, dim_z), mat);	//as parameters it needs name,solid,material
+  m_volume.setVisAttributes(lcdd.visAttributes(x_det.visStr()));	//I DONT MIND ABOUT THIS!
+  pv = motherVol.placeVolume(m_volume,Transform3D(Position(det_x,det_y,det_z)));  //det_x,det_y,det_z are the dimensions of the detector in space
+
+  json_comp_t dtctr = x_det;
+  if ( dtctr.isSensitive() ) {
+    sens.setType("tracker");
+    pv.addPhysVolID("system",detectors_id);
+    m_volume.setSensitiveDetector(sens);
+  }
+  sdet.setPlacement(pv);
+  // Support additional test if LCDD_InhibitConstants is set to TRUE
+  lcdd.constant<double>("world_side");
+  return sdet;
+}
+
+DECLARE_JSON_DETELEMENT(MiniTelPixel_json,create_detector)
-- 
GitLab