gpt4 book ai didi

org.eclipse.persistence.platform.xml.XMLPlatform.newXMLTransformer()方法的使用及代码示例

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

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

XMLPlatform.newXMLTransformer介绍

[英]Return a concrete implementation of the XML transformer abstraction that is compatible with the XML Platform.
[中]返回与XML平台兼容的XML transformer抽象的具体实现。

代码示例

代码示例来源:origin: com.haulmont.thirdparty/eclipselink

private static InputSource createInputSourceFromSource(Source aSource) {
  ByteArrayOutputStream baos = new ByteArrayOutputStream();
  StreamResult result = new StreamResult(baos);
  XMLTransformer t = XMLPlatformFactory.getInstance().getXMLPlatform().newXMLTransformer();
  t.transform(aSource, result);
  ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
  InputSource inputSource = new InputSource(bais);
  inputSource.setSystemId(aSource.getSystemId());
  return inputSource;
}

代码示例来源:origin: com.haulmont.thirdparty/eclipselink

public XMLTypeBindCallCustomParameter(Object obj) {
  super(obj);
  xmlTransformer = XMLPlatformFactory.getInstance().getXMLPlatform().newXMLTransformer();
  xmlTransformer.setFormattedOutput(false);
}

代码示例来源:origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence

private void initialize() {
  XMLPlatform xmlPlatform = XMLPlatformFactory.getInstance().getXMLPlatform();
  transformer = xmlPlatform.newXMLTransformer();
  setEncoding(XMLConstants.DEFAULT_XML_ENCODING);
  setFormattedOutput(true);
  marshalProperties = new Properties();
}

代码示例来源:origin: com.haulmont.thirdparty/eclipselink

public Object convertObjectValueToDataValue(Object objectValue, Session session, XMLMarshaller marshaller) {
  if (objectValue != null && elementClass.isAssignableFrom(objectValue.getClass())) {
    ErrorHandler handler = marshaller.getErrorHandler();
    Source source = null;
    if(handler != null && handler instanceof JAXBErrorHandler) {
      source = domHandler.marshal(objectValue, ((JAXBErrorHandler)handler).getValidationEventHandler());
    } else {
      source = domHandler.marshal(objectValue, null);
    }
    DOMResult result = new DOMResult();
     if(source instanceof DOMSource){
      Node n = ((DOMSource)source).getNode();
      if(n.getNodeType() == Node.DOCUMENT_NODE){
        return ((Document)n).getDocumentElement();
      }
      return n;
    }else{                
      XMLTransformer xmlTransformer = xmlPlatform.newXMLTransformer();
      xmlTransformer.setFormattedOutput(marshaller.isFormattedOutput());
      xmlTransformer.transform(source, result);
      return result.getNode().getFirstChild();
    }
  }
  return objectValue;
}

代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.moxy

public Object convertObjectValueToDataValue(Object objectValue, Session session, XMLMarshaller marshaller) {
  if (objectValue != null && elementClass.isAssignableFrom(objectValue.getClass())) {
    ErrorHandler handler = marshaller.getErrorHandler();
    Source source = null;
    if(handler != null && handler instanceof JAXBErrorHandler) {
      source = domHandler.marshal(objectValue, ((JAXBErrorHandler)handler).getValidationEventHandler());
    } else {
      source = domHandler.marshal(objectValue, null);
    }
    DOMResult result = new DOMResult();
     if(source instanceof DOMSource){
      Node n = ((DOMSource)source).getNode();
      if(n.getNodeType() == Node.DOCUMENT_NODE){
        return ((Document)n).getDocumentElement();
      }
      return n;
    }else{
      XMLTransformer xmlTransformer = xmlPlatform.newXMLTransformer();
      xmlTransformer.setFormattedOutput(marshaller.isFormattedOutput());
      xmlTransformer.transform(source, result);
      return result.getNode().getFirstChild();
    }
  }
  return objectValue;
}

代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.core

/**
 * Write the XML string representation of the DOM.
 */
public void transformToWriter(Writer writer) {
  XMLTransformer xmlTransformer = XMLPlatformFactory.getInstance().getXMLPlatform().newXMLTransformer();
  xmlTransformer.transform(this.getDOM(), writer);
}

代码示例来源:origin: com.haulmont.thirdparty/eclipselink

/**
 * Write the XML string representation of the DOM.
 */
public void transformToWriter(Writer writer) {
  XMLTransformer xmlTransformer = XMLPlatformFactory.getInstance().getXMLPlatform().newXMLTransformer();
  xmlTransformer.transform(this.getDOM(), writer);
}

代码示例来源:origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence

/**
 * Write the XML string representation of the DOM.
 */
public void transformToWriter(Writer writer) {
  XMLTransformer xmlTransformer = XMLPlatformFactory.getInstance().getXMLPlatform().newXMLTransformer();
  xmlTransformer.transform(this.getDOM(), writer);
}

代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.core

public DirectToXMLTypeMapping() {
  super();
  this.xmlTransformer = XMLPlatformFactory.getInstance().getXMLPlatform().newXMLTransformer();
  this.xmlTransformer.setFormattedOutput(false);
  this.xmlParser = XMLPlatformFactory.getInstance().getXMLPlatform().newXMLParser();
  this.xmlComparer = new XMLComparer();
}

