jdaues
asked on
exception: must be followed by either attribute specifications, ">" or "/>"
I get this error when trying to validate an xsd file:
java.io.IOException: Problems occurred:Error on line 20 of document file:/G:/Data/xml/weather2 .xsd: Element type "xsd:minInclusiveValue" must be followed by either attribute specifications, ">" or "/>".
at org.enhydra.validation.Sch emaParser. parseSchem a(SchemaPa rser.java: 122)
at org.enhydra.validation.Sch emaParser. <init>(Sch emaParser. java:57)
at org.enhydra.validation.Val idator.<in it>(Valida tor.java:4 0)
at org.enhydra.validation.Val idator.get Instance(V alidator.j ava:68)
at ValidatorTest.main(Validat orTest.jav a:18)
Line 20 is:
<xsd:minInclusiveValue="0" />
but that particular line is not really the issue, i suspect. What is the problem?
weather2.xsd is:
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www/w3/org/1999/XMLSchema">
<xsd:annotation>
<xsd:documentation>
Weather Data Schema 4/16/2002
</xsd:documentation>
<xsd:annotation>
<xsd:element name="historical_weather" type="historical_weather_t ype"/>
<xsd:complexType name="historical_weather_t ype">
<xsd:element name="year" type="year_type" maxOccurs="1" minOccurs="1"/>
</xsd:complexType>
<xsd:complexType name="year_type">
<xsd:element name="number" minOccurs="1" maxOccurs="1">
<xsd:simpleType base="xsd:year">
<xsd:minInclusiveValue="0" />
<xsd:maxInclusiveValue="40 00"/>
</xsd:element>
<xsd:element name="month" type="month_type" minOccurs="12" maxOccurs="12"/>
</xsd:complexType>
<xsd:complexType name="month_type">
<xsd:element name="number" minOccurs="1" maxOccurs="1">
<xsd:simpleType base="xsd:positiveInteger" >
<xsd:minInclusiveValue="1" />
<xsd:maxInclusiveValue="12 "/>
</xsd:element>
<xsd:element name="julian_day" type="julian_day_type" minOccurs="28" maxOccurs="31"/>
</xsd:complexType>
<xsd:complexType name="julian_day_type">
<xsd:element name="number" minOccurs="1" maxOccurs="1">
<xsd:simpleType base="xsd:positiveInteger" >
<xsd:minInclusiveValue="1" />
<xsd:maxInclusiveValue="36 5"/>
</xsd:element>
<xsd:element name="day" minOccurs="1" maxOccurs="1">
<xsd:simpleType base="xsd:positiveInteger" >
<xsd:minInclusiveValue="1" />
<xsd:maxInclusiveValue="31 "/>
</xsd:element>
<xsd:element name="maximum_temperature" minOccurs="1" maxOccurs="1">
<xsd:simpleType base="xsd:decimal">
<xsd:minInclusiveValue="-1 00.0"/>
<xsd:maxInclusiveValue="10 0.0"/>
</xsd:element>
<xsd:element name="minimum_temperature" minOccurs="1" maxOccurs="1">
<xsd:simpleType base="xsd:decimal">
<xsd:minInclusiveValue="-1 00.0"/>
<xsd:maxInclusiveValue="10 0.0"/>
</xsd:element>
<xsd:element name="average_precipitatio n" minOccurs="1" maxOccurs="1"/>
<xsd:simpleType base="xsd:decimal">
<xsd:minInclusiveValue="0. 0"/>
<xsd:maxInclusiveValue="20 0.0"/>
</xsd:element>
</xsd:complexType>
</xsd:schema>
java.io.IOException: Problems occurred:Error on line 20 of document file:/G:/Data/xml/weather2
at org.enhydra.validation.Sch
at org.enhydra.validation.Sch
at org.enhydra.validation.Val
at org.enhydra.validation.Val
at ValidatorTest.main(Validat
Line 20 is:
<xsd:minInclusiveValue="0"
but that particular line is not really the issue, i suspect. What is the problem?
weather2.xsd is:
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www/w3/org/1999/XMLSchema">
<xsd:annotation>
<xsd:documentation>
Weather Data Schema 4/16/2002
</xsd:documentation>
<xsd:annotation>
<xsd:element name="historical_weather" type="historical_weather_t
<xsd:complexType name="historical_weather_t
<xsd:element name="year" type="year_type" maxOccurs="1" minOccurs="1"/>
</xsd:complexType>
<xsd:complexType name="year_type">
<xsd:element name="number" minOccurs="1" maxOccurs="1">
<xsd:simpleType base="xsd:year">
<xsd:minInclusiveValue="0"
<xsd:maxInclusiveValue="40
</xsd:element>
<xsd:element name="month" type="month_type" minOccurs="12" maxOccurs="12"/>
</xsd:complexType>
<xsd:complexType name="month_type">
<xsd:element name="number" minOccurs="1" maxOccurs="1">
<xsd:simpleType base="xsd:positiveInteger"
<xsd:minInclusiveValue="1"
<xsd:maxInclusiveValue="12
</xsd:element>
<xsd:element name="julian_day" type="julian_day_type" minOccurs="28" maxOccurs="31"/>
</xsd:complexType>
<xsd:complexType name="julian_day_type">
<xsd:element name="number" minOccurs="1" maxOccurs="1">
<xsd:simpleType base="xsd:positiveInteger"
<xsd:minInclusiveValue="1"
<xsd:maxInclusiveValue="36
</xsd:element>
<xsd:element name="day" minOccurs="1" maxOccurs="1">
<xsd:simpleType base="xsd:positiveInteger"
<xsd:minInclusiveValue="1"
<xsd:maxInclusiveValue="31
</xsd:element>
<xsd:element name="maximum_temperature"
<xsd:simpleType base="xsd:decimal">
<xsd:minInclusiveValue="-1
<xsd:maxInclusiveValue="10
</xsd:element>
<xsd:element name="minimum_temperature"
<xsd:simpleType base="xsd:decimal">
<xsd:minInclusiveValue="-1
<xsd:maxInclusiveValue="10
</xsd:element>
<xsd:element name="average_precipitatio
<xsd:simpleType base="xsd:decimal">
<xsd:minInclusiveValue="0.
<xsd:maxInclusiveValue="20
</xsd:element>
</xsd:complexType>
</xsd:schema>
ASKER
I can see that that is indeed incorrect.
However, even after correcting this, the same error still occurs.
However, even after correcting this, the same error still occurs.
Can you post the updated file.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
valid xsd file is:
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www/w3/org/1999/XMLSchema">
<xsd:annotation>
<xsd:documentation>
Weather Data Schema 4/16/2002
</xsd:documentation>
</xsd:annotation>
<xsd:element name="historical_weather" type="historical_weather_t ype"/>
<xsd:complexType name="historical_weather_t ype">
<xsd:element name="year" type="year_type" maxOccurs="1" minOccurs="1"/>
</xsd:complexType>
<xsd:complexType name="year_type">
<xsd:element name="number" minOccurs="1" maxOccurs="1">
<xsd:simpleType base="xsd:year"/>
<xsd:minInclusive Value="0"/>
<xsd:maxInclusive Value="4000"/>
</xsd:element>
<xsd:element name="month" type="month_type" minOccurs="12" maxOccurs="12"/>
</xsd:complexType>
<xsd:complexType name="month_type">
<xsd:element name="number" minOccurs="1" maxOccurs="1">
<xsd:simpleType base="xsd:positiveInteger" />
<xsd:minInclusive Value="1"/>
<xsd:maxInclusive Value="12"/>
</xsd:element>
<xsd:element name="julian_day" type="julian_day_type" minOccurs="28" maxOccurs="31"/>
</xsd:complexType>
<xsd:complexType name="julian_day_type">
<xsd:element name="number" minOccurs="1" maxOccurs="1">
<xsd:simpleType base="xsd:positiveInteger" />
<xsd:minInclusive Value="1"/>
<xsd:maxInclusive Value="365"/>
</xsd:element>
<xsd:element name="day" minOccurs="1" maxOccurs="1">
<xsd:simpleType base="xsd:positiveInteger" />
<xsd:minInclusive Value="1"/>
<xsd:maxInclusive Value="31"/>
</xsd:element>
<xsd:element name="maximum_temperature" minOccurs="1" maxOccurs="1">
<xsd:simpleType base="xsd:decimal"/>
<xsd:minInclusive Value="-100.0"/>
<xsd:maxInclusive Value="100.0"/>
</xsd:element>
<xsd:element name="minimum_temperature" minOccurs="1" maxOccurs="1">
<xsd:simpleType base="xsd:decimal"/>
<xsd:minInclusive Value="-100.0"/>
<xsd:maxInclusive Value="100.0"/>
</xsd:element>
<xsd:element name="average_precipitatio n" minOccurs="1" maxOccurs="1">
<xsd:simpleType base="xsd:decimal"/>
<xsd:minInclusive Value="0.0"/>
<xsd:maxInclusive Value="200.0"/>
</xsd:element>
</xsd:complexType>
</xsd:schema>
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www/w3/org/1999/XMLSchema">
<xsd:annotation>
<xsd:documentation>
Weather Data Schema 4/16/2002
</xsd:documentation>
</xsd:annotation>
<xsd:element name="historical_weather" type="historical_weather_t
<xsd:complexType name="historical_weather_t
<xsd:element name="year" type="year_type" maxOccurs="1" minOccurs="1"/>
</xsd:complexType>
<xsd:complexType name="year_type">
<xsd:element name="number" minOccurs="1" maxOccurs="1">
<xsd:simpleType base="xsd:year"/>
<xsd:minInclusive Value="0"/>
<xsd:maxInclusive Value="4000"/>
</xsd:element>
<xsd:element name="month" type="month_type" minOccurs="12" maxOccurs="12"/>
</xsd:complexType>
<xsd:complexType name="month_type">
<xsd:element name="number" minOccurs="1" maxOccurs="1">
<xsd:simpleType base="xsd:positiveInteger"
<xsd:minInclusive Value="1"/>
<xsd:maxInclusive Value="12"/>
</xsd:element>
<xsd:element name="julian_day" type="julian_day_type" minOccurs="28" maxOccurs="31"/>
</xsd:complexType>
<xsd:complexType name="julian_day_type">
<xsd:element name="number" minOccurs="1" maxOccurs="1">
<xsd:simpleType base="xsd:positiveInteger"
<xsd:minInclusive Value="1"/>
<xsd:maxInclusive Value="365"/>
</xsd:element>
<xsd:element name="day" minOccurs="1" maxOccurs="1">
<xsd:simpleType base="xsd:positiveInteger"
<xsd:minInclusive Value="1"/>
<xsd:maxInclusive Value="31"/>
</xsd:element>
<xsd:element name="maximum_temperature"
<xsd:simpleType base="xsd:decimal"/>
<xsd:minInclusive Value="-100.0"/>
<xsd:maxInclusive Value="100.0"/>
</xsd:element>
<xsd:element name="minimum_temperature"
<xsd:simpleType base="xsd:decimal"/>
<xsd:minInclusive Value="-100.0"/>
<xsd:maxInclusive Value="100.0"/>
</xsd:element>
<xsd:element name="average_precipitatio
<xsd:simpleType base="xsd:decimal"/>
<xsd:minInclusive Value="0.0"/>
<xsd:maxInclusive Value="200.0"/>
</xsd:element>
</xsd:complexType>
</xsd:schema>
<xsd:simpleType base="xsd:year">
Should be:
<xsd:simpleType base="xsd:year"/>