本文整理了Java中javax.xml.datatype.XMLGregorianCalendar.toXMLFormat()
方法的一些代码示例,展示了XMLGregorianCalendar.toXMLFormat()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XMLGregorianCalendar.toXMLFormat()
方法的具体详情如下:
包路径:javax.xml.datatype.XMLGregorianCalendar
类名称:XMLGregorianCalendar
方法名:toXMLFormat
[英]Return the lexical representation of this
instance. The format is specified in XML Schema 1.0 Part 2, Section 3.2.[7-14].1, Lexical Representation".
Specific target lexical representation format is determined by #getXMLSchemaType().
[中]返回this
实例的词法表示形式。格式在XML Schema 1.0 Part 2, Section 3.2.[7-14].1, Lexical Representation".中指定
特定的目标词汇表示格式由#getXMLSchemaType()确定。
代码示例来源:origin: robovm/robovm
/**
* <p>Returns a <code>String</code> representation of this <code>XMLGregorianCalendar</code> <code>Object</code>.</p>
*
* <p>The result is a lexical representation generated by {@link #toXMLFormat()}.</p>
*
* @return A non-<code>null</code> valid <code>String</code> representation of this <code>XMLGregorianCalendar</code>.
*
* @throws IllegalStateException if the combination of set fields
* does not match one of the eight defined XML Schema builtin date/time datatypes.
*
* @see #toXMLFormat()
*/
public String toString() {
return toXMLFormat();
}
代码示例来源:origin: com.sun.xml.bind/jaxb-impl
public String print(XMLGregorianCalendar cal) {
XMLSerializer xs = XMLSerializer.getInstance();
QName type = xs.getSchemaType();
if (type != null) {
try {
checkXmlGregorianCalendarFieldRef(type, cal);
String format = xmlGregorianCalendarFormatString.get(type);
if (format != null) {
return format(format, cal);
}
} catch (javax.xml.bind.MarshalException e) {
// see issue 649
xs.handleEvent(new ValidationEventImpl(ValidationEvent.WARNING, e.getMessage(),
xs.getCurrentLocation(null) ));
return "";
}
}
return cal.toXMLFormat();
}
代码示例来源:origin: org.glassfish.jaxb/jaxb-runtime
public String print(XMLGregorianCalendar cal) {
XMLSerializer xs = XMLSerializer.getInstance();
QName type = xs.getSchemaType();
if (type != null) {
try {
checkXmlGregorianCalendarFieldRef(type, cal);
String format = xmlGregorianCalendarFormatString.get(type);
if (format != null) {
return format(format, cal);
}
} catch (javax.xml.bind.MarshalException e) {
// see issue 649
xs.handleEvent(new ValidationEventImpl(ValidationEvent.WARNING, e.getMessage(),
xs.getCurrentLocation(null) ));
return "";
}
}
return cal.toXMLFormat();
}
代码示例来源:origin: org.odftoolkit/odfdom-java
/**
* Returns a String Object representing this TimeOrDateTime value
*
* @return return a string representation of the value of this
* TimeOrDateTime object
*/
@Override
public String toString() {
return mTimeOrDateTime.toXMLFormat();
}
代码示例来源:origin: org.odftoolkit/odfdom-java
/**
* Returns a String Object representing this Time value
*
* @return return a string representation of the value of this Time object
*/
@Override
public String toString() {
return mTime.toXMLFormat();
}
代码示例来源:origin: org.odftoolkit/odfdom-java
/**
* Returns a String Object representing this DateTime value
*
* @return return a string representation of the value of this DateTime
* object
*/
@Override
public String toString() {
return mDateTime.toXMLFormat();
}
代码示例来源:origin: org.odftoolkit/odfdom-java
/**
* Returns a String Object representing this DateOrDateTime value
*
* @return return a string representation of the value of this
* DateOrDateTime object
*/
@Override
public String toString() {
return mDateOrDateTime.toXMLFormat();
}
代码示例来源:origin: apache/cxf
public String getXMLGregorianCalendarValueString(String path) {
try {
return javax.xml.datatype.DatatypeFactory.newInstance()
.newXMLGregorianCalendar(new GregorianCalendar()).toXMLFormat();
} catch (DatatypeConfigurationException e) {
//ignore
}
return null;
}
代码示例来源:origin: org.apache.cxf/cxf-tools-wsdlto-core
public String getXMLGregorianCalendarValueString(String path) {
try {
return javax.xml.datatype.DatatypeFactory.newInstance()
.newXMLGregorianCalendar(new GregorianCalendar()).toXMLFormat();
} catch (DatatypeConfigurationException e) {
//ignore
}
return null;
}
代码示例来源:origin: apache/cxf
@Override
public void writeObject(Object object, MessageWriter writer, Context context) {
writer.writeValue(((XMLGregorianCalendar)object).toXMLFormat());
}
}
代码示例来源:origin: apache/cxf
public static String convertToXMLString(Object input) {
if (input instanceof XMLGregorianCalendar) {
return ((XMLGregorianCalendar)input).toXMLFormat();
}
if (input instanceof Duration) {
return ((Duration)input).toString();
}
throw new IllegalArgumentException(
"convertToXMLString requires either an instance of XMLGregorianCalendar or Duration");
}
代码示例来源:origin: OpenNMS/opennms
/**
* <p>getAsText</p>
*
* @return a {@link java.lang.String} object.
*/
@Override
public String getAsText() {
return ((XMLGregorianCalendar)getValue()).toXMLFormat();
}
}
代码示例来源:origin: apache/cxf
public static ExpirationType toExpirationTypeContainingGregorianCalendar(XMLGregorianCalendar date) {
ExpirationType et = new ExpirationType();
et.setValue(date.toXMLFormat());
return et;
}
代码示例来源:origin: apache/jena
public static NodeValue makeDateTime(XMLGregorianCalendar cal)
{
String lex = cal.toXMLFormat() ;
Node node = org.apache.jena.graph.NodeFactory.createLiteral(lex, XSDdateTime) ;
return new NodeValueDT(lex, node) ;
}
代码示例来源:origin: apache/jena
public static NodeValue makeDate(XMLGregorianCalendar cal)
{
String lex = cal.toXMLFormat() ;
Node node = org.apache.jena.graph.NodeFactory.createLiteral(lex, XSDdate) ;
return new NodeValueDT(lex, node) ;
}
代码示例来源:origin: org.openrdf.sesame/sesame-model
/**
* Creates a literal for the specified calendar using a datatype appropriate
* for the value indicated by {@link XMLGregorianCalendar#getXMLSchemaType()}.
*/
protected CalendarLiteral(XMLGregorianCalendar calendar) {
super(calendar.toXMLFormat(), XMLDatatypeUtil.qnameToURI(calendar.getXMLSchemaType()));
this.calendar = calendar;
}
代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.core
private String stringFromSQLTime(Time sourceTime) {
XMLGregorianCalendar xgc = getDatatypeFactory().newXMLGregorianCalendar();
Calendar cal = Calendar.getInstance(getTimeZone());
cal.setTime(sourceTime);
xgc.setHour(cal.get(Calendar.HOUR_OF_DAY));
xgc.setMinute(cal.get(Calendar.MINUTE));
xgc.setSecond(cal.get(Calendar.SECOND));
String string= xgc.toXMLFormat();
string = appendMillis(string, sourceTime.getTime());
return appendTimeZone(string, sourceTime);
}
代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.core
private String stringFromXMLGregorianCalendar(XMLGregorianCalendar cal, QName schemaTypeQName) {
if(schemaTypeQName !=null && schemaTypeQName.equals(cal.getXMLSchemaType()) && schemaTypeQName != Constants.G_MONTH_QNAME){
return cal.toXMLFormat();
}
GregorianCalendar gCal = cal.toGregorianCalendar();
if(cal.getTimezone() == DatatypeConstants.FIELD_UNDEFINED) {
gCal.clear(Calendar.ZONE_OFFSET);
}
return stringFromCalendar(gCal, schemaTypeQName);
}
代码示例来源:origin: org.picketlink/picketlink-federation
/**
* <p>
* Sets the creation time.
* </p>
*
* @param created a reference to the {@code XMLGregorianCalendar} that represents the creation time to be set.
*/
public void setCreated(XMLGregorianCalendar created) {
this.created = created.normalize();
this.delegate.getCreated().setValue(this.created.toXMLFormat());
}
代码示例来源:origin: apache/jena
@Override
public void visit(NodeValueDT nv) {
push(new NodeValueDT(nv.getDateTime().toXMLFormat(),
changeNode(nv.asNode())));
}
内容来源于网络,如有侵权,请联系作者删除!