gpt4 book ai didi

com.sun.xml.bind.v2.runtime.XMLSerializer.getInstance()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-23 23:21:05 26 4
gpt4 key购买 nike

本文整理了Java中com.sun.xml.bind.v2.runtime.XMLSerializer.getInstance()方法的一些代码示例,展示了XMLSerializer.getInstance()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XMLSerializer.getInstance()方法的具体详情如下:
包路径:com.sun.xml.bind.v2.runtime.XMLSerializer
类名称:XMLSerializer
方法名:getInstance

XMLSerializer.getInstance介绍

[英]When called from within the realm of the marshaller, this method returns the current XMLSerializer in charge.
[中]当从封送器领域内调用时,此方法返回负责的当前XMLSerializer。

代码示例

代码示例来源:origin: com.sun.xml.bind/jaxb-impl

public String marshal(DataHandler data) {
    if(data==null)      return null;
    AttachmentMarshaller am = XMLSerializer.getInstance().attachmentMarshaller;
    // TODO: error check
    return am.addSwaRefAttachment(data);
  }
}

代码示例来源:origin: com.sun.xml.bind/jaxb-impl

public String print(Date v) {
    XMLSerializer xs = XMLSerializer.getInstance();
    QName type = xs.getSchemaType();
    GregorianCalendar cal = new GregorianCalendar(0,0,0);
    cal.setTime(v);
    if ((type != null) && (WellKnownNamespace.XML_SCHEMA.equals(type.getNamespaceURI())) &&
        DATE.equals(type.getLocalPart())) {
      return DatatypeConverterImpl._printDate(cal);
    } else {
      return DatatypeConverterImpl._printDateTime(cal);
    }
  }
});

代码示例来源:origin: com.sun.xml.bind/jaxb-impl

void marshal(InMemory o, XMLSerializer out) throws IOException, SAXException, XMLStreamException {
    try {
      core.marshal(_adaptM( XMLSerializer.getInstance(), o ), out );
    } catch (MarshalException e) {
      // recover from error by not marshalling this element.
    }
  }
}

代码示例来源:origin: com.sun.xml.bind/jaxb-impl

public String print(QName v) {
  return DatatypeConverterImpl._printQName(v,XMLSerializer.getInstance().getNamespaceContext());
}

代码示例来源:origin: com.sun.xml.bind/jaxb-impl

@Override
public CharSequence print(V o) throws AccessorException {
  XMLSerializer w = XMLSerializer.getInstance();
  MimeType old = w.setExpectedMimeType(expectedMimeType);
  try {
    return core.print(o);
  } finally {
    w.setExpectedMimeType(old);
  }
}

代码示例来源:origin: com.sun.xml.bind/jaxb-impl

public Base64Data print(byte[] v) {
    XMLSerializer w = XMLSerializer.getInstance();
    Base64Data bd = new Base64Data();
    String mimeType = w.getXMIMEContentType();
    bd.set(v,mimeType);
    return bd;
  }
});

代码示例来源:origin: com.sun.xml.bind/jaxb-impl

@Override
public CharSequence print(V o) throws AccessorException {
  XMLSerializer w = XMLSerializer.getInstance();
  QName old = w.setSchemaType(schemaType);
  try {
    return core.print(o);
  } finally {
    w.setSchemaType(old);
  }
}

代码示例来源:origin: com.sun.xml.bind/jaxb-impl

public String print(BeanT o) throws AccessorException, SAXException {
  ListT list = acc.get(o);
  if(list==null)
    return null;
  StringBuilder buf = new StringBuilder();
  XMLSerializer w = XMLSerializer.getInstance();
  ListIterator<ItemT> itr = lister.iterator(list, w);
  while(itr.hasNext()) {
    try {
      ItemT item = itr.next();
      if (item != null) {
        if(buf.length()>0)  buf.append(' ');
        buf.append(xducer.print(item));
      }
    } catch (JAXBException e) {
      w.reportError(null,e);
    }
  }
  return buf.toString();
}

