本文整理汇总了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());
}
}
示例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;
}
示例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", ""));
}
}
}
}
示例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;
}
示例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 );
}
示例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());
}
}
示例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 ) : "";
}
示例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();
}