Schema Examples

As you might expect, there are several approaches for defining schemas for the XML representations of our X12 transaction sets. There is no single approach that is necessarily the "right" approach for everyone. For the XML representations of our flat files and CSV files I took the very easy route of letting a tool such as XMLPY generate the schemas for me. A more comprehensive approach might be to develop type library schemas, as discussed in Chapter 4, for the X12 Data Element Dictionary and Segment Directory. We could then develop instance document schemas for transaction sets that used data element and segment type definitions from the type libraries. An ambitious hacker (with enough cash to purchase the "table data" version of the standards from X12) could even develop a utility that created all these schemas in an automated fashion. However, the main drawback to such an approach (aside from the coding and expense) would be that the resulting schemas would validate against only the full standard and not against a particular implementation. Most users are concerned with validating against their particular use of a transaction set standard, that is, their implementation, instead of the full standard. Another side effect is that, given the effort and expense of developing these type libraries, there might be only one (or at most a few) versions developed and shared among several users. This would lock users into the XML Element names defined in the type libraries and restrict the flexibility built into the utilities.

I started writing this particular section with the idea that I might develop type library schemas just to present another approach. However, after considering the issue and writing the previous paragraph I have persuaded myself (and I hope you as well) that again the simple approach is the best. The sample X12PurchaseOrder and X12Invoice schemas listed below were mostly autogenerated by XMLSPY. Again, I modified them a bit to correct values such as minimum and maximum occurrences, schema language data type, and enumerations.

Since this chapter is fairly long already, I won't include the schemas directly. You may retrieve them from the book's Web site as:

  • X12PurchaseOrder.xsd: for the XML representation of our X12 850 Purchase Order

  • X12Invoice.xsd: for the XML representation of our X12 810 Invoice

Using XML with Legacy Business Applications
Using XML with Legacy Business Applications
ISBN: 0321154940
EAN: 2147483647
Year: 2003
Pages: 181

Similar book on Amazon © 2008-2017.
If you may any questions please contact us: