Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

src-resolve.4.2: Error resolving component 1

Status
Not open for further replies.

Hegde11

Programmer
Oct 7, 2008
1
US
Hi,

I am a beginner in XML. I am writing a schema for a XML file. When I validate my schema file with the XML file I am getting the following error
"src-resolve.4.2: Error resolving component 'TaskType'. It was detected that 'TaskType' is in namespace ' but components from this namespace are not referenceable from schema document 'null'. If this is the incorrect namespace, perhaps the prefix of 'TaskType' needs to be changed. If this is the correct namespace, then an appropriate 'import' tag should be added to 'null'."

I feel that it is related to namespace but I am not able to fix the error. Can some one help me with this.

XML file :
<?xml version="1.0" ?>
<!--
This sample schedules a task to start on a bi-weekly basis.
-->
<Task xmlns=" <RegistrationInfo>
<Date>2005-05-01T09:00:00</Date>
<Author>AuthorName</Author>
<Version>1.0.0</Version>
<Description>Notepad starts every other week on Monday at 8:00am.</Description>
</RegistrationInfo>
<Triggers>
<CalendarTrigger>
<StartBoundary>2005-05-02T08:00:00</StartBoundary>
<EndBoundary>2006-01-01T00:00:00</EndBoundary>
<ScheduleByWeek>
<WeeksInterval>2</WeeksInterval>
<DaysOfWeek>
<Monday/>
</DaysOfWeek>
</ScheduleByWeek>
</CalendarTrigger>
</Triggers>
<Principals>
<Principal>
<UserId>Administrator</UserId>
<LogonType>InteractiveToken</LogonType>
</Principal>
</Principals>
<Settings>
<Enabled>true</Enabled>
<AllowStartOnDemand>true</AllowStartOnDemand>
<AllowHardTerminate>true</AllowHardTerminate>
</Settings>
<Actions>
<Exec>
<Command>notepad.exe</Command>
</Exec>
</Actions>
</Task>



Schema File for the above XML file:
<?xml version="1.0" ?>
<xsd:schema targetNamespace="xmlns:xsd = "xmlns="elementFormDefault = "qualified">
<xsd:import id="TaskType" namespace="<xsd:element name="Task" type ="TaskType"/>

<xsd:complexType name="TaskType">
<xsd:sequence>
<xsd:element name="RegistrationInfo" type="RegInfoType"/>
<xsd:element name="Triggers" type="TrigType"/>
<xsd:element name="Principals" type="PrincipalsType"/>
<xsd:element name="Settings" type="SettingsType"/>
<xsd:element name="Actions" type="ActionsType"/>
</xsd:sequence>
</xsd:complexType>


<xsd:complexType name="RegInfoType">
<xsd:sequence>
<xsd:element name="Date" type="xsd:dateTime"/>
<xsd:element name="Author" type="xsd:string"/>
<xsd:element name="Version" type="xsd:string"/>
<xsd:element name="Description" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>

<xsd:complexType name="TrigType">
<xsd:sequence>
<xsd:element name="CalendarTrigger" type="CalTrigType"/>
</xsd:sequence>
</xsd:complexType>

<xsd:complexType name="CalTrigType">
<xsd:sequence>
<xsd:element name="StartBoundary" type="xsd:dateTime"/>
<xsd:element name="EndBoundary" type="xsd:dateTime"/>
<xsd:element name="ScheduleByWeek" type="SchedByWk"/>

</xsd:sequence>
</xsd:complexType>

<xsd:complexType name="SchedByWk">
<xsd:sequence>
<xsd:element name="WeeksInterval" type="xsd:integer"/>
<xsd:element name="DaysOfWeek" type="DayType"/>
</xsd:sequence>
</xsd:complexType>

<xsd:complexType name="DayType">
<xsd:sequence>
<xsd:element name="Monday">
<xsd:complexType>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>

<xsd:complexType name="PrincipalsType">
<xsd:sequence>
<xsd:element name="Principal" type="PrincipalType"/>
</xsd:sequence>
</xsd:complexType>

<xsd:complexType name="PrincipalType">
<xsd:sequence>
<xsd:element name="UserId" type="xsd:string" fixed="Administrator"/>
<xsd:element name="LogonType" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>

<xsd:complexType name="SettingsType">
<xsd:sequence>
<xsd:element name="Enabled" type="xsd:boolean" default="true"/>
<xsd:element name="AllowStartOnDemand" type="xsd:boolean" default="true"/>
<xsd:element name="AllowHardTerminate" type="xsd:boolean" default="true"/>
</xsd:sequence>
</xsd:complexType>


<xsd:complexType name="ActionsType">
<xsd:sequence>
<xsd:element name="Exec" type="ExecType"/>
</xsd:sequence>
</xsd:complexType>

<xsd:complexType name="ExecType">
<xsd:sequence>
<xsd:element name="Command" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>

</xsd:schema>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top