No Schema or DTD associated....

This should cover W3C XML Schema, Relax NG and DTD related problems.
sb1993cl
Posts: 2

No Schema or DTD associated....

Mon Nov 03, 2014 7:30 am

Hi all,

I am trying to validate my xml schema and it's not working. The error that keeps coming up is "There is no schema or DTD associated with this document..." I am trying to validate it against an xsd document. This is for a project at my university and I am in the process of learning xml, but I can't get past this. Please help me! Many many thanks in return!

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="PoliticalLeader.xsd" media="screen"?>
<report> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   <report>Tracking Report</report>
   <Country>
      <countryname>Pakistan</countryname>
      <Leader>
         <leadername>Nawaz Sharif</leadername>
         <role>Prime Minister</role>
         <party >Democratic Islamic Party </party>
         <Messge>
            <messageid>1</messageid>
            <code>3</code>
            <info>Build more parks inside Pakistan to improve conditions </info>
         </Messge>
      </Leader>
   </Country>
   <Country>
      <countryname>United States</countryname>
      <Leader>
         <leadername>Condoleeza Rice</leadername>
         <role>Secretary of State</role>
         <party>Republican Party</party>
         <Messge>
            <messageid>2</messageid>
            <code>1</code>
            <info>Making more parks won’t help any living conditions and it is pointless to do so. </info>
         </Messge>
         <Messge>
            <messageid>3</messageid>
            <code>2</code>
            <info>Fund Pakistan’s plan to build more parks in their country </info>
         </Messge>
      </Leader>
   </Country>
</report>
adrian
Posts: 2443

Re: No Schema or DTD associated....

Mon Nov 03, 2014 11:07 am

Hi,

It looks like you've accidentally associated the schema as a stylesheet instead of a schema.
You must associate a schema with your document: menu > Document > Schema > Associate Schema and browse for the schema. The schema type will be automatically detected and selected in the combo. This will specify the schema URI and namespace on the root of the XML document.
e.g.

Code: Select all

<report xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:noNamespaceSchemaLocation="PoliticalLeader.xsd">

Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com

Return to “XML Schemas”

Who is online

Users browsing this forum: No registered users and 0 guests