Hi guys, keep getting an error: Cannot find the deceleration of element test when writing the xml. I have declared the element test in the schema but it appears to ignore it.

The schema is as follows:

<?xml version="1.0" encoding="UTF-8"?>

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">

<xs:element name="Test"/>
    
<xs:simpleType name="Stringtype">   
    <xs:restriction base="xs:string"/>
</xs:simpleType>
    
<xs:simpleType name="Yeartype">   
    <xs:restriction base="xs:integer">
        <xs:pattern value="[0-9][0-9][0-9][0-9]"/>
    </xs:restriction>
</xs:simpleType>

<xs:simpleType name="Inttype">   
        <xs:restriction base="xs:positiveInteger"/>
</xs:simpleType>
    
<xs:simpleType name="Pagetype">
    <xs:restriction base="xs:string">
        <xs:pattern value="([0-9])*--([0-9])*"/>
    </xs:restriction>
</xs:simpleType>
  
<xs:simpleType name="Datetype">   
    <xs:restriction base="xs:date"/>
</xs:simpleType>
    
<xs:element name="Top" type="Stringtype"/>    
    
<xs:element name="Author" type="Stringtype"/>
    
<xs:complexType name="Titles">
    <xs:sequence>
        <xs:element name="Title" type="Stringtype"/>
        <xs:element name="BookTitle" type="Stringtype" minOccurs="0"/>
    </xs:sequence>
</xs:complexType>

<xs:complexType name="Journal">
    <xs:sequence>
        <xs:element name="Journal" type="Stringtype" minOccurs="0"/>
    </xs:sequence>
</xs:complexType>

<xs:complexType name="Publication">
        <xs:sequence>
            <xs:element name="Year" type="Yeartype"/>
            <xs:element name="Volume" type="Inttype" minOccurs="0"/>
        </xs:sequence>
</xs:complexType>
    
<xs:element name="Pages" type="Pagetype"/>
    
<xs:complexType name="Number">
    <xs:sequence>
        <xs:element name="Number" type="Inttype" minOccurs="0"/>
    </xs:sequence>
</xs:complexType>
    
<xs:element name="Month" type="Stringtype"/>
    
<xs:element name="DOI" type="Stringtype"/>
    
<xs:element name="Owner" type="Stringtype"/>
    
<xs:element name="Timestamp" type="Datetype"/>
    
</xs:schema>

The XML is:

<?xml version="1.0" encoding="UTF-8"?>

<Test xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="Schema.xsd">
        
    <Top>Allen2005</Top>    
    
    <Author>Allen, G. and Davis, K. and Goodale, T. and Hutanu, A. and Kaiser,
        H. and Kielmann, T. and Merzky, A. and van Nieuwpoort, R. and Reinefeld,
        A. and Schintke, F. and Schott, T. and Seidel, E. and Ullmer, B.</Author>
    
    <Title>The grid application toolkit: toward generic and easy application
    programming interfaces for the grid</Title>
    
    <Journal>Proceedings of the IEEE</Journal>
    
    <Year>2005</Year>
    
    <Volume>93</Volume>
    
    <Pages>534--550</Pages>
    
    <Number>3</Number>
    
    <Month>Mar</Month>
    
    <DOI>10.1109/JPROC.2004.842755</DOI>
</Test>

Any help would go a long way.

I tried with two parsers and got no error. You could try with Kernow IDE (freeware from Saxonica.com).

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.