javax.xml.datatype

Home
Java Source Code / Java Documentation
1.6.0 JDK Core
2.6.0 JDK Modules
3.6.0 JDK Modules com.sun
4.6.0 JDK Modules com.sun.java
5.6.0 JDK Modules sun
6.6.0 JDK Platform
7.Ajax
8.Apache Harmony Java SE
9.Aspect oriented
10.Authentication Authorization
11.Blogger System
12.Build
13.Byte Code
14.Cache
15.Chart
16.Chat
17.Code Analyzer
18.Collaboration
19.Content Management System
20.Database Client
21.Database DBMS
22.Database JDBC Connection Pool
23.Database ORM
24.Development
25.EJB Server
26.ERP CRM Financial
27.ESB
28.Forum
29.Game
30.GIS
31.Graphic 3D
32.Graphic Library
33.Groupware
34.HTML Parser
35.IDE
36.IDE Eclipse
37.IDE Netbeans
38.Installer
39.Internationalization Localization
40.Inversion of Control
41.Issue Tracking
42.J2EE
43.J2ME
44.JBoss
45.JMS
46.JMX
47.Library
48.Mail Clients
49.Music
50.Net
51.Parser
52.PDF
53.Portal
54.Profiler
55.Project Management
56.Report
57.RSS RDF
58.Rule Engine
59.Science
60.Scripting
61.Search Engine
62.Security
63.Sevlet Container
64.Source Control
65.Swing Library
66.Template Engine
67.Test Coverage
68.Testing
69.UML
70.Web Crawler
71.Web Framework
72.Web Mail
73.Web Server
74.Web Services
75.Web Services apache cxf 2.2.6
76.Web Services AXIS2
77.Wiki Engine
78.Workflow Engines
79.XML
80.XML UI
Java Source Code / Java Documentation » 6.0 JDK Core » xml » javax.xml.datatype 
javax.xml.datatype
javax.xml.xpath

XML/Java Type Mappings.

javax.xml.datatypeAPI provides XML/Java type mappings.

The following XML standards apply:


W3C XML Schema Data Type Java Data Type
xs:date {@link javax.xml.datatype.XMLGregorianCalendar}
xs:dateTime {@link javax.xml.datatype.XMLGregorianCalendar}
xs:duration {@link javax.xml.datatype.Duration}
xs:gDay {@link javax.xml.datatype.XMLGregorianCalendar}
xs:gMonth {@link javax.xml.datatype.XMLGregorianCalendar}
xs:gMonthDay {@link javax.xml.datatype.XMLGregorianCalendar}
xs:gYear {@link javax.xml.datatype.XMLGregorianCalendar}
xs:gYearMonth {@link javax.xml.datatype.XMLGregorianCalendar}
xs:time {@link javax.xml.datatype.XMLGregorianCalendar}

XQuery 1.0 and XPath 2.0 Data Model Java Data Type
xdt:dayTimeDuration {@link javax.xml.datatype.Duration}
xdt:yearMonthDuration {@link javax.xml.datatype.Duration}

W3C XML Schema data types that have a "natural" mapping to Java types are defined by JSR 31: Java™ Architecture for XML Binding (JAXB) Specification, Binding XML Schema to Java Representations. JAXB defined mappings for XML Schema built-in data types include:

  • xs:anySimpleType
  • xs:base64Binary
  • xs:boolean
  • xs:byte
  • xs:decimal
  • xs:double
  • xs:float
  • xs:hexBinary
  • xs:int
  • xs:integer
  • xs:long
  • xs:QName
  • xs:short
  • xs:string
  • xs:unsignedByte
  • xs:unsignedInt
  • xs:unsignedShort


Java Source File NameTypeComment
DatatypeConfigurationException.javaClass
DatatypeConstants.javaClass
DatatypeFactory.javaClass

Factory that creates new javax.xml.datatype Objects that map XML to/from Java Objects.

DatatypeFactory.newInstance() is used to create a new DatatypeFactory. The following implementation resolution mechanisms are used in the following order:

  1. If the system property specified by DatatypeFactory.DATATYPEFACTORY_PROPERTY , "javax.xml.datatype.DatatypeFactory", exists, a class with the name of the property's value is instantiated. Any Exception thrown during the instantiation process is wrapped as a DatatypeConfigurationException .
  2. If the file ${JAVA_HOME}/lib/jaxp.properties exists, it is loaded in a java.util.Properties Object. The Properties Object is then queried for the property as documented in the prior step and processed as documented in the prior step.
  3. The services resolution mechanism is used, e.g.
Duration.javaClass

Immutable representation of a time span as defined in the W3C XML Schema 1.0 specification.

A Duration object represents a period of Gregorian time, which consists of six fields (years, months, days, hours, minutes, and seconds) plus a sign (+/-) field.

The first five fields have non-negative (>=0) integers or null (which represents that the field is not set), and the seconds field has a non-negative decimal or null. A negative sign indicates a negative duration.

This class provides a number of methods that make it easy to use for the duration datatype of XML Schema 1.0 with the errata.

Order relationship

Duration objects only have partial order, where two values A and B maybe either:

  1. A<B (A is shorter than B)
  2. A>B (A is longer than B)
  3. A==B (A and B are of the same duration)
  4. A<>B (Comparison between A and B is indeterminate)

For example, 30 days cannot be meaningfully compared to one month. The Duration.compare(Duration duration) method implements this relationship.

See the Duration.isLongerThan(Duration) method for details about the order relationship among Duration objects.

Operations over Duration

This class provides a set of basic arithmetic operations, such as addition, subtraction and multiplication. Because durations don't have total order, an operation could fail for some combinations of operations.

FactoryFinder.javaClass

Implements pluggable Datatypes.

This class is duplicated for each JAXP subpackage so keep it in sync.

SecuritySupport.javaClass This class is duplicated for each JAXP subpackage so keep it in sync.
XMLGregorianCalendar.javaClass

Representation for W3C XML Schema 1.0 date/time datatypes. Specifically, these date/time datatypes are DatatypeConstants.DATETIME , DatatypeConstants.TIME , DatatypeConstants.DATE , DatatypeConstants.GYEARMONTH , DatatypeConstants.GMONTHDAY , DatatypeConstants.GYEAR , DatatypeConstants.GMONTH , and DatatypeConstants.GDAY defined in the XML Namespace "http://www.w3.org/2001/XMLSchema". These datatypes are normatively defined in W3C XML Schema 1.0 Part 2, Section 3.2.7-14.

The table below defines the mapping between XML Schema 1.0 date/time datatype fields and this class' fields.

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.