aspose file tools*
The moose likes XML and Related Technologies and the fly likes schema generation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "schema generation" Watch "schema generation" New topic
Author

schema generation

ved gunjan
Ranch Hand

Joined: May 17, 2003
Posts: 86
Hi All
I'm trying to generate schema from DTD using xmlspy.Below is the DTD.
<?xml version="1.0" encoding="UTF-8"?>
<!--DTD generated by XMLSPY v2004 rel. 4 (http://www.xmlspy.com)-->
<!ELEMENT definitions (message+, portType+, plnk artnerLinkType+)>
<!ATTLIST definitions
targetNamespace CDATA #REQUIRED
xmlns CDATA #REQUIRED
xmlns:xsd CDATA #REQUIRED
xmlns lnk CDATA #REQUIRED
xmlns:lns CDATA #REQUIRED
>
<!ELEMENT fault EMPTY>
<!ATTLIST fault
name (loanProcessFault | unableToHandleRequest) #REQUIRED
message CDATA #REQUIRED
>
<!ELEMENT input EMPTY>
<!ATTLIST input
message CDATA #REQUIRED
>
<!ELEMENT message (part+)>
<!ATTLIST message
name (approvalMessage | creditInformationMessage | errorMessage | riskAssessmentMessage) #REQUIRED
>
<!ELEMENT operation (input, output, fault)>
<!ATTLIST operation
name (approve | check | request) #REQUIRED
>
<!ELEMENT output EMPTY>
<!ATTLIST output
message (lns:approvalMessage | lns:riskAssessmentMessage) #REQUIRED
>
<!ELEMENT part EMPTY>
<!ATTLIST part
name (accept | amount | errorCode | firstName | level | name) #REQUIRED
type (xsd:integer | xsd:string) #REQUIRED
>
<!ELEMENT plnk artnerLinkType (plnk:role)>
<!ATTLIST plnk artnerLinkType
name (loanApprovalLinkType | loanPartnerLinkType | riskAssessmentLinkType) #REQUIRED
>
<!ELEMENT plnk ortType EMPTY>
<!ATTLIST plnk ortType
name (lns:loanApprovalPT | lns:loanServicePT | lns:riskAssessmentPT) #REQUIRED
>
<!ELEMENT plnk:role (plnk ortType)>
<!ATTLIST plnk:role
name (approver | assessor | loanService) #REQUIRED
>
<!ELEMENT portType (operation)>
<!ATTLIST portType
name (loanApprovalPT | loanServicePT | riskAssessmentPT) #REQUIRED
>

Below is the schema.
<?xml version="1.0" encoding="UTF-8"?>
<!--W3C Schema generated by XMLSPY v2004 rel. 4 (http://www.xmlspy.com)-->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
<xs:element name="definitions">
<xs:complexType>
<xs:sequence>
<xs:element name="message" type="messageType" minOccurs="1" maxOccurs="unbounded"/>
<xs:element name="portType" type="portTypeType" minOccurs="1" maxOccurs="unbounded"/>
<xs:element ref="plnk artnerLinkType" type="plnk artnerLinkTypeType" minOccurs="1" maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute name="targetNamespace" type="xs:string" use="required"/>
<xs:attribute ref="xmlns:xsd" type="xs:string" use="required"/>
<xs:attribute ref="xmlns lnk" type="xs:string" use="required"/>
<xs:attribute ref="xmlns:lns" type="xs:string" use="required"/>
</xs:complexType>
</xs:element>
<xs:complexType name="faultType">
<xs:attribute name="name" use="required">
<xs:simpleType>
<xs:restriction base="xs:NMTOKEN">
<xs:enumeration value="loanProcessFault"/>
<xs:enumeration value="unableToHandleRequest"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="message" type="xs:string" use="required"/>
</xs:complexType>
<xs:complexType name="inputType">
<xs:attribute name="message" type="xs:string" use="required"/>
</xs:complexType>
<xs:complexType name="messageType">
<xs:sequence>
<xs:element name="part" type="partType" minOccurs="1" maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute name="name" use="required">
<xs:simpleType>
<xs:restriction base="xs:NMTOKEN">
<xs:enumeration value="approvalMessage"/>
<xs:enumeration value="creditInformationMessage"/>
<xs:enumeration value="errorMessage"/>
<xs:enumeration value="riskAssessmentMessage"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:complexType>
<xs:complexType name="operationType">
<xs:sequence>
<xs:element name="input" type="inputType"/>
<xs:element name="output" type="outputType"/>
<xs:element name="fault" type="faultType"/>
</xs:sequence>
<xs:attribute name="name" use="required">
<xs:simpleType>
<xs:restriction base="xs:NMTOKEN">
<xs:enumeration value="approve"/>
<xs:enumeration value="check"/>
<xs:enumeration value="request"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:complexType>
<xs:complexType name="outputType">
<xs:attribute name="message" use="required">
<xs:simpleType>
<xs:restriction base="xs:NMTOKEN">
<xs:enumeration value="lns:approvalMessage"/>
<xs:enumeration value="lns:riskAssessmentMessage"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:complexType>
<xs:complexType name="partType">
<xs:attribute name="name" use="required">
<xs:simpleType>
<xs:restriction base="xs:NMTOKEN">
<xs:enumeration value="accept"/>
<xs:enumeration value="amount"/>
<xs:enumeration value="errorCode"/>
<xs:enumeration value="firstName"/>
<xs:enumeration value="level"/>
<xs:enumeration value="name"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="type" use="required">
<xs:simpleType>
<xs:restriction base="xs:NMTOKEN">
<xs:enumeration value="xsd:integer"/>
<xs:enumeration value="xsd:string"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:complexType>
<xs:complexType name="plnk artnerLinkTypeType">
<xs:sequence>
<xs:element name="plnk:role" type="plnk:roleType"/>
</xs:sequence>
<xs:attribute name="name" use="required">
<xs:simpleType>
<xs:restriction base="xs:NMTOKEN">
<xs:enumeration value="loanApprovalLinkType"/>
<xs:enumeration value="loanPartnerLinkType"/>
<xs:enumeration value="riskAssessmentLinkType"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:complexType>
<xs:complexType name="plnk ortTypeType"><--error here-->
<xs:attribute name="name" use="required">
<xs:simpleType>
<xs:restriction base="xs:NMTOKEN">
<xs:enumeration value="lns:loanApprovalPT"/>
<xs:enumeration value="lns:loanServicePT"/>
<xs:enumeration value="lns:riskAssessmentPT"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:complexType>
<xs:complexType name="plnk:roleType">
<xs:sequence>
<xs:element name="plnk ortType" type="plnk ortTypeType"/>
</xs:sequence>
<xs:attribute name="name" use="required">
<xs:simpleType>
<xs:restriction base="xs:NMTOKEN">
<xs:enumeration value="approver"/>
<xs:enumeration value="assessor"/>
<xs:enumeration value="loanService"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:complexType>
<xs:complexType name="portTypeType">
<xs:sequence>
<xs:element name="operation" type="operationType"/>
</xs:sequence>
<xs:attribute name="name" use="required">
<xs:simpleType>
<xs:restriction base="xs:NMTOKEN">
<xs:enumeration value="loanApprovalPT"/>
<xs:enumeration value="loanServicePT"/>
<xs:enumeration value="riskAssessmentPT"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:complexType>
</xs:schema>

when im generating schema im getting the following error

This schema does not apper to be valid by itself(as a part of another schema,it might still be ok)
schema error - name="plnk artnerLinkTypeType" cannot have a namespace prefix.Please remove prefix or use ref= instead!
where it is going wrong.Any help will be highly appreciated.

ManyRegards
Ved
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: schema generation
 
Similar Threads
dynamic attribute definition in xsd
unexpected child element xs:element error??
unble to validate xml against schema
XML valiadation using schema
Unique particle attribution rule bit me - why?