title: C++ parse .xsd using xerces
body: <p>I want to parse <strong>.xsd</strong> file using <strong>xerces c++.</strong> Can someone show me how i can achieve that?</p>
  <p>I want to read the data from <strong>.xsd file</strong> and print the data in console.</p>
  <p>I can't find any examples.</p>
  <p>Here is the data in <strong>.xsd</strong> file:</p>
  <pre><code>&lt;xs:complexType name=&quot;Example&quot;&gt;
     &lt;xs:sequence&gt;
      &lt;xs:element name=&quot;Element1&quot; type=&quot;ElementType&quot; minOccurs=&quot;0&quot; maxOccurs=&quot;unbounded&quot;/&gt;
     &lt;/xs:sequence&gt;
  &lt;/xs:complexType&gt;
  </code></pre>
  <p>I want to print the data  in console like this:</p>
  <pre><code>Object: Example
  Property: Element1, Type: EmelementType, MinOccurs: 0, MaxOccurs: -1
  </code></pre>
  <p>This is what i found so far:</p>
  <pre><code>int main(int argc, char* argv[])
  {
      try {
          XMLPlatformUtils::Initialize();
      }
      catch (const XMLException&amp; toCatch) {
          char* message = XMLString::transcode(toCatch.getMessage());
          std::cout &lt;&lt; &quot;Error during initialization! :\n&quot;
              &lt;&lt; message &lt;&lt; &quot;\n&quot;;
          XMLString::release(&amp;message);
          return 1;
      }
  
      XercesDOMParser* parser = new XercesDOMParser();
      parser-&gt;setValidationScheme(XercesDOMParser::Val_Always);
      parser-&gt;setDoNamespaces(true);    // optional
  
      ErrorHandler* errHandler = (ErrorHandler*) new HandlerBase();
      parser-&gt;setErrorHandler(errHandler);
  
  
      const char* xmlFile = &quot;C:\\Users\\Desktop\\Schema\\File.xsd&quot;;
  
      try {
         
          parser-&gt;parse(xmlFile);
          
      }
      catch (const XMLException&amp; toCatch) {
          char* message = XMLString::transcode(toCatch.getMessage());
          std::cout &lt;&lt; &quot;Exception message is: \n&quot;
              &lt;&lt; message &lt;&lt; &quot;\n&quot;;
          XMLString::release(&amp;message);
          return -1;
      }
      catch (const DOMException&amp; toCatch) {
          char* message = XMLString::transcode(toCatch.msg);
          std::cout &lt;&lt; &quot;Exception message is: \n&quot;
              &lt;&lt; message &lt;&lt; &quot;\n&quot;;
          XMLString::release(&amp;message);
          return -1;
      }
      catch (...) {
          std::cout &lt;&lt; &quot;Unexpected Exception \n&quot;;
          return -1;
      }
  
      delete parser;
      delete errHandler;
      return 0;
  
  }
  </code></pre>