<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ru">
		<id>http://www.jexp.ru/index.php?action=history&amp;feed=atom&amp;title=Java_Tutorial%2FXML%2FXML_Schema</id>
		<title>Java Tutorial/XML/XML Schema - История изменений</title>
		<link rel="self" type="application/atom+xml" href="http://www.jexp.ru/index.php?action=history&amp;feed=atom&amp;title=Java_Tutorial%2FXML%2FXML_Schema"/>
		<link rel="alternate" type="text/html" href="http://www.jexp.ru/index.php?title=Java_Tutorial/XML/XML_Schema&amp;action=history"/>
		<updated>2026-04-18T20:24:53Z</updated>
		<subtitle>История изменений этой страницы в вики</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>http://www.jexp.ru/index.php?title=Java_Tutorial/XML/XML_Schema&amp;diff=5086&amp;oldid=prev</id>
		<title>Admin: 1 версия</title>
		<link rel="alternate" type="text/html" href="http://www.jexp.ru/index.php?title=Java_Tutorial/XML/XML_Schema&amp;diff=5086&amp;oldid=prev"/>
				<updated>2010-06-01T05:17:35Z</updated>
		
		<summary type="html">&lt;p&gt;1 версия&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr style=&quot;vertical-align: top;&quot; lang=&quot;ru&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Предыдущая&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Версия 05:17, 1 июня 2010&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; style=&quot;text-align: center;&quot; lang=&quot;ru&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(нет различий)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	<entry>
		<id>http://www.jexp.ru/index.php?title=Java_Tutorial/XML/XML_Schema&amp;diff=5085&amp;oldid=prev</id>
		<title> в 17:44, 31 мая 2010</title>
		<link rel="alternate" type="text/html" href="http://www.jexp.ru/index.php?title=Java_Tutorial/XML/XML_Schema&amp;diff=5085&amp;oldid=prev"/>
				<updated>2010-05-31T17:44:27Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Новая страница&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==  Create XML validator from XML schema ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
