當前位置: 首頁>>代碼示例>>Java>>正文


Java Xpp3Dom.getAttribute方法代碼示例

本文整理匯總了Java中org.codehaus.plexus.util.xml.Xpp3Dom.getAttribute方法的典型用法代碼示例。如果您正苦於以下問題:Java Xpp3Dom.getAttribute方法的具體用法?Java Xpp3Dom.getAttribute怎麽用?Java Xpp3Dom.getAttribute使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.codehaus.plexus.util.xml.Xpp3Dom的用法示例。


在下文中一共展示了Xpp3Dom.getAttribute方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: patchGwtModule

import org.codehaus.plexus.util.xml.Xpp3Dom; //導入方法依賴的package包/類
/**
 * Patches the IDE GWT module by replacing inheritance of Full.gwt.xml by
 * Full-with-excludes.gwt.xml.
 */
private void patchGwtModule() throws XmlPullParserException, IOException {
  String gwtModuleFileRelPath = getGwtModule().replace('.', '/') + ".gwt.xml";
  Path gwtModuleFilePath = Paths.get(outputDirectory.getPath(), gwtModuleFileRelPath);

  Xpp3Dom module = Xpp3DomBuilder.build(Files.newInputStream(gwtModuleFilePath), UTF_8.name());

  for (int i = module.getChildCount() - 1; i >= 0; i--) {
    Xpp3Dom child = module.getChild(i);

    if ("inherits".equals(child.getName())) {
      String moduleName = child.getAttribute("name");

      if (moduleName.equals(fullIdeGwtModule)) {
        child.setAttribute("name", fullIdeGwtModule + FULL_IDE_GWT_MODULE_SUFFIX);
        break;
      }
    }
  }

  try (Writer writer = new StringWriter()) {
    XMLWriter xmlWriter = new PrettyPrintXMLWriter(writer);
    Xpp3DomWriter.write(xmlWriter, module);
    Files.write(gwtModuleFilePath, writer.toString().getBytes());
  }
}
 
開發者ID:eclipse,項目名稱:che,代碼行數:30,代碼來源:ProcessExcludesMojo.java

示例2: initialValue

import org.codehaus.plexus.util.xml.Xpp3Dom; //導入方法依賴的package包/類
protected Map<String,String> initialValue() {
  Map<String, String> map = new HashMap<String, String>();
  ClasspathResourceMap resources = scanner.matchResource(".*[.]gwt[.]*xml")
      .scan(Thread.currentThread().getContextClassLoader());
  for (StringDataResource resource : resources.findResources("", GWT_XML_PATTERN)) {
    try {
      Xpp3Dom dom = Xpp3DomBuilder.build(resource.open(), "UTF-8");
      String rename = dom.getAttribute("rename-to");
      if (rename != null) {
        String resName = resource.getResourceName().replace('/', '.');
        resName = resName.substring(0, resName.lastIndexOf("gwt")-1);
        map.put(rename, resName);
        X_Log.trace("Found gwt module rename; ", rename," -> ",resName);
      }
    } catch (Exception e) {
      X_Log.error("Error reading xml from ",resource.getResourceName(),e
          ,"\nSet xapi.log.level=TRACE to see the faulty xml");
      X_Log.trace("Faulty xml: ",resource.readAll());
    }
  };
  return map;
}
 
開發者ID:WeTheInternet,項目名稱:xapi,代碼行數:23,代碼來源:RemoteClasspathServiceImpl.java

示例3: findModules

import org.codehaus.plexus.util.xml.Xpp3Dom; //導入方法依賴的package包/類
private void findModules(File rootFile, File f, Collection<String> into) throws FileNotFoundException,
      XmlPullParserException, IOException {
      if (f.isDirectory()) {
        for (File child : f.listFiles(gwt_xml_filter)) {
          findModules(rootFile, child, into);
        }
      } else if (f.getName().endsWith(".gwt.xml")) {
        getLog().debug("Checking for entry points in " + f);
        // try to get entry points
        Xpp3Dom dom = Xpp3DomBuilder.build(new FileReader(f));
        getLog().debug(dom.toString());
        for (Xpp3Dom entry : dom.getChildren("entry-point")) {
          String attr = entry.getAttribute("class");
          if (null != attr && attr.length() > 0) {
//            into.add(attr.substring(0,
//                attr.lastIndexOf('.', attr.lastIndexOf('.') - 1))
//                + "." + f.getName().replace(".gwt.xml", ""));
            String mod = f.getAbsolutePath().substring(rootFile.getAbsolutePath().length()+1);
            into.add(mod.replace('/', '.').replace(".gwt.xml", ""));
          }
        }
      }
    }
 
開發者ID:WeTheInternet,項目名稱:xapi,代碼行數:24,代碼來源:CodeServerMojo.java

