Solved

exception:  must be followed by either attribute specifications, ">" or "/>"

Posted on 2002-07-01
5
1,187 Views
Last Modified: 2013-11-19
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.SchemaParser.parseSchema(SchemaParser.java:122)
at org.enhydra.validation.SchemaParser.<init>(SchemaParser.java:57)
at org.enhydra.validation.Validator.<init>(Validator.java:40)
at org.enhydra.validation.Validator.getInstance(Validator.java:68)
at ValidatorTest.main(ValidatorTest.java: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_type"/>

<xsd:complexType name="historical_weather_type">
  <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="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: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="365"/>
  </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="-100.0"/>
     <xsd:maxInclusiveValue="100.0"/>
  </xsd:element>

  <xsd:element name="minimum_temperature" minOccurs="1" maxOccurs="1">
     <xsd:simpleType base="xsd:decimal">
     <xsd:minInclusiveValue="-100.0"/>
     <xsd:maxInclusiveValue="100.0"/>
  </xsd:element>

  <xsd:element name="average_precipitation" minOccurs="1" maxOccurs="1"/>
     <xsd:simpleType base="xsd:decimal">
     <xsd:minInclusiveValue="0.0"/>
     <xsd:maxInclusiveValue="200.0"/>
  </xsd:element>

</xsd:complexType>

</xsd:schema>
0
Comment
Question by:jdaues
  • 2
  • 2
5 Comments
 
LVL 92

Expert Comment

by:objects
ID: 7123379
All your xsd:simpleType elements aren't terminated correctly eg.:

<xsd:simpleType base="xsd:year">

Should be:

<xsd:simpleType base="xsd:year"/>
0
 

Author Comment

by:jdaues
ID: 7125007
I can see that that is indeed incorrect.
However, even after correcting this, the same error still occurs.
0
 
LVL 92

Expert Comment

by:objects
ID: 7125465
Can you post the updated file.
0
 
LVL 7

Accepted Solution

by:
Igor Bazarny earned 100 total points
ID: 7129930
Hi,

> Line 20 is:
>   <xsd:minInclusiveValue="0"/>
> but that particular line is not really the issue, i suspect.  What is the problem?

As far as I can see, this is incorrect xml. It's posible that there should be whitespace inside minInclusiveValue (before Value?), or another attibute name before '=' sign. It may well be that you mean attribute xsd:minInclusiveValue of enclosing element. In any case error message is correct. Parser sees '=' right after element name.

Regards,
Igor Bazarny,
Brainbench MVP for Java 1
0
 

Author Comment

by:jdaues
ID: 7130041
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_type"/>

<xsd:complexType name="historical_weather_type">
  <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_precipitation" 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>
0

Featured Post

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Opening PDF on button click and fill new document 2 47
ejb entity bean example 2 17
Java syntax, or is it Selenium 6 30
IBM TS2900 (3572) Tape Autoloader Java? 12 19
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question