Package org.eclipse.persistence.platform.xml

Examples of org.eclipse.persistence.platform.xml.XMLTransformer


              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;
    }
View Full Code Here


        Node n = this.marshaller.objectToXML(obj, node, desc, domRecord, isXMLRoot, this.getDocumentPreservationPolicy());

        validateNode(n);
       
        DOMResult result = new DOMResult(node);
        XMLTransformer transformer = marshaller.getTransformer();
        if (isXMLRoot) {
            String oldEncoding = transformer.getEncoding();
            String oldVersion = transformer.getVersion();
            if (((XMLRoot) obj).getEncoding() != null) {
                transformer.setEncoding(((XMLRoot) obj).getEncoding());
            }
            if (((XMLRoot) obj).getXMLVersion() != null) {
                transformer.setVersion(((XMLRoot) obj).getXMLVersion());
            }
            transformer.transform(n, result);
            if(oldEncoding != null){
                transformer.setEncoding(oldEncoding);
            }
            if(oldVersion != null){
                transformer.setVersion(oldVersion);
            }
        } else {
            transformer.transform(n, result);
          
        }
    }
View Full Code Here

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

              } else {
                  return unmarshal(streamSource.getSystemId());
              }
          } else {
            XMLUnmarshallerHandler handler = this.xmlUnmarshaller.getUnmarshallerHandler();
            XMLTransformer transformer = XMLPlatformFactory.getInstance().getXMLPlatform().newXMLTransformer();
            SAXResult result = new SAXResult(handler);
            transformer.transform(source, result);
            return handler.getResult();         
          }
      }finally {
          xmlUnmarshaller.getStringBuffer().reset();
        }
View Full Code Here

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

              } else {
                  return unmarshal(streamSource.getSystemId());
              }
          } else {
            XMLUnmarshallerHandler handler = this.xmlUnmarshaller.getUnmarshallerHandler();
            XMLTransformer transformer = XMLPlatformFactory.getInstance().getXMLPlatform().newXMLTransformer();
            SAXResult result = new SAXResult(handler);
            transformer.transform(source, result);
            return handler.getResult();         
          }
      }finally {
          xmlUnmarshaller.getStringBuffer().reset();
        }
View Full Code Here

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

                source = domHandler.marshal(objectValue, ((JAXBErrorHandler)handler).getValidationEventHandler());
            } else {
                source = domHandler.marshal(objectValue, null);
            }
            DOMResult result = new DOMResult();
            XMLTransformer xmlTransformer = xmlPlatform.newXMLTransformer();
            xmlTransformer.setFormattedOutput(marshaller.isFormattedOutput());
            xmlTransformer.transform(source, result);
            return result.getNode().getFirstChild();
        }
        return objectValue;
    }
View Full Code Here

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

        Node n = this.marshaller.objectToXML(obj, node, desc, domRecord, isXMLRoot, this.getDocumentPreservationPolicy());

        validateNode(n);
       
        DOMResult result = new DOMResult(node);
        XMLTransformer transformer = marshaller.getTransformer();
        if (isXMLRoot) {
            String oldEncoding = transformer.getEncoding();
            String oldVersion = transformer.getVersion();
            if (((XMLRoot) obj).getEncoding() != null) {
                transformer.setEncoding(((XMLRoot) obj).getEncoding());
            }
            if (((XMLRoot) obj).getXMLVersion() != null) {
                transformer.setVersion(((XMLRoot) obj).getXMLVersion());
            }
            transformer.transform(n, result);
            transformer.setEncoding(oldEncoding);
            transformer.setVersion(oldVersion);
        } else {
            transformer.transform(n, result);
          
        }
    }
View Full Code Here

TOP

Related Classes of org.eclipse.persistence.platform.xml.XMLTransformer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.