javax.xml.transform.Transformer.getParameter()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(4.2k)|赞(0)|评价(0)|浏览(114)

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

Transformer.getParameter介绍

[英]Get a parameter that was explicitly set with setParameter.

This method does not return a default parameter value, which cannot be determined until the node context is evaluated during the transformation process.
[中]

代码示例

代码示例来源:origin: org.custommonkey.xmlunit/com.springsource.org.custommonkey.xmlunit

/**
 * See a parameter used for the transformation
 * @param name
 * @return the parameter value
 * @see Transformer#getParameter(java.lang.String)
 */
public Object getParameter(String name) {
  return transformer.getParameter(name);
}

代码示例来源:origin: org.jasig.portal/uportal3-impl

/**
   * A helper method to obtain portal url stack from transformer impl.
   * 
   * @param transformer
   * @return portal url stack or <code>null</code> if it hasn't been created.
   */
  public static Stack getUrlStack(Transformer transformer) {
    return (Stack) transformer.getParameter(PORTAL_URL_STACK_PARAMETER_NAME);
  }
}

代码示例来源:origin: org.jasig.portal/uportal3-impl

/**
 * A helper method to obtain string buffer representing current add commands
 * 
 * @param transformer
 * @return add commands <code>StringBuffer</code> or <code>null</code> if it hasn't been created.
 */
 protected static StringBuffer getAddStringBuffer(Transformer transformer) {
  Boolean bufferCleared=(Boolean) transformer.getParameter(LAYOUT_ADD_STRINGBUFFER_CLEARED_PARAMETER_NAME);
  if(bufferCleared!=null && bufferCleared.booleanValue()) {
    // buffer has been cleared
    return null;
  } else {
    return (StringBuffer) transformer.getParameter(LAYOUT_ADD_STRINGBUFFER_PARAMETER_NAME);
  }
}

代码示例来源:origin: org.jasig.portal/uportal3-impl

/**
 * A helper method to obtain portal url stack from a transformer impl,
 * creating a new one if neccessary. This can be done manually using get/set
 * transformer parameter methods.
 * @param transformer
 * @return
 * @see PORTAL_URL_STACK_PARAMETER_NAME
 */
public static Stack getCreateUrlStack(Transformer transformer) {
  Stack urlStack=(Stack) transformer.getParameter(PORTAL_URL_STACK_PARAMETER_NAME);
  if(urlStack==null) {
    urlStack=new Stack();
    transformer.setParameter(PORTAL_URL_STACK_PARAMETER_NAME,urlStack);
  }
  return urlStack;
}

代码示例来源:origin: apache/servicemix-bundles

@Override
public Object getParameter(String str) {
  try {
    materialize();
    return m_realTransformer.getParameter(str);
  } catch (TransformerException e) {
    // will be caught later
  }
  return null;
}

代码示例来源:origin: org.codehaus.enunciate/enunciate-full

debug("Extra downloads exist: %b", transformer.getParameter("downloads-exists"));

代码示例来源:origin: org.codehaus.enunciate/enunciate-docs

protected void doXSLT(URL xsltURL) throws IOException, EnunciateException {
 debug("Using stylesheet %s", xsltURL);
 StreamSource source = new StreamSource(xsltURL.openStream());
 try {
  Transformer transformer = SAXTransformerFactory.newInstance().newTransformer(source);
  transformer.setURIResolver(new URIResolver() {
   public Source resolve(String href, String base) throws TransformerException {
    return new StreamSource(new File(getGenerateDir(), href));
   }
  });
  transformer.setParameter("downloads-exists", new File(getGenerateDir(), "downloads.xml").exists());
  debug("Extra downloads exist: %b", transformer.getParameter("downloads-exists"));
  File docsXml = new File(getGenerateDir(), "docs.xml");
  File buildDir = getDocsBuildDir();
  buildDir.mkdirs();
  transformer.setParameter("output-dir", buildDir.getAbsolutePath() + File.separator);
  transformer.setParameter("api-relative-path", getRelativePathToRootDir());
  transformer.setParameter("index-page-name", getIndexPageName());
  transformer.setParameter("disable-rest-mountpoint", isDisableRestMountpoint());
  transformer.setParameter("group-rest-resources", getGroupRestResources());
  File indexPage = new File(buildDir, getIndexPageName());
  debug("Transforming %s to %s.", docsXml, indexPage);
  transformer.transform(new StreamSource(docsXml), new StreamResult(indexPage));
 }
 catch (TransformerException e) {
  throw new EnunciateException("Error during transformation of the documentation (stylesheet " + xsltURL +
   ", document " + new File(getGenerateDir(), "docs.xml") + ")", e);
 }
}

相关文章