You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-users@xerces.apache.org by chaman bagga <ch...@yahoo.com> on 2013/03/01 12:21:00 UTC
parsing xsd using xerces c++
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.
Re: parsing xsd using xerces c++
Posted by chaman bagga <ch...@yahoo.com>.
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 <ch...@yahoo.com>
To: "c-users@xerces.apache.org" <c-...@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 <be...@redsnapper.net>
To: c-users@xerces.apache.org; chaman bagga <ch...@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 <be...@redsnapper.net>
> To: c-users@xerces.apache.org; chaman bagga <ch...@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 <ch...@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] <jn...@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.
Re: parsing xsd using xerces c++
Posted by chaman bagga <ch...@yahoo.com>.
XSModel can be used to get the schema definition without an XML file. E.g. look at SCMprint
________________________________
From: Ben Griffin <be...@redsnapper.net>
To: c-users@xerces.apache.org; chaman bagga <ch...@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 <be...@redsnapper.net>
> To: c-users@xerces.apache.org; chaman bagga <ch...@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 <ch...@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] <jn...@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.
Re: parsing xsd using xerces c++
Posted by Ben Griffin <be...@redsnapper.net>.
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 <be...@redsnapper.net>
> To: c-users@xerces.apache.org; chaman bagga <ch...@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 <ch...@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] <jn...@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.
Re: parsing xsd using xerces c++
Posted by chaman bagga <ch...@yahoo.com>.
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 <be...@redsnapper.net>
To: c-users@xerces.apache.org; chaman bagga <ch...@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 <ch...@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] <jn...@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.
Re: parsing xsd using xerces c++
Posted by Ben Griffin <be...@redsnapper.net>.
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 <ch...@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] <jn...@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.
Re: parsing xsd using xerces c++
Posted by chaman bagga <ch...@yahoo.com>.
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] <jn...@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.
Re: parsing xsd using xerces c++
Posted by "Jeroen N. Witmond [Bahco]" <jn...@xs4all.nl>.
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.