Thanks for the reply, Keith. Yes, I was using a 3-rd party tool called dtd2xs to generate schema from my dtd. and here is the generated xsd:
<?xml version="1.0"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:element name="go:go"> <xs:complexType> <xs:sequence> <xs:element minOccurs="0" ref="go:version" /> <xs:element ref="rdf:RDF" /> </xs:sequence> <xs:attribute ref="xmlns:go" fixed="http://www.geneontology.org/dtds/go.dtd#" /> <xs:attribute ref="xmlns:rdf" fixed="http://www.w3.org/1999/02/22-rdf-syntax-ns#" /> </xs:complexType> </xs:element> <xs:element name="go:version"> <xs:complexType> <xs:simpleContent> <xs:extension base="xs:string"> <xs:attribute name="timestamp" type="xs:string" /> </xs:extension> </xs:simpleContent> </xs:complexType> </xs:element> <xs:element name="rdf:RDF"> <xs:complexType> <xs:sequence> <xs:element minOccurs="0" maxOccurs="unbounded" ref="go:term" /> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="go:term"> <xs:complexType> <xs:sequence> <xs:element ref="go:name" /> <xs:element minOccurs="0" maxOccurs="unbounded" ref="go:part_of" /> </xs:sequence> <xs:attribute ref="rdf:about" use="required" /> </xs:complexType> </xs:element> <xs:element name="go:name" type="xs:string" /> <xs:element name="go:part_of"> <xs:complexType> <xs:simpleContent> <xs:extension base="xs:string"> <xs:attribute ref="rdf:resource" use="required" /> </xs:extension> </xs:simpleContent> </xs:complexType> </xs:element> </xs:schema> I just tried org.exolab.castor.xml.dtd.Converter with my dtd, and it complained about the dtd, saying java.lang.IllegalArgumentException: error: 'rdf:RDF' is not a valid NCName. Thanks for your continued advice. Jing > > Jing, > > Castor's source generator uses XML Schema (see W3C XML Schema 1.0 > Recommendation) for creating source code, not DTDs. You'll need to > convert your DTD to an XML Schema before the source generator will be > able to generate any source code for it. > > Castor has a tool (org.exolab.castor.xml.dtd.Converter) that can help > you. There are also a number of 3rd party tools that can convert DTDs to > XML Schema. > > --Keith > > [EMAIL PROTECTED] wrote: >> >> We really need help with this problem that I've posted earlier! and to >> make it easier for you to identify the problem, i've minimized the dtd >> as >> the following: >> >> ################################################################## >> >> ENTITY parseType "CDATA #FIXED 'Resource'" >> >> ELEMENT go:go ( > go:version?, >> rdf:RDF >> )> >> >> ATTLIST go:go > xmlns:go CDATA #FIXED >> "http://www.geneontology.org/dtds/go.dtd#" >> xmlns:rdf CDATA #FIXED >> "http://www.w3.org/1999/02/22-rdf-syntax-ns#" >> > >> >> ELEMENT go:version (#PCDATA) >> >> ATTLIST go:version > timestamp CDATA #IMPLIED >> > >> >> ELEMENT rdf:RDF (go:term*) >> >> ELEMENT go:term ( > go:name, >> go:part_of* >> )> >> >> ATTLIST go:term > rdf:about CDATA #REQUIRED >> > >> >> ELEMENT go:name (#PCDATA) >> >> ELEMENT go:part_of (#PCDATA) >> ATTLIST go:part_of > rdf:resource CDATA #REQUIRED >> > >> ######################################################################### >> >> with this dtd, I wasn't able to get any generated source, but only got >> Exception in thread "main" java.lang.IllegalArgumentException: >> getElementDecl: Namespace prefix not recognized 'go' >> >> [java] at >> org.exolab.castor.xml.schema.Schema.getElementDecl(Unknown Source) >> [java] at >> org.exolab.castor.xml.schema.ElementDecl.getReference(Unknown Source) >> [java] at >> org.exolab.castor.xml.schema.ElementDecl.getType(Unknown Source) >> [java] at >> org.exolab.castor.builder.SourceFactory.processContentModel(Unknown >> Source) >> [java] at >> org.exolab.castor.builder.SourceFactory.processContentModel(Unknown >> Source) >> [java] at >> org.exolab.castor.builder.SourceFactory.processComplexType(Unknown >> Source) >> [java] at >> org.exolab.castor.builder.SourceFactory.createSourceCode(Unknown >> Source) >> [java] at >> org.exolab.castor.builder.SourceGenerator.createClasses(Unknown >> Source) >> [java] at >> org.exolab.castor.builder.SourceGenerator.createClasses(Unknown >> Source) >> [java] at >> org.exolab.castor.builder.SourceGenerator.generateSource(Unknown >> Source) >> [java] at >> org.exolab.castor.builder.SourceGenerator.generateSource(Unknown >> Source) >> [java] at >> org.exolab.castor.builder.SourceGenerator.generateSource(Unknown >> Source) >> [java] at >> org.exolab.castor.builder.SourceGenerator.main(Unknown >> Source) >> >> Is this way to declare namespace acceptable to Castor? Will it matter >> that >> it uses two identical "go", one as the prefix and the other as the >> element >> name? Any suggestions will be greatly appreciated! >> >> Thanks! >> Jing >> >> ----------------------------------------------------------- >> If you wish to unsubscribe from this mailing, send mail to >> [EMAIL PROTECTED] with a subject of: >> unsubscribe castor-dev > > ----------------------------------------------------------- > If you wish to unsubscribe from this mailing, send mail to > [EMAIL PROTECTED] with a subject of: > unsubscribe castor-dev > ----------------------------------------------------------- If you wish to unsubscribe from this mailing, send mail to [EMAIL PROTECTED] with a subject of: unsubscribe castor-dev
