We need a php script that can convert an xml schema to a an xml template.
Function signature is
convertToTemplate(schema, type) // return an XML string
for example, given the following schema
<schema ...>
<element name="a" type="xs:date" nillable="true" />
<element name="b" type="xs:string" nillable="true" />
<element name="a1" type="A1" nillable="true" />
<element name="a2" type="A2" nillable="true" />
<complexType name="A1">
<sequence>
<element ref="a" />
</sequence>
</complexType>
<complexType name="A2">
<sequence>
<element ref="a1" />
<element ref="b" />
</sequence>
</complexType>
</schema>
we want
convertToTemplate(above-schema, "a2")
to return
<a2>
<a1>
<a xsi:type="xs:date" xsi:nil="true/>
</a1>
<b xsi:type="xs:string" xsi:nil="true" />
</a2>
Only a very limited subset of xml schema's need to be parsed
1. assume all elements are declared as global
2. assume all elements are in a sequence.
3. there are no attributes.
The only complications
1. schemas can import other schemas. Thus some kind of recursion is needed
2. namespaces need to be supported
3. complexTypes can be extended from other complex types.
Test cases & example schemas will be provided.
## Deliverables
1) Complete and fully-functional working program(s) in executable form as well as complete source code of all work done.
2) Deliverables must be in ready-to-run condition, as follows (depending on the nature of the deliverables):
a) For web sites or other server-side deliverables intended to only ever exist in one place in the Buyer's environment--Deliverables must be installed by the Seller in ready-to-run condition in the Buyer's environment.
b) For all others including desktop software or software the buyer intends to distribute: A software installation package that will install the software in ready-to-run condition on the platform(s) specified in this bid request.
3) All deliverables will be considered "work made for hire" under U.S. Copyright law. Buyer will receive exclusive and complete copyrights to all work purchased. (No GPL, GNU, 3rd party components, etc. unless all copyright ramifications are explained AND AGREED TO by the buyer on the site per the coder's Seller Legal Agreement).
## Platform
PHP 5.x