I think the answer lies in using XSModel in the following way http://www.mail-archive.com/xerces-j-user@xml.apache.org/msg06034.html
________________________________ From: chaman bagga <chamanba...@yahoo.com> To: "c-users@xerces.apache.org" <c-users@xerces.apache.org> Sent: Wednesday, March 6, 2013 6:18 PM Subject: Re: parsing xsd using xerces c++ XSModel can be used to get the schema definition without an XML file. E.g. look at SCMprint ________________________________ From: Ben Griffin <b...@redsnapper.net> To: c-users@xerces.apache.org; chaman bagga <chamanba...@yahoo.com> Sent: Tuesday, March 5, 2013 6:30 PM Subject: Re: parsing xsd using xerces c++ I guess I must be missing something - you want use PSVI over a schema (XSD) or over a schema instance? Once again I may be wrong, but I thought that PSVI is generated for an instance against it's schema, during the instance's validation. So, if you are treating the XSD as a validated XML document (a schema instance), using it's PSVI should not be a problem, right? > > Agree, I know this solution. PSVI is there to provide the type information of > XSD, and I would like to use the work already done there. Provided I can get > the structure of document using PSVI. > > > ________________________________ > From: Ben Griffin <b...@redsnapper.net> > To: c-users@xerces.apache.org; chaman bagga <chamanba...@yahoo.com> > Sent: Tuesday, March 5, 2013 5:30 PM > Subject: Re: parsing xsd using xerces c++ > > I maybe totally missing the point, but why not just load the xsd file as an > xml file, and use the DOM / SAX APIs for crawling as you need? > > On 5 Mar 2013, at 11:43, chaman bagga <chamanba...@yahoo.com> wrote: > >> >> I was looking more towards getting a tree structure from the PSVI. >> >> XSD would use similar algorithm to what I need to do. However, I can't use >> it as is because I need to process the type information dynamically. >> >> >> ________________________________ >> From: Jeroen N. Witmond [Bahco] <j...@xs4all.nl> >> To: c-users@xerces.apache.org >> Sent: Friday, March 1, 2013 10:49 PM >> Subject: Re: parsing xsd using xerces c++ >> >> You might want to take a look at http://www.codesynthesis.com/products/xsd/ >> >> It may be what you need. >> >>> >>> Hello Xerces Experts, >>> >>> I have a requirement to traverse the tree structure of an XSD file, and >>> then generate a tree like structure roughly corresponding to the hierarchy >>> of the XSD structure. >>> >>> I looked at SCMPrint.cpp in samples, but its not clear to me on how to do >>> a tree traversal (depth first pre-order I believe) of the structure. >>> >>> Any help / sample code is greatly appreciated. >>> >>> Regards, >>> Chaman.