com.intellij.psi.xml.XmlTag.getValue()方法的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(9.0k)|赞(0)|评价(0)|浏览(152)

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

XmlTag.getValue介绍

暂无

代码示例

代码示例来源:origin: Haehnchen/idea-php-symfony2-plugin

/**
 * <route controller="Foo"/>
 * <route>
 *     <default key="_controller">Foo</default>
 * </route>
 */
@Nullable
public static String getXmlController(@NotNull XmlTag serviceTag) {
  for(XmlTag subTag :serviceTag.getSubTags()) {
    if("default".equalsIgnoreCase(subTag.getName())) {
      String keyValue = subTag.getAttributeValue("key");
      if(keyValue != null && "_controller".equals(keyValue)) {
        String actionName = subTag.getValue().getTrimmedText();
        if(StringUtils.isNotBlank(actionName)) {
          return actionName;
        }
      }
    }
  }
  String controller = serviceTag.getAttributeValue("controller");
  if(controller != null && StringUtils.isNotBlank(controller)) {
    return controller;
  }
  return null;
}

代码示例来源:origin: Haehnchen/idea-php-symfony2-plugin

XmlTagValue keyTag = ((XmlTag) psiElement).getValue();
String key = StringUtils.trim(keyTag.getText());
if(!ArrayUtils.contains(keys, key)) {
XmlTagValue valueTag = tdTag.getValue();
String value = valueTag.getText();
if(StringUtils.isBlank(value)) {

代码示例来源:origin: Haehnchen/idea-php-symfony2-plugin

XmlTagValue keyTag = ((XmlTag) psiElement).getValue();
String contents = StringUtils.trim(keyTag.getText());
if(!"Rendered Templates".equalsIgnoreCase(contents)) {
String template = stripHtmlTags(StringUtils.trim(tds[0].getValue().getText()));
if(StringUtils.isBlank(template)) {
  continue;
  count = Integer.valueOf(stripHtmlTags(StringUtils.trim(tds[1].getValue().getText())));
} catch (NumberFormatException e) {
  count = 0;

代码示例来源:origin: Haehnchen/idea-php-symfony2-plugin

header.add(StringUtils.trim(stripHtmlTags(th.getValue().getText())).toLowerCase());

代码示例来源:origin: Haehnchen/idea-php-symfony2-plugin

XmlTagValue attrClass = parameterTag.getValue();
String myParameterValue = attrClass.getText();

代码示例来源:origin: Haehnchen/idea-php-symfony2-plugin

XmlTag source = xmlTag.findFirstSubTag("source");
if (source != null) {
  String text = source.getValue().getText();
  if (key.equalsIgnoreCase(text)) {
    psiElements.add(source);

代码示例来源:origin: Haehnchen/idea-php-symfony2-plugin

source.getValue().setText(keyName);
target.getValue().setText(translation);
source.getValue().setText(keyName);
target.getValue().setText(translation);

代码示例来源:origin: Haehnchen/idea-php-symfony2-plugin

public void testGetTargetForXlfAsXmlFileInVersion12() {
  PsiFile fileFromText = PsiFileFactory.getInstance(getProject()).createFileFromText(XMLLanguage.INSTANCE, "" +
    "<?xml version=\"1.0\"?>\n" +
    "<xliff version=\"1.2\" xmlns=\"urn:oasis:names:tc:xliff:document:1.2\">\n" +
    "    <file source-language=\"en\" datatype=\"plaintext\" original=\"file.ext\">\n" +
    "        <body>\n" +
    "            <trans-unit id=\"1\">\n" +
    "                <source>This value should be false.</source>\n" +
    "            </trans-unit>\n" +
    "        </body>\n" +
    "    </file>\n" +
    "</xliff>\n"
  );
  Collection<PsiElement> files = TranslationUtil.getTargetForXlfAsXmlFile((XmlFile) fileFromText, "This value should be false.");
  assertNotNull(ContainerUtil.find(files, psiElement ->
    psiElement instanceof XmlTag && "This value should be false.".equals(((XmlTag) psiElement).getValue().getText()))
  );
}

代码示例来源:origin: Haehnchen/idea-php-symfony2-plugin

public void testGetTargetForXlfAsXmlFileInVersion20Shortcut() {
  PsiFile fileFromText = PsiFileFactory.getInstance(getProject()).createFileFromText(XMLLanguage.INSTANCE, "" +
    "<xliff xmlns=\"urn:oasis:names:tc:xliff:document:2.0\" version=\"2.0\"\n" +
    " srcLang=\"en-US\" trgLang=\"ja-JP\">\n" +
    " <file id=\"f1\" original=\"Graphic Example.psd\">\n" +
    "  <skeleton href=\"Graphic Example.psd.skl\"/>\n" +
    "  <unit id=\"1\">\n" +
    "   <segment>\n" +
    "    <source>foo</source>\n" +
    "   </segment>\n" +
    "  </unit>\n" +
    " </file>\n" +
    "</xliff>"
  );
  Collection<PsiElement> files = TranslationUtil.getTargetForXlfAsXmlFile((XmlFile) fileFromText, "foo");
  assertNotNull(ContainerUtil.find(files, psiElement ->
    psiElement instanceof XmlTag && "foo".equals(((XmlTag) psiElement).getValue().getText()))
  );
}

代码示例来源:origin: Haehnchen/idea-php-symfony2-plugin

public void testGetTargetForXlfAsXmlFileInVersion20() {
  PsiFile fileFromText = PsiFileFactory.getInstance(getProject()).createFileFromText(XMLLanguage.INSTANCE, "" +
    "<?xml version=\"1.0\"?>\n" +
    "<xliff xmlns=\"urn:oasis:names:tc:xliff:document:2.0\"\n" +
    "       version=\"2.0\" srcLang=\"en-US\" trgLang=\"ja-JP\">\n" +
    "    <file id=\"f1\" original=\"Graphic Example.psd\">\n" +
    "        <skeleton href=\"Graphic Example.psd.skl\"/>\n" +
    "        <group id=\"1\">\n" +
    "            <unit id=\"1\">\n" +
    "                <segment>\n" +
    "                    <source>foo</source>\n" +
    "                </segment>\n" +
    "            </unit>\n" +
    "        </group>\n" +
    "    </file>\n" +
    "</xliff>"
  );
  Collection<PsiElement> files = TranslationUtil.getTargetForXlfAsXmlFile((XmlFile) fileFromText, "foo");
  assertNotNull(ContainerUtil.find(files, psiElement ->
    psiElement instanceof XmlTag && "foo".equals(((XmlTag) psiElement).getValue().getText()))
  );
}

代码示例来源:origin: GoogleCloudPlatform/google-cloud-intellij

private boolean isFlexCompatEnvFlex(@Nullable XmlTag compatConfig) {
 return compatConfig != null
   && "env".equalsIgnoreCase(compatConfig.getName())
   && "flex".equalsIgnoreCase(compatConfig.getValue().getTrimmedText());
}

代码示例来源:origin: GoogleCloudPlatform/google-cloud-intellij

private boolean isFlexCompatVmTrue(@Nullable XmlTag compatConfig) {
 return compatConfig != null
   && "vm".equalsIgnoreCase(compatConfig.getName())
   && Boolean.parseBoolean(compatConfig.getValue().getTrimmedText());
}

代码示例来源:origin: AlexanderBartash/hybris-integration-intellij-idea-plugin

private String localizeDescription(final DomElement dom) {
  if (dom instanceof Description) {
    final XmlElement xmlElement = dom.getXmlElement();
    if (xmlElement instanceof XmlTag) {
      final XmlTagValue value = ((XmlTag) xmlElement).getValue();
      if (value != null) {
        return value.getTrimmedText();
      }
    }
  }
  return null;
}

代码示例来源:origin: GoogleCloudPlatform/google-cloud-intellij

@Override
 public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor) {
  if (descriptor.getPsiElement() != null && descriptor.getPsiElement() instanceof XmlTag) {
   XmlTag xmlTag = (XmlTag) descriptor.getPsiElement();
   xmlTag.getValue().setText(APP_ENGINE_JAVA8_RUNTIME_VALUE);
  }
 }
}

代码示例来源:origin: GoogleCloudPlatform/google-cloud-intellij

@VisibleForTesting
String getServiceNameFromAppEngineWebXml(XmlFile appengineWebXml) {
 if (appengineWebXml != null) {
  XmlTag root = appengineWebXml.getRootTag();
  if (root != null) {
   XmlTag serviceTag = root.findFirstSubTag("service");
   if (serviceTag != null) {
    return serviceTag.getValue().getText();
   }
   XmlTag moduleTag = root.findFirstSubTag("module");
   if (moduleTag != null) {
    return moduleTag.getValue().getText();
   }
  }
 }
 return DEFAULT_SERVICE;
}

代码示例来源:origin: GoogleCloudPlatform/google-cloud-intellij

/**
  * Returns {@code true} if the inspected tag is part of an appengine-web.xml config file, is a
  * runtime tag, and the value is a deprecated Java runtime.
  */
 private boolean isAppEngineWebXmlDeprecatedRuntimeTag(XmlTag tag) {
  if (tag != null && tag.getContainingFile() instanceof XmlFile) {
   XmlFile xmlFile = (XmlFile) tag.getContainingFile();
   boolean isAppEngineWebXml =
     xmlFile.getRootTag() != null
       && AppEngineUtil.APP_ENGINE_WEB_XML_NAME.equals(xmlFile.getName())
       && AppEngineUtil.APP_ENGINE_WEB_XML_ROOT_TAG_NAME.equals(
         xmlFile.getRootTag().getName());

   if (isAppEngineWebXml) {
    return APP_ENGINE_WEB_XML_RUNTIME_TAG_NAME.equals(tag.getName())
      && deprecatedRuntimes.contains(tag.getValue().getText());
   }
  }

  return false;
 }
}

代码示例来源:origin: misakuo/svgtoandroid

private void init() {
  if (style != null) {
    String styleContent = style.getValue().getText();
    if (styleContent != null && !styleContent.isEmpty()) {
      InputSource source = new InputSource(new StringReader(styleContent));
      CSSOMParser parser = new CSSOMParser(new SACParserCSS3());
      parser.setErrorHandler(new ParserErrorHandler());
      try {
        styleSheet = parser.parseStyleSheet(source, null, null);
        cssFormat = new CSSFormat().setRgbAsHex(true);
        CSSRuleList rules = styleSheet.getCssRules();
        for (int i = 0; i < rules.getLength(); i++) {
          final CSSRule rule = rules.item(i);
          if (rule instanceof CSSStyleRuleImpl) {
            styleRuleMap.put(((CSSStyleRuleImpl) rule).getSelectorText(), (CSSStyleRuleImpl) rule);
          }
        }
      } catch (IOException e) {
        e.printStackTrace();
      }
    }
  }
}

相关文章