代码示例来源:origin: com.haulmont.thirdparty/eclipselink

public DirectToXMLTypeMapping() {
  super();
  this.xmlTransformer = XMLPlatformFactory.getInstance().getXMLPlatform().newXMLTransformer();
  this.xmlTransformer.setFormattedOutput(false);
  this.xmlParser = XMLPlatformFactory.getInstance().getXMLPlatform().newXMLParser();
  this.xmlComparer = new XMLComparer();
}

代码示例来源:origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence

public DirectToXMLTypeMapping() {
  super();
  this.xmlTransformer = XMLPlatformFactory.getInstance().getXMLPlatform().newXMLTransformer();
  this.xmlTransformer.setFormattedOutput(false);
  this.xmlParser = XMLPlatformFactory.getInstance().getXMLPlatform().newXMLParser();
  this.xmlComparer = new XMLComparer();
}

代码示例来源:origin: com.haulmont.thirdparty/eclipselink

/**
 * INTERNAL
 * @return the transformer instance for this marshaller
 */
@Override
public XMLTransformer getTransformer() {
  if(null == transformer) {
    XMLPlatform xmlPlatform = XMLPlatformFactory.getInstance().getXMLPlatform();
    transformer = xmlPlatform.newXMLTransformer();
    transformer.setEncoding(getEncoding());
    transformer.setFormattedOutput(isFormattedOutput());
    transformer.setFragment(fragment);
    
  }
  return transformer;
}

代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.core

/**
 * INTERNAL
 * @return the transformer instance for this marshaller
 */
@Override
public XMLTransformer getTransformer() {
  if(null == transformer) {
    XMLPlatform xmlPlatform = XMLPlatformFactory.getInstance().getXMLPlatform();
    transformer = xmlPlatform.newXMLTransformer();
    transformer.setEncoding(getEncoding());
    transformer.setFormattedOutput(isFormattedOutput());
    transformer.setFragment(fragment);
  }
  return transformer;
}

代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.moxy

public Object convertDataValueToObjectValue(Object dataValue, Session session, XMLUnmarshaller unmarshaller) {
  if(dataValue instanceof org.w3c.dom.Element) {
    ErrorHandler handler = unmarshaller.getErrorHandler();
    Result result = null;
    if(handler != null && handler instanceof JAXBErrorHandler) {
      result = domHandler.createUnmarshaller(((JAXBErrorHandler)handler).getValidationEventHandler());
    } else {
      result = domHandler.createUnmarshaller(null);
    }
    if(result instanceof DOMResult){
      ((DOMResult) result).setNode((org.w3c.dom.Element)dataValue);
    }else{
      xmlPlatform.newXMLTransformer().transform((org.w3c.dom.Element)dataValue, result);
    }
    return domHandler.getElement(result);
  }
  return dataValue;
}

代码示例来源:origin: com.haulmont.thirdparty/eclipselink

public Object convertDataValueToObjectValue(Object dataValue, Session session, XMLUnmarshaller unmarshaller) {
  if(dataValue instanceof org.w3c.dom.Element) {
    ErrorHandler handler = unmarshaller.getErrorHandler();
    Result result = null;
    if(handler != null && handler instanceof JAXBErrorHandler) {
      result = domHandler.createUnmarshaller(((JAXBErrorHandler)handler).getValidationEventHandler());
    } else {
      result = domHandler.createUnmarshaller(null);
    }
    if(result instanceof DOMResult){
      ((DOMResult) result).setNode((org.w3c.dom.Element)dataValue);
    }else{
      xmlPlatform.newXMLTransformer().transform((org.w3c.dom.Element)dataValue, result);                
    }
    return domHandler.getElement(result);       
  }
  return dataValue;
}

代码示例来源:origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence

XMLTransformer transformer = XMLPlatformFactory.getInstance().getXMLPlatform().newXMLTransformer();
transformer.transform(source, result);
return unmarshal(result.getNode(), clazz);

代码示例来源:origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence

XMLTransformer transformer = XMLPlatformFactory.getInstance().getXMLPlatform().newXMLTransformer();
SAXResult result = new SAXResult(handler);
transformer.transform(source, result);

代码示例来源:origin: com.haulmont.thirdparty/eclipselink

} else {
  DOMResult result = new DOMResult();
  XMLTransformer transformer = XMLPlatformFactory.getInstance().getXMLPlatform().newXMLTransformer();
  transformer.transform(source, result);
  return unmarshal(result.getNode(), clazz);

代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.core

XMLPlatform xmlPlat = XMLPlatformFactory.getInstance().getXMLPlatform();
xmlPlat.setDisableSecureProcessing(isSecureProcessingDisabled());
XMLTransformer transformer = xmlPLatform.newXMLTransformer();
transformer.transform(source, result);
return unmarshal(result.getNode(), clazz);

代码示例来源:origin: com.haulmont.thirdparty/eclipselink

} else {
  UnmarshallerHandler handler = this.xmlUnmarshaller.getUnmarshallerHandler();
  XMLTransformer transformer = XMLPlatformFactory.getInstance().getXMLPlatform().newXMLTransformer();
  SAXResult result = new SAXResult(handler);
  transformer.transform(source, result);

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