/** * Use the transformer to transform * * @param transformer * @param stax * @param result * @throws ParsingException */ public static void transform(Transformer transformer, StAXSource stax, DOMResult result) throws ParsingException { transform(transformer, (Source)stax, result); }
public static Node getNodeFromSource(Source source) throws ProcessingException, ConfigurationException { try { Transformer transformer = TransformerUtil.getTransformer(); DOMResult result = new DOMResult(); TransformerUtil.transform(transformer,source,result); return result.getNode(); } catch (ParsingException pe){ throw logger.processingError(pe); } }
public static Document getDocumentFromSource(Source source) throws ProcessingException, ConfigurationException { try { Transformer transformer = TransformerUtil.getTransformer(); DOMResult result = new DOMResult(); TransformerUtil.transform(transformer,source,result); return (Document) result.getNode(); } catch (ParsingException te) { throw logger.processingError(te); } }
public static Document getXACMLResponse(ResponseType responseType) throws ProcessingException { ByteArrayOutputStream baos = new ByteArrayOutputStream(); JAXBElement<?> jaxb = (new ObjectFactory()).createResponse(responseType); StreamResult result = new StreamResult(baos); try { TransformerUtil.transform(SAMLXACMLUtil.getJAXBContext(), jaxb, result); return DocumentUtil.getDocument(new String(baos.toByteArray())); } catch (Exception e) { throw logger.processingError(e); } }
public static Document getXACMLRequest(RequestType requestType) throws ProcessingException { ByteArrayOutputStream baos = new ByteArrayOutputStream(); // Marshaller marshaller = getMarshaller(); JAXBElement<?> jaxb = (new ObjectFactory()).createRequest(requestType); StreamResult result = new StreamResult(baos); try { TransformerUtil.transform(getJAXBContext(), jaxb, result); return DocumentUtil.getDocument(new String(baos.toByteArray())); } catch (Exception e) { throw logger.processingError(e); } } }
public static Document getXACMLResponse( ResponseType responseType ) throws ProcessingException { ByteArrayOutputStream baos = new ByteArrayOutputStream(); JAXBElement<?> jaxb = (new ObjectFactory()).createResponse( responseType ); StreamResult result = new StreamResult( baos ); try { TransformerUtil.transform( SAMLXACMLUtil.getJAXBContext(), jaxb, result); return DocumentUtil.getDocument( new String( baos.toByteArray() )); } catch ( Exception e ) { throw new ProcessingException( e ); } }
public static Document getXACMLResponse( ResponseType responseType ) throws ProcessingException { ByteArrayOutputStream baos = new ByteArrayOutputStream(); JAXBElement<?> jaxb = (new ObjectFactory()).createResponse( responseType ); StreamResult result = new StreamResult( baos ); try { TransformerUtil.transform( SAMLXACMLUtil.getJAXBContext(), jaxb, result); return DocumentUtil.getDocument( new String( baos.toByteArray() )); } catch ( Exception e ) { throw new ProcessingException( e ); } }
public static Document getXACMLRequest( RequestType requestType ) throws ProcessingException { ByteArrayOutputStream baos = new ByteArrayOutputStream(); //Marshaller marshaller = getMarshaller(); JAXBElement<?> jaxb = (new ObjectFactory()).createRequest( requestType ); StreamResult result = new StreamResult( baos ); try { TransformerUtil.transform( getJAXBContext(), jaxb, result); return DocumentUtil.getDocument( new String( baos.toByteArray() )); } catch ( Exception e ) { throw new ProcessingException( e ); } } }
public static Document getXACMLRequest( RequestType requestType ) throws ProcessingException { ByteArrayOutputStream baos = new ByteArrayOutputStream(); //Marshaller marshaller = getMarshaller(); JAXBElement<?> jaxb = (new ObjectFactory()).createRequest( requestType ); StreamResult result = new StreamResult( baos ); try { TransformerUtil.transform( getJAXBContext(), jaxb, result); return DocumentUtil.getDocument( new String( baos.toByteArray() )); } catch ( Exception e ) { throw new ProcessingException( e ); } } }
/** * Given that the {@code XMLEventReader} is in {@code XMLStreamConstants.START_ELEMENT} mode, we parse into a DOM Element * * @param xmlEventReader * @return * @throws ParsingException */ public static Element getDOMElement(XMLEventReader xmlEventReader) throws ParsingException { Transformer transformer = null; final String JDK_TRANSFORMER_PROPERTY = "picketlink.jdk.transformer"; boolean useJDKTransformer = Boolean.parseBoolean(SecurityActions.getSystemProperty(JDK_TRANSFORMER_PROPERTY, "false")); try { if (useJDKTransformer) { transformer = TransformerUtil.getTransformer(); } else { transformer = TransformerUtil.getStaxSourceToDomResultTransformer(); } Document resultDocument = DocumentUtil.createDocument(); DOMResult domResult = new DOMResult(resultDocument); Source source = new StAXSource(xmlEventReader); TransformerUtil.transform(transformer, source, domResult); Document doc = (Document) domResult.getNode(); return doc.getDocumentElement(); } catch (ConfigurationException e) { throw logger.parserException(e); } catch (XMLStreamException e) { throw logger.parserException(e); } }
TransformerUtil.transform(transformer, source, domResult);
TransformerUtil.transform(transformer, source, domResult);