title: Accessing to C object properties from Swift 4
body: <p>I imported the libxml2 C library into a pure Swift project successfully but now I'm facing a new problem. I want to access to the properties of an xmlNode C Type, which is declared like this at the libxml library</p>
  
  <pre><code>struct _xmlNode {
      void           *_private;   /* application data */
      xmlElementType   type;  /* type number, must be second ! */
      const xmlChar   *name;      /* the name of the node, or the entity */
      struct _xmlNode *children;  /* parent-&gt;childs link */
      struct _xmlNode *last;  /* last child link */
      struct _xmlNode *parent;    /* child-&gt;parent link */
      struct _xmlNode *next;  /* next sibling link  */
      struct _xmlNode *prev;  /* previous sibling link  */
      struct _xmlDoc  *doc;   /* the containing document */
  
      /* End of common part */
      xmlNs           *ns;        /* pointer to the associated namespace */
      xmlChar         *content;   /* the content */
      struct _xmlAttr *properties;/* properties list */
      xmlNs           *nsDef;     /* namespace definitions on this node */
      void            *psvi;  /* for type/PSVI informations */
      unsigned short   line;  /* line number */
      unsigned short   extra; /* extra data for XPath/XSLT */
  }; 
  </code></pre>
  
  <p>For example, I want to access to the <code>name</code> property of a xmlNode object named <code>node</code>. I know that, using objective-C, that can be done like this <code>node-&gt;name</code>, but that is not allowed on Swift.</p>
  
  <p>I found the move() function inside the object so I can do <code>node.move().name</code> but I'm not sure if that is the way to go. </p>
  
  <p>Also, how can I cast the C types to Swift types easily?</p>
  
  <p>Anyone can point me to the right way?
  Thanks.</p>