示例4: findModule

import org.codehaus.plexus.util.xml.Xpp3Dom; //導入方法依賴的package包/類
private String findModule(File f) throws FileNotFoundException,
    XmlPullParserException, IOException {
  if (f.isDirectory()) {
    String module;
    for (File child : f.listFiles(gwt_xml_filter)) {
      module = findModule(child);
      if (module != null) {
        return module;
      }
    }
  } else if (f.getName().endsWith(".gwt.xml")) {
    getLog().debug("Checking for entry points in " + f);
    // try to get entry points
    Xpp3Dom dom = Xpp3DomBuilder.build(new FileReader(f));
    getLog().debug(dom.toString());
    for (Xpp3Dom entry : dom.getChildren("entry-point")) {
      String attr = entry.getAttribute("class");
      if (null != attr && attr.length() > 0) {
        return attr.substring(0,
            attr.lastIndexOf('.', attr.lastIndexOf('.') - 1))
            + "." + f.getName().replace(".gwt.xml", "");
      }
    }
  }
  return null;
}
 
開發者ID:WeTheInternet,項目名稱:xapi,代碼行數:27,代碼來源:CodeServerMojo.java

示例5: setAttribute

import org.codehaus.plexus.util.xml.Xpp3Dom; //導入方法依賴的package包/類
private static void setAttribute( Xpp3Dom dom, String attribute, String value )
{
    String attr = dom.getAttribute( attribute );

    if ( attr == null || value == null || value.length() <= 0 )
    {
        return;
    }

    dom.setAttribute( attribute, value );
}
 
開發者ID:javiersigler,項目名稱:apache-maven-shade-plugin,代碼行數:12,代碼來源:PluginXmlResourceTransformer.java

示例6: createFullIdeModuleWithExcludes

import org.codehaus.plexus.util.xml.Xpp3Dom; //導入方法依賴的package包/類
/** Creates copy of the Full.gwt.xml with removed '<inherits>' for the excluded GWT modules. */
private void createFullIdeModuleWithExcludes(Set<String> modulesToExclude)
    throws XmlPullParserException, IOException {
  String fullIdeGwtModulePath = fullIdeGwtModule.replace('.', '/') + ".gwt.xml";
  String fullIdeGwtModuleContent =
      getFileContent(new ZipFile(fullIdeArtifact.getFile()), fullIdeGwtModulePath);

  InputStream in = new ByteArrayInputStream(fullIdeGwtModuleContent.getBytes(UTF_8.name()));
  Xpp3Dom module = Xpp3DomBuilder.build(in, UTF_8.name());

  for (int i = module.getChildCount() - 1; i >= 0; i--) {
    Xpp3Dom child = module.getChild(i);

    if ("inherits".equals(child.getName())) {
      String moduleName = child.getAttribute("name");

      if (modulesToExclude.contains(moduleName)) {
        module.removeChild(i);
      }
    }
  }

  String moduleRelPath =
      fullIdeGwtModulePath.replace(".gwt.xml", FULL_IDE_GWT_MODULE_SUFFIX + ".gwt.xml");

  Path modulePath = Paths.get(outputDirectory.getPath(), moduleRelPath);

  try (Writer writer = new StringWriter()) {
    XMLWriter xmlWriter = new PrettyPrintXMLWriter(writer);
    Xpp3DomWriter.write(xmlWriter, module);
    Files.write(modulePath, writer.toString().getBytes());
  }
}
 
開發者ID:eclipse,項目名稱:che,代碼行數:34,代碼來源:ProcessExcludesMojo.java

示例7: getAttribute

import org.codehaus.plexus.util.xml.Xpp3Dom; //導入方法依賴的package包/類
private static String getAttribute( Xpp3Dom dom, String attribute )
{
    return ( dom.getAttribute( attribute ) != null ) ? dom.getAttribute( attribute ) : "";
}
 
開發者ID:javiersigler,項目名稱:apache-maven-shade-plugin,代碼行數:5,代碼來源:PluginXmlResourceTransformer.java

示例8: getMojoConfigurationValue

import org.codehaus.plexus.util.xml.Xpp3Dom; //導入方法依賴的package包/類
@Nullable
protected String getMojoConfigurationValue(@Nonnull MojoExecution execution, @Nonnull String elementName) {
    Xpp3Dom element = execution.getConfiguration().getChild(elementName);
    return element == null ? null : element.getValue() == null ? element.getAttribute("default-value") : element.getValue();
}
 
開發者ID:jenkinsci,項目名稱:pipeline-maven-plugin,代碼行數:6,代碼來源:AbstractExecutionHandler.java


注:本文中的org.codehaus.plexus.util.xml.Xpp3Dom.getAttribute方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。