[xml] reverse engineering a schema



Hi,

I'm attempting to write a program which displays a schema's content model in a 'tree' format. For example, if given the file 'po.xml' found in libxml/examples the output would be:

purchaseOrder[ orderDate]
|-- shipTo[ country]
|   |-- name
|   |-- street
|   |-- city
|   |-- state
|   `-- zip
|-- billTo[ country]
|   |-- name
|   |-- street
|   |-- city
|   |-- state
|   `-- zip
|-- comment
`-- items
   `-- item[ partNum,@subNum]
       |-- productName
       |-- quantity
       |-- USPrice
       |-- comment
       `-- shipDate
21 elements

Currently I have a working version, but it requires the internals of some of the structures found in xmlregexp.c to become available at the API level. This is because I use the content models generated for each element after the schema is parsed to achieve the reverse engineering and hence, create the tree. What are your thoughts on making the internals of 'struct _xmlRegexp' available at the libxml2 API level?

Also, if I'm going about this problem the wrong way, please let me know.

Thanks,

David Weinkauf





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]