import javax.xml.transform.stream.StreamSource;&lt;br /&gt;
import javax.xml.validation.Schema;&lt;br /&gt;
import javax.xml.validation.SchemaFactory;&lt;br /&gt;
import javax.xml.validation.Validator;&lt;br /&gt;
public class Main {&lt;br /&gt;
  public static void main(String[] argv) throws Exception {&lt;br /&gt;
    String schemaLang = &amp;quot;http://www.w3.org/2001/XMLSchema&amp;quot;;&lt;br /&gt;
    SchemaFactory factory = SchemaFactory.newInstance(schemaLang);&lt;br /&gt;
    Schema schema = factory.newSchema(new StreamSource(&amp;quot;sample.xsd&amp;quot;));&lt;br /&gt;
    Validator validator = schema.newValidator();&lt;br /&gt;
    validator.validate(new StreamSource(&amp;quot;sample.xml&amp;quot;));&lt;br /&gt;
  }&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==  JAXP 1.3 Datatype API ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
 * Licensed to the Apache Software Foundation (ASF) under one or more&lt;br /&gt;
 * contributor license agreements.  See the NOTICE file distributed with&lt;br /&gt;
 * this work for additional information regarding copyright ownership.&lt;br /&gt;
 * The ASF licenses this file to You under the Apache License, Version 2.0&lt;br /&gt;
 * (the &amp;quot;License&amp;quot;); you may not use this file except in compliance with&lt;br /&gt;
 * the License.  You may obtain a copy of the License at&lt;br /&gt;
 * &lt;br /&gt;
 *      http://www.apache.org/licenses/LICENSE-2.0&lt;br /&gt;
 * &lt;br /&gt;
 * Unless required by applicable law or agreed to in writing, software&lt;br /&gt;
 * distributed under the License is distributed on an &amp;quot;AS IS&amp;quot; BASIS,&lt;br /&gt;
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.&lt;br /&gt;
 * See the License for the specific language governing permissions and&lt;br /&gt;
 * limitations under the License.&lt;br /&gt;
 */&lt;br /&gt;
import javax.xml.datatype.DatatypeConfigurationException;&lt;br /&gt;
import javax.xml.datatype.DatatypeConstants;&lt;br /&gt;
import javax.xml.datatype.DatatypeFactory;&lt;br /&gt;
import javax.xml.datatype.Duration;&lt;br /&gt;
import javax.xml.datatype.XMLGregorianCalendar;&lt;br /&gt;
/**&lt;br /&gt;
 * &amp;lt;p&amp;gt;&lt;br /&gt;
 * A sample which demonstrates usage of the JAXP 1.3 Datatype API.&lt;br /&gt;
 * &amp;lt;/p&amp;gt;&lt;br /&gt;
 * &lt;br /&gt;
 * @version $Id: DatatypeAPIUsage.java 447685 2006-09-19 02:37:49Z mrglavas $&lt;br /&gt;
 */&lt;br /&gt;
public class DatatypeAPIUsage {&lt;br /&gt;
  public static void main(String[] args) {&lt;br /&gt;
    try {&lt;br /&gt;
      DatatypeFactory df = DatatypeFactory.newInstance();&lt;br /&gt;
      // my work number in milliseconds:&lt;br /&gt;
      Duration myPhone = df.newDuration(9054133519l);&lt;br /&gt;
      Duration myLife = df.newDuration(true, 29, 2, 15, 13, 45, 0);&lt;br /&gt;
      int compareVal = myPhone.rupare(myLife);&lt;br /&gt;
      switch (compareVal) {&lt;br /&gt;
      case DatatypeConstants.LESSER:&lt;br /&gt;
        System.out.println(&amp;quot;There are fewer milliseconds in my phone number than my lifespan.&amp;quot;);&lt;br /&gt;
        break;&lt;br /&gt;
      case DatatypeConstants.EQUAL:&lt;br /&gt;
        System.out&lt;br /&gt;
            .println(&amp;quot;The same number of milliseconds are in my phone number and my lifespan.&amp;quot;);&lt;br /&gt;
        break;&lt;br /&gt;
      case DatatypeConstants.GREATER:&lt;br /&gt;
        System.out.println(&amp;quot;There are more milliseconds in my phone number than my lifespan.&amp;quot;);&lt;br /&gt;
        break;&lt;br /&gt;
      case DatatypeConstants.INDETERMINATE:&lt;br /&gt;
        System.out.println(&amp;quot;The comparison could not be carried out.&amp;quot;);&lt;br /&gt;
      }&lt;br /&gt;
      // create a yearMonthDuration&lt;br /&gt;
      Duration ymDuration = df.newDurationYearMonth(&amp;quot;P12Y10M&amp;quot;);&lt;br /&gt;
      System.out.println(&amp;quot;P12Y10M is of type: &amp;quot; + ymDuration.getXMLSchemaType());&lt;br /&gt;
      // create a dayTimeDuration (really this time)&lt;br /&gt;
      Duration dtDuration = df.newDurationDayTime(&amp;quot;P10DT10H12M0S&amp;quot;);&lt;br /&gt;
      System.out.println(&amp;quot;P10DT10H12M0S is of type: &amp;quot; + dtDuration.getXMLSchemaType());&lt;br /&gt;
      // try to fool the factory!&lt;br /&gt;
      try {&lt;br /&gt;
        ymDuration = df.newDurationYearMonth(&amp;quot;P12Y10M1D&amp;quot;);&lt;br /&gt;
      } catch (IllegalArgumentException e) {&lt;br /&gt;
        System.out.println(&amp;quot;&amp;quot;duration&amp;quot;: P12Y10M1D is not &amp;quot;yearMonthDuration&amp;quot;!!!&amp;quot;);&lt;br /&gt;
      }&lt;br /&gt;
      XMLGregorianCalendar xgc = df.newXMLGregorianCalendar();&lt;br /&gt;
      xgc.setYear(1975);&lt;br /&gt;
      xgc.setMonth(DatatypeConstants.AUGUST);&lt;br /&gt;
      xgc.setDay(11);&lt;br /&gt;
      xgc.setHour(6);&lt;br /&gt;
      xgc.setMinute(44);&lt;br /&gt;
      xgc.setSecond(0);&lt;br /&gt;
      xgc.setMillisecond(0);&lt;br /&gt;
      xgc.setTimezone(5);&lt;br /&gt;
      xgc.add(myPhone);&lt;br /&gt;
      System.out&lt;br /&gt;
          .println(&amp;quot;The approximate end of the number of milliseconds in my phone number was &amp;quot;&lt;br /&gt;
              + xgc);&lt;br /&gt;
      // adding a duration to XMLGregorianCalendar&lt;br /&gt;
      xgc.add(myLife);&lt;br /&gt;
      System.out.println(&amp;quot;Adding the duration myLife to the above calendar:&amp;quot; + xgc);&lt;br /&gt;
      // create a new XMLGregorianCalendar using the string format of xgc.&lt;br /&gt;
      XMLGregorianCalendar xgcCopy = df.newXMLGregorianCalendar(xgc.toXMLFormat());&lt;br /&gt;
      // should be equal-if not what happened!!&lt;br /&gt;
      if (xgcCopy.rupare(xgc) != DatatypeConstants.EQUAL) {&lt;br /&gt;
        System.out.println(&amp;quot;oooops!&amp;quot;);&lt;br /&gt;
      } else {&lt;br /&gt;
        System.out.println(&amp;quot;Very good: &amp;quot; + xgc + &amp;quot; is equal to &amp;quot; + xgcCopy);&lt;br /&gt;
      }&lt;br /&gt;
    } catch (DatatypeConfigurationException dce) {&lt;br /&gt;
      System.err.println(&amp;quot;error: Datatype error occurred - &amp;quot; + dce.getMessage());&lt;br /&gt;
      dce.printStackTrace(System.err);&lt;br /&gt;
    }&lt;br /&gt;
  } // main(String[])&lt;br /&gt;
} // DatatypeAPIUsage&amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;/div&gt;</summary>
			</entry>

	</feed>