问题描述
别人给了我一个xds文件,说是xml的模板文件,我现在的任务是做一个eclipse插件,可以生成应用服务器的配置信息文件xml。我的开发环境用的是wtp-all-in-one-sdk-R-1.5.1 我不知道如何下手,请大家指教其xds文件代码如下:<?xml version="1.0" encoding="UTF-8" standalone="no"?> <!-- edited with XMLSpy v2006 U (http://www.altova.com) by Administrator (EMBRACE) --> <xs:schema xmlns:once="http://www." xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www."> <xs:complexType name="TagStringValueType"> <xs:simpleContent> <xs:extension base="xs:string"/> </xs:simpleContent> </xs:complexType> <xs:element name="name" type="once:TagStringValueType"/> <xs:element name="value" type="once:TagStringValueType"/> <xs:element name="service-ref-name" type="once:TagStringValueType"/> <xs:element name="service-endpoint-interface" type="once:TagStringValueType"/> <xs:element name="wsdl-override" type="once:TagStringValueType"/> <xs:element name="call-property"> <xs:complexType> <xs:sequence> <xs:element ref="once:name" minOccurs="0"/> <xs:element ref="once:value" minOccurs="0"/> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="context-root" type="once:TagStringValueType"/> <xs:element name="ejb-ref"> <xs:complexType> <xs:sequence> <xs:element ref="once:ejb-ref-name" minOccurs="0"/> <xs:element ref="once:jndi-name" minOccurs="0"/> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="ejb-local-ref"> <xs:complexType> <xs:sequence> <xs:element ref="once:ejb-ref-name" minOccurs="0"/> <xs:choice> <xs:element ref="once:local-jndi-name" minOccurs="0"/> <xs:element ref="once:jndi-name" minOccurs="0"/> </xs:choice> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="ejb-ref-name" type="once:TagStringValueType"/> <xs:element name="jndi-name" type="once:TagStringValueType"/> <xs:element name="local-jndi-name" type="once:TagStringValueType"/> <xs:element name="onceas-web"> <xs:complexType> <xs:sequence minOccurs="0"> <xs:element ref="once:context-root" minOccurs="0"/> <xs:element ref="once:security-realm-name" minOccurs="0"/> <xs:element ref="once:references" minOccurs="0"/> <xs:element ref="once:work-manager" minOccurs="0"/> <xs:element ref="once:onceas-servlet" minOccurs="0" maxOccurs="unbounded"/> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="port-component-ref"> <xs:complexType> <xs:sequence> <xs:element ref="once:service-endpoint-interface" minOccurs="0"/> <xs:element ref="once:call-property" minOccurs="0"/> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="references"> <xs:complexType> <xs:sequence minOccurs="0"> <xs:element ref="once:ejb-ref" minOccurs="0" maxOccurs="unbounded"/> <xs:element ref="once:ejb-local-ref" minOccurs="0" maxOccurs="unbounded"/> <xs:element ref="once:resource-ref" minOccurs="0" maxOccurs="unbounded"/> <xs:element ref="once:resource-env-ref" minOccurs="0" maxOccurs="unbounded"/> <xs:element ref="once:service-ref" minOccurs="0" maxOccurs="unbounded"/> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="resource-env-ref"> <xs:complexType> <xs:sequence> <xs:element ref="once:resource-env-ref-name" minOccurs="0"/> <xs:element ref="once:jndi-name" minOccurs="0"/> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="resource-env-ref-name" type="once:TagStringValueType"/> <xs:element name="resource-ref"> <xs:complexType> <xs:sequence> <xs:element ref="once:res-ref-name" minOccurs="0"/> <xs:element ref="once:jndi-name" minOccurs="0"/> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="res-ref-name" type="once:TagStringValueType"/> <xs:element name="security-realm-name" type="once:TagStringValueType"/> <xs:element name="service-ref"> <xs:complexType> <xs:sequence> <xs:element ref="once:service-ref-name" minOccurs="0"/> <xs:element ref="once:port-component-ref" minOccurs="0" maxOccurs="unbounded"/> <xs:element ref="once:wsdl-override" minOccurs="0"/> <xs:element ref="once:call-property" minOccurs="0" maxOccurs="unbounded"/> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="work-manager-bean"> <xs:complexType> <xs:sequence> <xs:element ref="once:name"/> <xs:element ref="once:fair-share-request-class" minOccurs="0"/> <xs:element ref="once:max-threads-constraint" minOccurs="0"/> <xs:element ref="once:min-threads-constraint" minOccurs="0"/> <xs:element ref="once:capacity" minOccurs="0"/> <xs:element ref="once:work-manager-shutdown-trigger" minOccurs="0"/> <xs:element ref="once:context-request-class" minOccurs="0"/> <xs:element ref="once:response-time-request-class" minOccurs="0"/> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="fair-share-request-class"> <xs:complexType> <xs:sequence> <xs:element ref="once:name"/> <xs:element ref="once:fair-share"/> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="max-threads-constraint"> <xs:complexType> <xs:sequence> <xs:element ref="once:name"/> <xs:element ref="once:count"/> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="min-threads-constraint"> <xs:complexType> <xs:sequence> <xs:element ref="once:name"/> <xs:element ref="once:count"/> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="capacity"> <xs:complexType> <xs:sequence> <xs:element ref="once:name"/> <xs:element ref="once:count"/> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="work-manager-shutdown-trigger"> <xs:complexType> <xs:sequence> <xs:element ref="once:max-stuck-thread-time"/> <xs:element ref="once:stuck-thread-count"/> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="response-time-request-class"> <xs:complexType> <xs:sequence> <xs:element ref="once:name"/> <xs:element ref="once:goal-ms"/> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="servlet-name" type="once:TagStringValueType"/> <xs:element name="schedule-policy" type="once:TagStringValueType"/> <xs:element name="onceas-servlet"> <xs:complexType> <xs:sequence> <xs:element ref="once:servlet-name"/> <xs:element ref="once:schedule-policy" minOccurs="0" maxOccurs="unbounded"/> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="work-manager"> <xs:complexType> <xs:sequence> <xs:element ref="once:work-manager-bean" minOccurs="0" maxOccurs="unbounded"/> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="fair-share" type="once:TagStringValueType"/> <xs:element name="goal-ms" type="once:TagStringValueType"/> <xs:element name="count" type="once:TagStringValueType"/> <xs:element name="max-stuck-thread-time" type="once:TagStringValueType"/> <xs:element name="stuck-thread-count" type="once:TagStringValueType"/> <xs:element name="context-case"> <xs:complexType> <xs:sequence> <xs:element ref="once:user-name" minOccurs="0"/> <xs:element ref="once:group-name"/> <xs:element ref="once:request-class-name"/> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="user-name" type="once:TagStringValueType"/> <xs:element name="group-name" type="once:TagStringValueType"/> <xs:element name="request-class-name" type="once:TagStringValueType"/> <xs:element name="context-request-class"> <xs:complexType> <xs:sequence> <xs:element ref="once:name"/> <xs:element ref="once:context-case" maxOccurs="unbounded"/> </xs:sequence> </xs:complexType> </xs:element> </xs:schema>
解决方案
这个跟你的eclipse插件基本没啥关系,xsd文件中只是对xml的有效格式进行定义,比如根节点,每个节点支持的属性等,你只要把这个东东看明白,让你的eclipse插件能生成符合这个模板规定的格式的xml就行了,而且xml文件可以用这个xsd文件校验一下,顺便说一句,eclipse本身自带的xml editor的内容辅助功能也是通过所编辑的xml文档的xsd文件进行提取的,因为xsd文件中已经定义了所有的xml格式,比如某个节点可以有哪几个属性,每个节点可以有哪几个子节点等。
解决方案二:
看看这个http://www.suddenpresence.com/xds/