我最近在同一主题上写了另一篇文章,其中我不是很清楚,所以我决定提出同样的问题并删除我的其他问题。
我目前正在开发一个WCF RESTful Web服务,该服务将从Iframe中的客户端页面调用,如下所示。
<iframe src="/URL_TO_THE_SERVICE/param1/param2/param3"/>
根据URL中给出的参数,在我的Web服务中,我将从out数据库中检索xsd文件。从这个xsd文件中,我们需要向用户调用HTML文本,以根据检索到的XSD在iframe中生成表单。我正在使用C#ASP.NET作为我的WCF RESTful Web服务,如果这有帮助的话。
有没有人知道我可以使用的解决方案,外部工具等?
这是我获得的示例XSD架构,需要动态转换为HTML表单。这甚至可以实现自动化吗?
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" at tributeFormDefault="unqualified" elementFormDefault="qualified">
<xs:element name="Leads">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" name="Lead">
<xs:complexType>
<xs:all>
<xs:element name="FirstName" type="xs:string" minOccurs="1" />
<xs:element name="LastName" type="xs:string" minOccurs="1" />
<xs:element name="Address" type="xs:string" minOccurs="1" />
<xs:element name="City" type="xs:string" minOccurs="0" />
<xs:element name="State" minOccurs="1">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="AL" />
<xs:enumeration value="AK" />
<xs:enumeration value="AZ" />
<xs:enumeration value="AR" />
<xs:enumeration value="CA" />
<xs:enumeration value="CO" />
<xs:enumeration value="CT" />
<xs:enumeration value="DE" />
<xs:enumeration value="DC" />
<xs:enumeration value="FL" />
<xs:enumeration value="GA" />
<xs:enumeration value="HI" />
<xs:enumeration value="ID" />
<xs:enumeration value="IL" />
<xs:enumeration value="IN" />
<xs:enumeration value="IA" />
<xs:enumeration value="KS" />
<xs:enumeration value="KY" />
<xs:enumeration value="LA" />
<xs:enumeration value="ME" />
<xs:enumeration value="MD" />
<xs:enumeration value="MA" />
<xs:enumeration value="MI" />
<xs:enumeration value="MN" />
<xs:enumeration value="MS" />
<xs:enumeration value="MO" />
<xs:enumeration value="MT" />
<xs:enumeration value="NE" />
<xs:enumeration value="NV" />
<xs:enumeration value="NH" />
<xs:enumeration value="NJ" />
<xs:enumeration value="NM" />
<xs:enumeration value="NY" />
<xs:enumeration value="NC" />
<xs:enumeration value="ND" />
<xs:enumeration value="OH" />
<xs:enumeration value="OK" />
<xs:enumeration value="OR" />
<xs:enumeration value="PA" />
<xs:enumeration value="RI" />
<xs:enumeration value="SC" />
<xs:enumeration value="SD" />
<xs:enumeration value="TN" />
<xs:enumeration value="TX" />
<xs:enumeration value="UT" />
<xs:enumeration value="VT" />
<xs:enumeration value="VA" />
<xs:enumeration value="WA" />
<xs:enumeration value="WV" />
<xs:enumeration value="WI" />
<xs:enumeration value="WY" />
<xs:enumeration value="PR" />
<xs:enumeration value="NS" />
<xs:enumeration value="Alabama" />
<xs:enumeration value="Alaska" />
<xs:enumeration value="Arizona" />
<xs:enumeration value="Arkansas" />
<xs:enumeration value="California" />
<xs:enumeration value="Colorado" />
<xs:enumeration value="Connecticut" />
<xs:enumeration value="Delaware" />
<xs:enumeration value="District of Columbia" />
<xs:enumeration value="Florida" />
<xs:enumeration value="Georgia" />
<xs:enumeration value="Hawaii" />
<xs:enumeration value="Idaho" />
<xs:enumeration value="Illinois" />
<xs:enumeration value="Indiana" />
<xs:enumeration value="Iowa" />
<xs:enumeration value="Kansas" />
<xs:enumeration value="Kentucky" />
<xs:enumeration value="Louisiana" />
<xs:enumeration value="Maine" />
<xs:enumeration value="Maryland" />
<xs:enumeration value="Massachusetts" />
<xs:enumeration value="Michigan" />
<xs:enumeration value="Minnesota" />
<xs:enumeration value="Mississippi" />
<xs:enumeration value="Missouri" />
<xs:enumeration value="Montana" />
<xs:enumeration value="Nebraska" />
<xs:enumeration value="Nevada" />
<xs:enumeration value="New Hampshire" />
<xs:enumeration value="New Jersey" />
<xs:enumeration value="New Mexico" />
<xs:enumeration value="New York" />
<xs:enumeration value="North Carolina" />
<xs:enumeration value="North Dakota" />
<xs:enumeration value="Ohio" />
<xs:enumeration value="Oklahoma" />
<xs:enumeration value="Oregon" />
<xs:enumeration value="Pennsylvania" />
<xs:enumeration value="Rhode Island" />
<xs:enumeration value="South Carolina" />
<xs:enumeration value="South Dakota" />
<xs:enumeration value="Tennessee" />
<xs:enumeration value="Texas" />
<xs:enumeration value="Utah" />
<xs:enumeration value="Vermont" />
<xs:enumeration value="Virginia" />
<xs:enumeration value="Washington" />
<xs:enumeration value="West Virginia" />
<xs:enumeration value="Wisconsin" />
<xs:enumeration value="Wyoming" />
<xs:enumeration value="Puerto Rico" />
<xs:enumeration value="No State" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="Zip" type="xs:string" minOccurs="0" />
<xs:element name="Email" minOccurs="0">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:pattern value="[a-zA-Z0-9_.]+@([a-zA-Z0-9]+\.)+[a-zA-Z0-9]+" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="PrimaryPhone" minOccurs="0">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:pattern value="\(?[0-9]{3,3}\)?\-?\s?[0-9]{3,3}-?[0-9]{4,4}" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="LoanAmount" minOccurs="0">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:pattern value="\$?[0-9,.]+" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="Balance" minOccurs="0">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:pattern value="\$?[0-9,.]+" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="LoanType" minOccurs="0">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="Refinance" />
<xs:enumeration value="HELOC" />
<xs:enumeration value="Second Mortgage" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="EstimatedValue" minOccurs="0">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:pattern value="\$?[0-9,.]+" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="LenderDate" minOccurs="0">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:pattern value="(0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|3[01])[- /.](19|20)\d\d" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="MobilePhone" minOccurs="0">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:pattern value="\(?[0-9]{3,3}\)?\-?\s?[0-9]{3,3}-?[0-9]{4,4}" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="OptOut" type="xs:boolean" minOccurs="0" />
<xs:element name="SendComments" type="xs:string" minOccurs="0" />
<xs:element name="VendorID" minOccurs="0">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="EB1234" />
<xs:enumeration value="ER5678" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="CallTime" type="xs:dateTime" minOccurs="0" />
<xs:element name="AdSource" type="xs:string" minOccurs="0" />
<xs:element name="Result" minOccurs="0">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="C" />
<xs:enumeration value="A" />
<xs:enumeration value="N" />
<xs:enumeration value="B" />
<xs:enumeration value="W" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="Duration" type="xs:decimal" minOccurs="0" />
<xs:element name="ReviewStatus" type="xs:string" minOccurs="0" />
<xs:element name="SubID" type="xs:string" minOccurs="0" />
<xs:element name="Borrowers" type="xs:string" minOccurs="0" />
<xs:element name="Loans" type="xs:string" minOccurs="0" />
<xs:element name="Drivers" minOccurs="0">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" name="Driver">
<xs:complexType>
<xs:all>
<xs:element name="FirstName" type="xs:string" minOccurs="0" />
<xs:element name="LastName" type="xs:string" minOccurs="0" />
</xs:all>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="DOB" type="xs:dateTime" minOccurs="0" />
<xs:element name="StandardAddress" type="xs:string" minOccurs="0" />
<xs:element name="StandardCity" type="xs:string" minOccurs="0" />
<xs:element name="StandardState" minOccurs="0">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="AL" />
<xs:enumeration value="AK" />
<xs:enumeration value="AZ" />
<xs:enumeration value="AR" />
<xs:enumeration value="CA" />
<xs:enumeration value="CO" />
<xs:enumeration value="CT" />
<xs:enumeration value="DE" />
<xs:enumeration value="DC" />
<xs:enumeration value="FL" />
<xs:enumeration value="GA" />
<xs:enumeration value="HI" />
<xs:enumeration value="ID" />
<xs:enumeration value="IL" />
<xs:enumeration value="IN" />
<xs:enumeration value="IA" />
<xs:enumeration value="KS" />
<xs:enumeration value="KY" />
<xs:enumeration value="LA" />
<xs:enumeration value="ME" />
<xs:enumeration value="MD" />
<xs:enumeration value="MA" />
<xs:enumeration value="MI" />
<xs:enumeration value="MN" />
<xs:enumeration value="MS" />
<xs:enumeration value="MO" />
<xs:enumeration value="MT" />
<xs:enumeration value="NE" />
<xs:enumeration value="NV" />
<xs:enumeration value="NH" />
<xs:enumeration value="NJ" />
<xs:enumeration value="NM" />
<xs:enumeration value="NY" />
<xs:enumeration value="NC" />
<xs:enumeration value="ND" />
<xs:enumeration value="OH" />
<xs:enumeration value="OK" />
<xs:enumeration value="OR" />
<xs:enumeration value="PA" />
<xs:enumeration value="RI" />
<xs:enumeration value="SC" />
<xs:enumeration value="SD" />
<xs:enumeration value="TN" />
<xs:enumeration value="TX" />
<xs:enumeration value="UT" />
<xs:enumeration value="VT" />
<xs:enumeration value="VA" />
<xs:enumeration value="WA" />
<xs:enumeration value="WV" />
<xs:enumeration value="WI" />
<xs:enumeration value="WY" />
<xs:enumeration value="PR" />
<xs:enumeration value="NS" />
<xs:enumeration value="Alabama" />
<xs:enumeration value="Alaska" />
<xs:enumeration value="Arizona" />
<xs:enumeration value="Arkansas" />
<xs:enumeration value="California" />
<xs:enumeration value="Colorado" />
<xs:enumeration value="Connecticut" />
<xs:enumeration value="Delaware" />
<xs:enumeration value="District of Columbia" />
<xs:enumeration value="Florida" />
<xs:enumeration value="Georgia" />
<xs:enumeration value="Hawaii" />
<xs:enumeration value="Idaho" />
<xs:enumeration value="Illinois" />
<xs:enumeration value="Indiana" />
<xs:enumeration value="Iowa" />
<xs:enumeration value="Kansas" />
<xs:enumeration value="Kentucky" />
<xs:enumeration value="Louisiana" />
<xs:enumeration value="Maine" />
<xs:enumeration value="Maryland" />
<xs:enumeration value="Massachusetts" />
<xs:enumeration value="Michigan" />
<xs:enumeration value="Minnesota" />
<xs:enumeration value="Mississippi" />
<xs:enumeration value="Missouri" />
<xs:enumeration value="Montana" />
<xs:enumeration value="Nebraska" />
<xs:enumeration value="Nevada" />
<xs:enumeration value="New Hampshire" />
<xs:enumeration value="New Jersey" />
<xs:enumeration value="New Mexico" />
<xs:enumeration value="New York" />
<xs:enumeration value="North Carolina" />
<xs:enumeration value="North Dakota" />
<xs:enumeration value="Ohio" />
<xs:enumeration value="Oklahoma" />
<xs:enumeration value="Oregon" />
<xs:enumeration value="Pennsylvania" />
<xs:enumeration value="Rhode Island" />
<xs:enumeration value="South Carolina" />
<xs:enumeration value="South Dakota" />
<xs:enumeration value="Tennessee" />
<xs:enumeration value="Texas" />
<xs:enumeration value="Utah" />
<xs:enumeration value="Vermont" />
<xs:enumeration value="Virginia" />
<xs:enumeration value="Washington" />
<xs:enumeration value="West Virginia" />
<xs:enumeration value="Wisconsin" />
<xs:enumeration value="Wyoming" />
<xs:enumeration value="Puerto Rico" />
<xs:enumeration value="No State" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="StandardZip" type="xs:string" minOccurs="0" />
<xs:element name="IPAddress" type="xs:string" minOccurs="0" />
<xs:element name="LeadScore" type="xs:string" minOccurs="0" />
<xs:element name="AreaCode" type="xs:int" minOccurs="0" />
<xs:element name="SecondPhone" minOccurs="0">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:pattern value="\(?[0-9]{3,3}\)?\-?\s?[0-9]{3,3}-?[0-9]{4,4}" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="TestYesNoSubFields" type="xs:string" minOccurs="0" />
<xs:element name="Status" minOccurs="0">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="Pending" />
<xs:enumeration value="Working" />
<xs:enumeration value="Closed" />
<xs:enumeration value="Dead" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="SalePrice" minOccurs="0">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:pattern value="\$?[0-9,.]+" />
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:all>
<xs:attribute name="reference" type="xs:string" use="optional" />
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="vid" type="xs:unsignedLong" use="required" />
<xs:attribute name="lid" type="xs:unsignedLong" use="required" />
<xs:attribute name="aid" type="xs:unsignedLong" use="optional" />
<xs:attribute name="password" type="xs:string" use="optional" />
</xs:complexType>
由于
答案 0 :(得分:1)
我不知道有任何工具,但要记住的关键是XSD架构文件是 XML,这意味着您可以根据提供的元素自行解释和生成HTML。您的XSD,或者您可以使用XSLT转换来生成它。 XSLT可以在代码中完成服务器端,也可以由浏览器在客户端完成。要在浏览器中执行XSLT,您需要在结果XML的顶部指定一个声明:
<?xml-stylesheet type="text/xsl" href="/path/to/html-transform.xsl"?>
html-transform.xsl
是您的XSLT转换文件。