/** * Sets the URIResolver to use during transformations. */ public static void setURIResolver(URIResolver resolver) { if (uriResolver != resolver) { uriResolver = resolver; transformerFactory = null; getTransformerFactory(); } }
/** * Sets the URIResolver to use during transformations. */ public static void setURIResolver(URIResolver resolver) { if (uriResolver != resolver) { uriResolver = resolver; transformerFactory = null; getTransformerFactory(); } }
/** * Overide the transformer to use for XSLT transformations (and by * implication serialization and XPaths). * This is useful when comparing transformer implementations. */ public static void setTransformerFactory(String className) { System.setProperty("javax.xml.transform.TransformerFactory", className); transformerFactory = null; getTransformerFactory(); }
/** * Overide the transformer to use for XSLT transformations (and by * implication serialization and XPaths). * This is useful when comparing transformer implementations. */ public static void setTransformerFactory(String className) { System.setProperty("javax.xml.transform.TransformerFactory", className); transformerFactory = null; getTransformerFactory(); }
public FedoraTestCase() { TransformerFactory factory = XMLUnit.getTransformerFactory(); if (factory.getClass().getName() .equals("net.sf.saxon.TransformerFactoryImpl")) { factory.setAttribute(FeatureKeys.VERSION_WARNING, Boolean.FALSE); } }
public FedoraTestCase(String name) { TransformerFactory factory = XMLUnit.getTransformerFactory(); if (factory.getClass().getName() .equals("net.sf.saxon.TransformerFactoryImpl")) { factory.setAttribute(FeatureKeys.VERSION_WARNING, Boolean.FALSE); } }
/** * Factory method * @param stylesheetSource * @throws ConfigurationException * @return */ private Transformer getTransformer(Source stylesheetSource) throws ConfigurationException { try { TransformerFactory factory = XMLUnit.getTransformerFactory(); Transformer t = stylesheetSource == null ? factory.newTransformer() : factory.newTransformer(stylesheetSource); return t; } catch (javax.xml.transform.TransformerConfigurationException ex) { throw new ConfigurationException(ex); } }
/** * Returns a new Document instance that is identical to the one * passed in with element content whitespace removed. * * <p>Will use {@link #getStripWhitespaceTransform * getStripWhitespaceTransform} unless we are operating under the * severly broken XSLTC Transformer shipping with JDK 1.5.</p> */ public static Document getWhitespaceStrippedDocument(Document forDoc) { String factory = getTransformerFactory().getClass().getName(); if (XSLTConstants.JAVA5_XSLTC_FACTORY_NAME.equals(factory)) { return stripWhiteSpaceWithoutXSLT(forDoc); } else { return stripWhiteSpaceUsingXSLT(forDoc); } }
/** * Returns a new Document instance that is identical to the one * passed in with element content whitespace removed. * * <p>Will use {@link #getStripWhitespaceTransform * getStripWhitespaceTransform} unless we are operating under the * severly broken XSLTC Transformer shipping with JDK 1.5.</p> */ public static Document getWhitespaceStrippedDocument(Document forDoc) { String factory = getTransformerFactory().getClass().getName(); if (XSLTConstants.JAVA5_XSLTC_FACTORY_NAME.equals(factory)) { return stripWhiteSpaceWithoutXSLT(forDoc); } else { return stripWhiteSpaceUsingXSLT(forDoc); } }
/** * Create a transformation using Source input XML and Source stylesheet * @param inputSource * @param stylesheetSource */ public Transform(Source inputSource, Source stylesheetSource) { transformation = new Transformation(inputSource); transformation.setStylesheet(stylesheetSource); transformation.setFactory(XMLUnit.getTransformerFactory()); provideSystemIdIfRequired(inputSource); provideSystemIdIfRequired(stylesheetSource); }