代码示例来源:origin: com.sun.xml.bind/jaxb-impl

@Override
public @NotNull CharSequence print(@NotNull V o) throws AccessorException {
  XMLSerializer w = XMLSerializer.getInstance();
  boolean old = w.setInlineBinaryFlag(true);
  try {
    return core.print(o);
  } finally {
    w.setInlineBinaryFlag(old);
  }
}

代码示例来源:origin: com.sun.xml.bind/jaxb-impl

public Base64Data print(Image v) {
  ByteArrayOutputStreamEx imageData = new ByteArrayOutputStreamEx();
  XMLSerializer xs = XMLSerializer.getInstance();

代码示例来源:origin: com.sun.xml.bind/jaxb-impl

public String print(BeanT bean) throws AccessorException, SAXException {
  TargetT target = acc.get(bean);
  if(target==null)    return null;
  
  XMLSerializer w = XMLSerializer.getInstance();
  try {
    String id = w.grammar.getBeanInfo(target,true).getId(target,w);
    if(id==null)
      w.errorMissingId(target);
    return id;
  } catch (JAXBException e) {
    w.reportError(null,e);
    return null;
  }
}

代码示例来源: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: com.sun.xml.bind/jaxb-impl

public Base64Data print(Source v) {
  XMLSerializer xs = XMLSerializer.getInstance();
  Base64Data bd = new Base64Data();

代码示例来源:origin: org.glassfish.jaxb/jaxb-runtime

public String marshal(DataHandler data) {
    if(data==null)      return null;
    AttachmentMarshaller am = XMLSerializer.getInstance().attachmentMarshaller;
    // TODO: error check
    return am.addSwaRefAttachment(data);
  }
}

代码示例来源:origin: com.sun.jersey/jersey-json

private RuntimePropertyInfo getCurrentElementRuntimePropertyInfo() {
  final XMLSerializer xs = XMLSerializer.getInstance();
  final Property cp = (xs == null) ? null : xs.getCurrentProperty();
  return (cp == null) ? null : cp.getInfo();
}

代码示例来源:origin: org.glassfish.jaxb/jaxb-runtime

void marshal(InMemory o, XMLSerializer out) throws IOException, SAXException, XMLStreamException {
    try {
      core.marshal(_adaptM( XMLSerializer.getInstance(), o ), out );
    } catch (MarshalException e) {
      // recover from error by not marshalling this element.
    }
  }
}

代码示例来源:origin: org.glassfish.jaxb/jaxb-runtime

public Base64Data print(byte[] v) {
    XMLSerializer w = XMLSerializer.getInstance();
    Base64Data bd = new Base64Data();
    String mimeType = w.getXMIMEContentType();
    bd.set(v,mimeType);
    return bd;
  }
});

代码示例来源:origin: org.glassfish.jaxb/jaxb-runtime

@Override
public CharSequence print(V o) throws AccessorException {
  XMLSerializer w = XMLSerializer.getInstance();
  QName old = w.setSchemaType(schemaType);
  try {
    return core.print(o);
  } finally {
    w.setSchemaType(old);
  }
}

代码示例来源:origin: org.glassfish.jaxb/jaxb-runtime

@Override
public CharSequence print(V o) throws AccessorException {
  XMLSerializer w = XMLSerializer.getInstance();
  MimeType old = w.setExpectedMimeType(expectedMimeType);
  try {
    return core.print(o);
  } finally {
    w.setExpectedMimeType(old);
  }
}

代码示例来源:origin: org.glassfish.jaxb/jaxb-runtime

@Override
public @NotNull CharSequence print(@NotNull V o) throws AccessorException {
  XMLSerializer w = XMLSerializer.getInstance();
  boolean old = w.setInlineBinaryFlag(true);
  try {
    return core.print(o);
  } finally {
    w.setInlineBinaryFlag(old);
  }
}

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com