Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

XML data file (part II)

Posted on 2002-04-15
20
270 Views
Last Modified: 2013-11-19
I have another data file in ascii and want to come up with an XML format

The text file contains a year of daily weather data (365 rows, 7 columns)
The 7 data items for each day are:
monthly day number (1..31), month number (1..12), year, julian day (1..365), max temperature, min temperature, precipitation

I am trying to avoid attributes (for error checking purposes)

Below is the DTD file thus far, and some questions (?????)

Also included here are XML format I came up with (if you have a better one, I'm listening)
and an example of an original text data file.

DTD:

<!-- one year ***************************************************************** -->
<!ELEMENT historical_weather (year)>

<!-- 12 months in a year **************************************************** -->
<! -- there must be a better way ?????????????????????????????????? -->
<!ELEMENT year (month, month, month, month, month, month, month, month, month, month, month, month)>

<!-- 28..31 days in a month **************************************************** -->
<! how to specify that element DAY must appear 28 -31 times???????????????????????? -->
<!ELEMENT month (month_number, day)>
<!ELEMENT month_number (#PCDATA)>
<!ELEMENT day (day_number, julian_day, maximum_temperature, minimum_temperature, average_precipitation)>

<!-- how to specify an range of values, e.g. 1 <= julian_day <= 365 ??????????????????????????-->
<!-- valid range is 1..31 -->
<!ELEMENT day_number (#PCDATA)>
<!-- valid range is 1..365 -->
<!ELEMENT julian_day (#PCDATA)>

<!-- temperature and precipitation will be floating point numbers -->
<!ELEMENT maximum_temperature (#PCDATA)>
<!ELEMENT minimum_temperature (#PCDATA)>
<!ELEMENT average_precipitation (#PCDATA)>


Potential XML format:

<historical_weather>

<year>
   <number>1953</number>

  <month>
    <number>1</number>

    <julian_day>
      <number>1</number>
      <day>1</day>
      <maximum_temperature>10.0</maximum_temperature>
      <minimum_temperature>-1.0</minimum_temperature>
      <average_precipitation>0</average_precipitation>
    </julian_day>

    <julian_day>
      <number>1</number>
      <day>2</day>
      <maximum_temperature>10.0</maximum_temperature>
      <minimum_temperature>-1.0</minimum_temperature>
      <average_precipitation>0</average_precipitation>
      </julian_day>

    <julian_day>
      <number>1</number>
      <day>3</day>
      <maximum_temperature>10.0</maximum_temperature>
      <minimum_temperature>-1.0</minimum_temperature>
      <average_precipitation>0</average_precipitation>
      </julian_day>

    <julian_day>
      <number>1</number>
      <day>4</day>
      <maximum_temperature>10.0</maximum_temperature>
      <minimum_temperature>-1.0</minimum_temperature>
      <average_precipitation>0</average_precipitation>
      </julian_day>

    <julian_day>
      <number>1</number>
      <day>5</day>
      <maximum_temperature>10.0</maximum_temperature>
      <minimum_temperature>-1.0</minimum_temperature>
      <average_precipitation>0</average_precipitation>
      </julian_day>

    <julian_day>
      <number>1</number>
      <day>6</day>
      <maximum_temperature>10.0</maximum_temperature>
      <minimum_temperature>-1.0</minimum_temperature>
      <average_precipitation>0</average_precipitation>
      </julian_day>

    <julian_day>
      <number>1</number>
      <day>7</day>
      <maximum_temperature>10.0</maximum_temperature>
      <minimum_temperature>-1.0</minimum_temperature>
      <average_precipitation>0</average_precipitation>
      </julian_day>

    <julian_day>
      <number>1</number>
      <day>8</day>
      <maximum_temperature>10.0</maximum_temperature>
      <minimum_temperature>-1.0</minimum_temperature>
      <average_precipitation>0</average_precipitation>
      </julian_day>

    <julian_day>
      <number>1</number>
      <day>9</day>
      <maximum_temperature>10.0</maximum_temperature>
      <minimum_temperature>-1.0</minimum_temperature>
      <average_precipitation>0</average_precipitation>
      </julian_day>

    <julian_day>
      <number>1</number>
      <day>10</day>
      <maximum_temperature>10.0</maximum_temperature>
      <minimum_temperature>-1.0</minimum_temperature>
      <average_precipitation>0</average_precipitation>
      </julian_day>

    <julian_day>
      <number>1</number>
      <day>11</day>
      <maximum_temperature>10.0</maximum_temperature>
      <minimum_temperature>-1.0</minimum_temperature>
      <average_precipitation>0</average_precipitation>
      </julian_day>

    <julian_day>
      <number>1</number>
      <day>12</day>
      <maximum_temperature>10.0</maximum_temperature>
      <minimum_temperature>-1.0</minimum_temperature>
      <average_precipitation>0</average_precipitation>
      </julian_day>

    <julian_day>
      <number>1</number>
      <day>13</day>
      <maximum_temperature>10.0</maximum_temperature>
      <minimum_temperature>-1.0</minimum_temperature>
      <average_precipitation>0</average_precipitation>
      </julian_day>

    <julian_day>
      <number>1</number>
      <day>14</day>
      <maximum_temperature>10.0</maximum_temperature>
      <minimum_temperature>-1.0</minimum_temperature>
      <average_precipitation>0</average_precipitation>
      </julian_day>

    <julian_day>
      <number>1</number>
      <day>15</day>
      <maximum_temperature>10.0</maximum_temperature>
      <minimum_temperature>-1.0</minimum_temperature>
      <average_precipitation>0</average_precipitation>
      </julian_day>

    <julian_day>
      <number>1</number>
      <day>16</day>
      <maximum_temperature>10.0</maximum_temperature>
      <minimum_temperature>-1.0</minimum_temperature>
      <average_precipitation>0</average_precipitation>
      </julian_day>

    <julian_day>
      <number>1</number>
      <day>17</day>
      <maximum_temperature>10.0</maximum_temperature>
      <minimum_temperature>-1.0</minimum_temperature>
      <average_precipitation>0</average_precipitation>
      </julian_day>

    <julian_day>
      <number>1</number>
      <day>18</day>
      <maximum_temperature>10.0</maximum_temperature>
      <minimum_temperature>-1.0</minimum_temperature>
      <average_precipitation>0</average_precipitation>
      </julian_day>

    <julian_day>
      <number>1</number>
      <day>19</day>
      <maximum_temperature>10.0</maximum_temperature>
      <minimum_temperature>-1.0</minimum_temperature>
      <average_precipitation>0</average_precipitation>
      </julian_day>

    <julian_day>
      <number>1</number>
      <day>20</day>
      <maximum_temperature>10.0</maximum_temperature>
      <minimum_temperature>-1.0</minimum_temperature>
      <average_precipitation>0</average_precipitation>
      </julian_day>

    <julian_day>
      <number>1</number>
      <day>21</day>
      <maximum_temperature>10.0</maximum_temperature>
      <minimum_temperature>-1.0</minimum_temperature>
      <average_precipitation>0</average_precipitation>
      </julian_day>

    <julian_day>
      <number>1</number>
      <day>22</day>
      <maximum_temperature>10.0</maximum_temperature>
      <minimum_temperature>-1.0</minimum_temperature>
      <average_precipitation>0</average_precipitation>
      </julian_day>

    <julian_day>
      <number>1</number>
      <day>13</day>
      <maximum_temperature>19.0</maximum_temperature>
      <minimum_temperature>-9.0</minimum_temperature>
      <average_precipitation>0</average_precipitation>
      </julian_day>

    <julian_day>
      <number>1</number>
      <day>24</day>
      <maximum_temperature>18.0</maximum_temperature>
      <minimum_temperature>-8.0</minimum_temperature>
      <average_precipitation>0</average_precipitation>
      </julian_day>

    <julian_day>
      <number>1</number>
      <day>25</day>
      <maximum_temperature>17.0</maximum_temperature>
      <minimum_temperature>-7.0</minimum_temperature>
      <average_precipitation>0</average_precipitation>
      </julian_day>

    <julian_day>
      <number>1</number>
      <day>26</day>
      <maximum_temperature>16.0</maximum_temperature>
      <minimum_temperature>-6.0</minimum_temperature>
      <average_precipitation>0</average_precipitation>
      </julian_day>

    <julian_day>
      <number>1</number>
      <day>27</day>
      <maximum_temperature>15.0</maximum_temperature>
      <minimum_temperature>-5.0</minimum_temperature>
      <average_precipitation>0</average_precipitation>
      </julian_day>

    <julian_day>
      <number>1</number>
      <day>28</day>
      <maximum_temperature>14.0</maximum_temperature>
      <minimum_temperature>-4.0</minimum_temperature>
      <average_precipitation>0</average_precipitation>
      </julian_day>

    <julian_day>
      <number>1</number>
      <day>29</day>
      <maximum_temperature>13.0</maximum_temperature>
      <minimum_temperature>-30</minimum_temperature>
      <average_precipitation>0</average_precipitation>
      </julian_day>

    <julian_day>
      <number>1</number>
      <day>30</day>
      <maximum_temperature>12.0</maximum_temperature>
      <minimum_temperature>-3.0</minimum_temperature>
      <average_precipitation>0</average_precipitation>
      </julian_day>

    <julian_day>
      <number>1</number>
      <day>31</day>
      <maximum_temperature>11.0</maximum_temperature>
      <minimum_temperature>-2.0</minimum_temperature>
      <average_precipitation>0</average_precipitation>
      </julian_day>

  </month>

<month>

  <month>
    <number>2</number>

    <julian_day>
      <number>32</number>
      <day>1</day>
      <maximum_temperature>10.0</maximum_temperature>
      <minimum_temperature>-1.0</minimum_temperature>
      <average_precipitation>0</average_precipitation>
    </julian_day>

    <julian_day>
      <number>33</number>
      <day>2</day>
      <maximum_temperature>10.0</maximum_temperature>
      <minimum_temperature>-1.0</minimum_temperature>
      <average_precipitation>0</average_precipitation>
      </julian_day>

      ... and so on

</month>

<month>
... and so on
</month>

<month>
... and so on
</month>

<month>
... and so on
</month>

<month>
... and so on
</month>

<month>
... and so on
</month>

<month>
... and so on
</month>

<month>
... and so on
</month>

<month>
... and so on
</month>

<month>
... and so on
</month>

<month>
... and so on
</month>

</year>
</historical_weather>

Example text file:

1 1 1915 1 14.4 -8.9 0.0
2 1 1915 2 13.3 -3.9 0.0
3 1 1915 3 14.4 -5.0 0.0
4 1 1915 4 12.2 0.6 0.0
5 1 1915 5 12.2 0.0 0.0
6 1 1915 6 8.9 -10.0 0.0
7 1 1915 7 11.1 -7.8 0.0
8 1 1915 8 9.4 -10.0 0.0
9 1 1915 9 11.1 -9.4 0.0
10 1 1915 10 10.5 -9.4 0.0
11 1 1915 11 11.1 -11.1 0.0
12 1 1915 12 9.4 -11.1 0.0
13 1 1915 13 15.5 -4.4 0.0
14 1 1915 14 15.5 -11.1 0.0
15 1 1915 15 12.2 -5.6 0.0
16 1 1915 16 6.1 -7.8 0.0
17 1 1915 17 5.6 -8.3 0.0
18 1 1915 18 6.1 -12.2 0.0
19 1 1915 19 12.2 -11.1 0.0
20 1 1915 20 14.4 -10.0 0.0
21 1 1915 21 15.5 -10.0 0.0
22 1 1915 22 13.9 -0.6 0.0
23 1 1915 23 12.2 -999.0 0.0
24 1 1915 24 3.3 -999.0 0.1
25 1 1915 25 12.2 -6.7 0.0
26 1 1915 26 12.8 -999.0 0.0
27 1 1915 27 8.3 -10.0 0.0
28 1 1915 28 13.9 0.6 0.0
29 1 1915 29 -999.0 -999.0 0.0
30 1 1915 30 14.4 4.4 1.1
31 1 1915 31 13.9 1.1 0.0
1 2 1915 32 13.9 -5.0 0.0
2 2 1915 33 16.7 -3.3 0.0
3 2 1915 34 13.3 5.6 0.0
4 2 1915 35 10.0 -5.6 0.0
5 2 1915 36 7.2 -5.6 0.0
6 2 1915 37 10.5 -11.7 0.0
7 2 1915 38 13.3 -11.1 0.0
<snip>
16 11 1915 320 -999.0 -11.7 0.0
17 11 1915 321 -999.0 -11.7 0.0
18 11 1915 322 -999.0 -11.1 0.0
19 11 1915 323 -999.0 -8.3 0.0
20 11 1915 324 -999.0 -8.9 0.0
21 11 1915 325 -999.0 -3.3 0.0
22 11 1915 326 -999.0 -4.4 0.0
23 11 1915 327 -999.0 -6.1 0.0
24 11 1915 328 -999.0 -3.3 0.0
25 11 1915 329 -999.0 -7.8 0.0
26 11 1915 330 -999.0 -10.0 0.0
27 11 1915 331 -999.0 -1.7 0.0
28 11 1915 332 -999.0 -7.8 0.0
29 11 1915 333 -999.0 -10.5 0.0
30 11 1915 334 -999.0 -9.4 0.0
1 12 1915 335 -999.0 -999.0 0.0
2 12 1915 336 -999.0 -999.0 0.0
3 12 1915 337 -999.0 -999.0 0.0
4 12 1915 338 -999.0 -999.0 0.0
5 12 1915 339 -999.0 -999.0 0.0
6 12 1915 340 -999.0 -999.0 0.0
7 12 1915 341 -999.0 -999.0 0.0
8 12 1915 342 -999.0 -999.0 0.0
9 12 1915 343 -999.0 -999.0 0.0
10 12 1915 344 -999.0 -999.0 0.0
11 12 1915 345 -999.0 -999.0 0.0
12 12 1915 346 -999.0 -999.0 0.0
13 12 1915 347 -999.0 -999.0 0.0
14 12 1915 348 -999.0 -999.0 0.0
15 12 1915 349 -999.0 -999.0 0.0
16 12 1915 350 -999.0 -999.0 0.0
17 12 1915 351 -999.0 -999.0 0.0
18 12 1915 352 -999.0 -999.0 0.0
19 12 1915 353 -999.0 -999.0 0.0
20 12 1915 354 26.6 10.0 0.0
21 12 1915 355 -999.0 -999.0 0.0
22 12 1915 356 -999.0 -999.0 0.0
23 12 1915 357 21.1 4.4 0.0
24 12 1915 358 22.2 5.6 0.0
25 12 1915 359 23.3 14.4 0.0
26 12 1915 360 23.3 16.7 0.0
27 12 1915 361 24.4 17.8 0.0
28 12 1915 362 -999.0 -999.0 0.0
29 12 1915 363 -999.0 -999.0 0.0
30 12 1915 364 -999.0 -999.0 0.0
31 12 1915 365 -999.0 -999.0 0.0

0
Comment
Question by:jdaues
  • 7
  • 4
  • 3
20 Comments
 
LVL 4

Expert Comment

by:edmund_mitchell
ID: 6945465
Hello

Most of the things you want to do can't be done with DTD's, which is one of the reasons why XML Schema (some people prefer the Greek plural Schemata, Websters allows either in English) were invented.

Schema are still somewhat new in terms of what's out there to do the validation.  Let's say you use MSXML or Xerces as your XML parser - they are Schema-aware, so they'll try and validate your doc when they parse it.  

Here is a simple schema that'll do what you want:

<xsd:schema xmlns:xsd="http://www/w3/org/1999/XMLSchema">

<xsd:annotation>
   <xsd:documentation>
      jdaues's Schema 4/16/2002
   </xsd:documentation>
<xsd:annotation>

<xsd:element name="historical_weather" type="his_weath_type"/>

<xsd:complexType name="his_weath_type">
   <xsd:element name="year" type="year_type" maxOccurs="1" minOccurs="1"/>
</xsd:complexType>

<xsd:complexType name="year_type">
   <xsd:element name="number" type="xsd:year" minOccurs="1" maxOccurs="1"/>
<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="j_d_type" minOccurs="28" maxOccurs="31"/>
</xsd:complexType>

<xsd:complexType name="j_d_type">
  <xsd:element name="number" minOccurs="1" maxOccurs="1">
     <xsd:simpleType base="xsd:positiveInteger">
     <xsd:minInclusiveValue="??"/>
     <xsd:maxInclusiveValue="???"/>
  </xsd:element>
  <xsd:element name="day" minOccurs="1" maxOccurs="1">
     <xsd:simpleType base="xsd:positiveInteger">
     <xsd:minInclusiveValue="1"/>
     <xsd:maxInclusiveValue="365"/>
  </xsd:element>
  <xsd:element name="maximum_temperature" type="xsd:decimal" minOccurs="1" maxOccurs="1"/>
   <xsd:element name="minimum_temperature" type="xsd:decimal" minOccurs="1" maxOccurs="1"/>
  <xsd:element name="average_precipitation" type="xsd:decimal" minOccurs="1" maxOccurs="1"/>
</xsd:complexType>

</xsd:schema>

I didn't test this schema - I just typed it during my lunch break, so test it before you put it into production ;>)
Anyways, learn about Schema - they are the present and the future - DTD's were a bad idea from the start.

HTH

Edmund
0
 
LVL 4

Expert Comment

by:edmund_mitchell
ID: 6954445
Hello jdaues

Is everything OK?

Edmund
0
 

Author Comment

by:jdaues
ID: 6956695
Just returned from out of town.
Will get to this during the week.
0
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 

Author Comment

by:jdaues
ID: 6960964
Ok, below is the new xsd file.

If I then create weather.xml like so:

<historical_weather
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="file:weather.xsd">
<year>
   <number>1953</number>

   <month>
    <number>45</number>
...

displaying weather.xml in IE doesn't flag the error "45" (only 1..12 is allowed).  So either the browser doesn't parse xml files defined by a schema (as opposed to a dtd) or my schema is incorrect.  ???


weather.xsd:

<?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
 

Author Comment

by:jdaues
ID: 6971719
edmund_mitchell:
if we can resolve this issue, i will close this question:

either the browser doesn't parse xml files defined by a schema (as opposed to a dtd) or my schema is incorrect.  ???


0
 
LVL 4

Accepted Solution

by:
edmund_mitchell earned 200 total points
ID: 6975701
Well, I'll try one more time.
I think it was the presence of too many tabs for this little text window to handle.
I wrote a schema that I tested for validity, so I know it's valid.
If it isn't strict enough, we can tighten it up, but it's a solid base to build from.
The schema:
<?xml version="1.0" ?>
<xs:schema id="historical_weather" xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
<xs:element name="historical_weather">
<xs:complexType>
<xs:choice maxOccurs="unbounded">
<xs:element name="year" maxOccurs="1" minOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element name="number" minOccurs="1" maxOccurs="1">
<xs:simpleType>
<xs:restriction base="xs:year">
         <xs:minInclusive value="0"/>
         <xs:maxExclusive value="4000"/>
        </xs:restriction>
       </xs:simpleType>
     </xs:element>
<xs:element name="month" minOccurs="12" maxOccurs="12">
<xs:complexType>
<xs:sequence>
<xs:element name="number" minOccurs="1" maxOccurs="12">
<xs:simpleType>
 <xs:restriction base="xs:positiveInteger">
  <xs:minInclusive value="1"/>
  <xs:maxExclusive value="12"/>
</xs:restriction>
     </xs:simpleType>
     </xs:element>
<xs:element name="julian_day" minOccurs="1" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="number" type="xs:string" minOccurs="1">
<xs:simpleType>
            <xs:restriction base="xs:positiveInteger">
            <xs:minInclusive value="1"/>
            <xs:maxExclusive value="365"/>
            </xs:restriction>
            </xs:simpleType>
            </xs:element>
<xs:element name="day"  minOccurs="1">
<xs:simpleType>
            <xs:restriction base="xs:positiveInteger">
            <xs:minInclusive value="1"/>
            <xs:maxExclusive value="31"/>
            </xs:restriction>
 </xs:simpleType>
            </xs:element>
<xs:element name="maximum_temperature" type="xs:decimal" minOccurs="1">
<xs:simpleType>
            <xs:restriction base="xs:decimal">
            <xs:minInclusive value="-100.0"/>
            <xs:maxExclusive value="100.0"/>
            </xs:restriction>
            </xs:simpleType>
            </xs:element>
<xs:element name="minimum_temperature" type="xs:decimal" minOccurs="1">
<xs:simpleType>
            <xs:restriction base="xs:decimal">
            <xs:minInclusive value="-100.0"/>
            <xs:maxExclusive value="100.0"/>
            </xs:restriction>
            </xs:simpleType>
            </xs:element>
<xs:element name="average_precipitation" type="xs:decimal" minOccurs="1">
<xs:simpleType>
            <xs:restriction base="xs:decimal">
            <xs:minInclusive value="0.0"/>
            <xs:maxExclusive value="200.0"/>
            </xs:restriction>
            </xs:simpleType>
            </xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
</xs:element>
</xs:schema>


Let me know how it goes

Edmund
0
 

Author Comment

by:jdaues
ID: 6978285
I tried your version.

1. I have the same issue, displaying weather.xml in IE doesn't flag the error with value of "45" for <month>

2. I noticed you changed, for example, my line:
<xsd:element name="maximum_temperature" minOccurs="1" maxOccurs="1">
to:
<xs:element name="maximum_temperature" type="xs:decimal" minOccurs="1">

that is you removed maxOccurs="1", is there a reason for this?


0
 
LVL 4

Expert Comment

by:edmund_mitchell
ID: 6978431
Hello jdaues
It was a typing omission - no reason to exclude it.
Also, I noticed that I made a logic error through overuse of cut and paste
lots of
xs:maxExclusive value="whatever"
should be changed to maxInclusives or should have the maxExclusive value bumped up one - for example - the months, you want 1-12 inclusive, right?
Speaking of months, when you say the month was 45, do you mean the number child of the month element?

Edmund
0
 

Author Comment

by:jdaues
ID: 6978693
>>Speaking of months, when you say the month was 45,
>>do you mean the number child of the month element?
Yes, legal values are 1..12 inclusive.
So
  <month>
   <number>45</number>
is not valid.

0
 
LVL 1

Expert Comment

by:Moondancer
ID: 6978753
I have deleted the "no text" comments and my workaround as well to minimize load time on this question thread.
Moondancer - EE Moderator
0
 

Author Comment

by:jdaues
ID: 6999689
Edmund,

Again, if we can resolve this issue, i will close this question:

either the browser doesn't parse xml files defined by a schema (as opposed to a dtd) or the schema is incorrect.  

<month>
  <number>45</number>
0
 
LVL 1

Expert Comment

by:Moondancer
ID: 7037778
Listening for finalization.  Moondancer - EE Moderator
0
 

Author Comment

by:jdaues
ID: 7037860
Moondancer, waiting for Edmund...
0
 
LVL 1

Expert Comment

by:Moondancer
ID: 7073950
Unfortunately, I note that Edmund has not logged in since 5/5/2002; perhaps on holiday?
Moondancer - EE Moderator
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Problem to page 4 93
split XML field into many fields from MS Access 21 44
VB.Net. Reading xml value 6 30
Why is PHP Storm giving me an undefined constant error? 4 20
Most of the sites are being standardized with W3C Web Standards. W3C provides lot of web standard services to the web. They have the web specification, process and documentation for all the web standards. You can apply HTML, CSS and Accessibility st…
JavaScript has plenty of pieces of code people often just copy/paste from somewhere but never quite fully understand. Self-Executing functions are just one good example that I'll try to demystify here.
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

829 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