You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by Benson Cheng <Be...@viacore.net> on 2002/03/22 18:35:41 UTC

How to write this DTD to a schema?

I am having some problems convert the following DTD to a schema, 

<!ELEMENT Preamble ( 
          standardName ,
          standardVersion ) > 

<!ATTLIST Preamble xmlns CDATA #FIXED
          "http://www.rosettanet.org/RNIF/V02.00" >

<!ELEMENT standardName
           ( GlobalAdministeringAuthorityCode ) > 

<!ELEMENT GlobalAdministeringAuthorityCode
           ( #PCDATA ) >

<!ELEMENT standardVersion
           ( VersionIdentifier ) > 

<!ELEMENT VersionIdentifier
           ( #PCDATA ) >

I don't know how to create write the "xmlns" attribute of the Preamble
element, Xerces complaints about the xmlns as the attribute name, can any
one help me write this schema?

	<xsd:element name="Preamble">
		<xsd:complexType>
			<xsd:sequence>
				<xsd:element ref="standardName"
maxOccurs="1" minOccurs="1"/>
				<xsd:element ref="standardVersion"
maxOccurs="1" minOccurs="1"/>
			</xsd:sequence>
			<xsd:attribute name="xmlns"
fixed="http://www.rosettanet.org/RNIF/V02.00">
			</xsd:attribute>
		</xsd:complexType>
	</xsd:element>

Thanks,
Benson.

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org


Re: How to write this DTD to a schema?

Posted by Andy Clark <an...@apache.org>.
Benson Cheng wrote:
> I am having some problems convert the following DTD to a schema,
> 
> <!ELEMENT Preamble (
>           standardName ,
>           standardVersion ) >
> 
> <!ATTLIST Preamble xmlns CDATA #FIXED
>           "http://www.rosettanet.org/RNIF/V02.00" >

XML Schemas are namespace aware grammars. Therefore, you
don't have to explicitly set a namespace attribute in your
Schema grammar. Instead, just specify the target namespace
for the elements you're going to declare. For example:

  <xsd:schema xmlns:xsd='http://www.w3.org/2001/XMLSchema'
              targetNamespace='http://www.rosettanet.org/RNIF/V02.00'>

And then remove the explicit default attribute for the
namespace binding.

-- 
Andy Clark * andyc@apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org