本文整理匯總了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();
}