• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java NanoXmlUtil类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.intellij.util.xml.NanoXmlUtil的典型用法代码示例。如果您正苦于以下问题:Java NanoXmlUtil类的具体用法?Java NanoXmlUtil怎么用?Java NanoXmlUtil使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



NanoXmlUtil类属于com.intellij.util.xml包,在下文中一共展示了NanoXmlUtil类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: parse

import com.intellij.util.xml.NanoXmlUtil; //导入依赖的package包/类
public static MultiMap<SchemaTypeInfo, SchemaTypeInfo> parse(final Reader reader) {
  try {
    final XsdComplexTypeInfoBuilder builder = new XsdComplexTypeInfoBuilder();
    final NameSpaceHelper helper = new NameSpaceHelper();
    builder.setNameSpaceHelper(helper);
    NanoXmlUtil.parse(reader, builder, helper);
    final MultiMap<SchemaTypeInfo,SchemaTypeInfo> map = builder.getMap();
    return map;
  } finally {
    try {
      if (reader != null) {
        reader.close();
      }
    }
    catch (IOException e) {
      // can never happen
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:XsdComplexTypeInfoBuilder.java


示例2: computeNamespace

import com.intellij.util.xml.NanoXmlUtil; //导入依赖的package包/类
public static XsdNamespaceBuilder computeNamespace(final Reader reader) {
  try {
    final XsdNamespaceBuilder builder = new XsdNamespaceBuilder();
    NanoXmlUtil.parse(reader, builder);
    HashSet<String> tags = new HashSet<String>(builder.getTags());
    tags.removeAll(builder.myReferencedTags);
    builder.getRootTags().addAll(tags);
    return builder;
  }
  finally {
    try {
      if (reader != null) {
        reader.close();
      }
    }
    catch (IOException e) {
      // can never happen
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:XsdNamespaceBuilder.java


示例3: computeTagNames

import com.intellij.util.xml.NanoXmlUtil; //导入依赖的package包/类
@NotNull
public static Collection<String> computeTagNames(final Reader reader) {
  try {
    final XsdTagNameBuilder builder = new XsdTagNameBuilder();
    NanoXmlUtil.parse(reader, builder);
    return builder.myTagNames;
  }
  finally {
    try {
      if (reader != null) {
        reader.close();
      }
    }
    catch (IOException e) {
      // can never happen
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:XsdTagNameBuilder.java


示例4: isSimilarFile

import com.intellij.util.xml.NanoXmlUtil; //导入依赖的package包/类
private static boolean isSimilarFile(FileContent inputData) {
  if (CharArrayUtil.indexOf(inputData.getContentAsText(), "<" + RESOURCES_ROOT_TAG, 0) < 0) {
    return false;
  }
  final boolean[] ourRootTag = {false};

  NanoXmlUtil.parse(CharArrayUtil.readerFromCharSequence(inputData.getContentAsText()), new NanoXmlUtil.IXMLBuilderAdapter() {
    @Override
    public void startElement(String name, String nsPrefix, String nsURI, String systemID, int lineNr)
      throws Exception {
      ourRootTag[0] = RESOURCES_ROOT_TAG.equals(name) && nsPrefix == null;
      stop();
    }
  });
  return ourRootTag[0];
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:AndroidValueResourcesIndex.java


示例5: parsePublicResCache

import com.intellij.util.xml.NanoXmlUtil; //导入依赖的package包/类
@Nullable
private void parsePublicResCache() {
  final String resDirPath = myTarget.getPath(IAndroidTarget.RESOURCES);
  final String publicXmlPath = resDirPath + '/' + SdkConstants.FD_RES_VALUES + "/public.xml";
  final VirtualFile publicXml = LocalFileSystem.getInstance().findFileByPath(FileUtil.toSystemIndependentName(publicXmlPath));

  if (publicXml != null) {
    try {
      final MyPublicResourceCacheBuilder builder = new MyPublicResourceCacheBuilder();
      NanoXmlUtil.parse(publicXml.getInputStream(), builder);

      synchronized (myPublicResourceCacheLock) {
        myPublicResourceCache = builder.getPublicResourceCache();
        myPublicResourceIdMap = builder.getIdMap();
      }
    }
    catch (IOException e) {
      LOG.error(e);
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:AndroidTargetData.java


示例6: getIds

import com.intellij.util.xml.NanoXmlUtil; //导入依赖的package包/类
@Nullable
protected Map<String, Set<String>> getIds(String content, final VirtualFile file, Project project) {
  if (!content.contains(JavaFXNamespaceProvider.JAVAFX_NAMESPACE)) {
    return null;
  }

  final Map<String, Set<String>> map = new HashMap<String, Set<String>>();
  final String path = file.getPath();
  final IXMLBuilder handler = createParseHandler(path, map);
  try {
    NanoXmlUtil.parse(new StringReader(content), handler);
  }
  catch (StopException ignore) {}
  final VirtualFile sourceRoot = ProjectRootManager.getInstance(project).getFileIndex().getSourceRootForFile(file);
  endDocument(path, sourceRoot, map, handler);
  return map;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:FxmlDataIndexer.java


示例7: computeNamespace

import com.intellij.util.xml.NanoXmlUtil; //导入依赖的package包/类
public static XsdNamespaceBuilder computeNamespace(final Reader reader) {
  try {
    final XsdNamespaceBuilder builder = new XsdNamespaceBuilder();
    NanoXmlUtil.parse(reader, builder);
    return builder;
  }
  finally {
    try {
      if (reader != null) {
        reader.close();
      }
    }
    catch (IOException e) {
      // can never happen
    }
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:18,代码来源:XsdNamespaceBuilder.java


示例8: computeTagNames

import com.intellij.util.xml.NanoXmlUtil; //导入依赖的package包/类
@Nullable
public static Collection<String> computeTagNames(final Reader reader) {
  try {
    final XsdTagNameBuilder builder = new XsdTagNameBuilder();
    NanoXmlUtil.parse(reader, builder);
    return builder.myTagNames;
  }
  finally {
    try {
      if (reader != null) {
        reader.close();
      }
    }
    catch (IOException e) {
      // can never happen
    }
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:19,代码来源:XsdTagNameBuilder.java


示例9: testXsdHeader

import com.intellij.util.xml.NanoXmlUtil; //导入依赖的package包/类
@Test
public void testXsdHeader() throws Exception {
  XmlFileHeader xmlFileHeader = NanoXmlUtil.parseHeaderWithException(new StringReader("<?xml version=\"1.0\"?>\n" +
                                                                                      "\n" +
                                                                                      "<note\n" +
                                                                                      "xmlns=\"https://www.w3schools.com\"\n" +
                                                                                      "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n" +
                                                                                      "xsi:schemaLocation=\"https://www.w3schools.com/xml/note.xsd\">\n" +
                                                                                      "  <to>Tove</to>\n" +
                                                                                      "  <from>Jani</from>\n" +
                                                                                      "  <heading>Reminder</heading>\n" +
                                                                                      "  <body>Don't forget me this weekend!</body>\n" +
                                                                                      "</note>"));

  assertEquals("note", xmlFileHeader.getRootTagLocalName());
  assertEquals("https://www.w3schools.com", xmlFileHeader.getRootTagNamespace());
}
 
开发者ID:consulo,项目名称:consulo,代码行数:18,代码来源:NanoXmlUtilTest.java


示例10: computeNamespace

import com.intellij.util.xml.NanoXmlUtil; //导入依赖的package包/类
public static XsdNamespaceBuilder computeNamespace(final Reader reader)
{
	try
	{
		final XsdNamespaceBuilder builder = new XsdNamespaceBuilder();
		NanoXmlUtil.parse(reader, builder);
		HashSet<String> tags = new HashSet<String>(builder.getTags());
		tags.removeAll(builder.myReferencedTags);
		builder.getRootTags().addAll(tags);
		return builder;
	}
	finally
	{
		try
		{
			if(reader != null)
			{
				reader.close();
			}
		}
		catch(IOException e)
		{
			// can never happen
		}
	}
}
 
开发者ID:consulo,项目名称:consulo-xml,代码行数:27,代码来源:XsdNamespaceBuilder.java


示例11: getIncludeInfos

import com.intellij.util.xml.NanoXmlUtil; //导入依赖的package包/类
@NotNull
@Override
public FileIncludeInfo[] getIncludeInfos(FileContent content) {
  final ArrayList<FileIncludeInfo> infos;

  if (content.getFileType() == XmlFileType.INSTANCE) {
    CharSequence inputDataContentAsText = content.getContentAsText();
    if (CharArrayUtil.indexOf(inputDataContentAsText, ApplicationLoader.RNG_NAMESPACE, 0) == -1) return FileIncludeInfo.EMPTY;
    infos = new ArrayList<FileIncludeInfo>();
    NanoXmlUtil.parse(CharArrayUtil.readerFromCharSequence(content.getContentAsText()), new RngBuilderAdapter(infos));
  } else if (content.getFileType() == RncFileType.getInstance()) {
    infos = new ArrayList<FileIncludeInfo>();
    content.getPsiFile().acceptChildren(new RncElementVisitor() {
      @Override
      public void visitElement(RncElement element) {
        element.acceptChildren(this);
      }

      @Override
      public void visitInclude(RncInclude include) {
        final String path = include.getFileReference();
        if (path != null) {
          infos.add(new FileIncludeInfo(path));
        }
      }
    });
  } else {
    return FileIncludeInfo.EMPTY;
  }
  return infos.toArray(new FileIncludeInfo[infos.size()]);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:32,代码来源:RelaxIncludeProvider.java


示例12: isTestngXML

import com.intellij.util.xml.NanoXmlUtil; //导入依赖的package包/类
public static boolean isTestngXML(final VirtualFile virtualFile) {
  if ("xml".equalsIgnoreCase(virtualFile.getExtension()) && virtualFile.isValid()) {
    final String result = NanoXmlUtil.parseHeader(virtualFile).getRootTagLocalName();
    if (result != null && result.equals(SUITE_TAG_NAME)) {
      return true;
    }
  }
  return false;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:TestNGUtil.java


示例13: parse

import com.intellij.util.xml.NanoXmlUtil; //导入依赖的package包/类
@Nullable
private static MyIXMLBuilderAdapter parse(CharSequence text, boolean stopIfAccepted) {
  StdXMLReader reader = new StdXMLReader(CharArrayUtil.readerFromCharSequence(text)) {
    @Override
    public Reader openStream(String publicID, String systemID) throws IOException {
      if (!HTTP_JAVA_SUN_COM_DTD_PROPERTIES_DTD.equals(systemID)) throw new IOException();
      return new StringReader(" ");
    }
  };
  MyIXMLBuilderAdapter builder = new MyIXMLBuilderAdapter(stopIfAccepted);
  NanoXmlUtil.parse(reader, builder);
  return builder;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:XmlPropertiesIndex.java


示例14: startElement

import com.intellij.util.xml.NanoXmlUtil; //导入依赖的package包/类
@Override
public void startElement(String name, String nsPrefix, String nsURI, String systemID, int lineNr)
  throws Exception {
  if (!accepted) {
    if ("properties".equals(name)) {
      accepted = true;
    }
    else throw NanoXmlUtil.ParserStoppedXmlException.INSTANCE;
  }
  else {
    insideEntry = "entry".equals(name);
  }
  if (myStopIfAccepted) throw NanoXmlUtil.ParserStoppedXmlException.INSTANCE;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:XmlPropertiesIndex.java


示例15: compute

import com.intellij.util.xml.NanoXmlUtil; //导入依赖的package包/类
public CachedValueProvider.Result<XsltChecker.LanguageLevel> compute(PsiFile psiFile) {
  if (!(psiFile instanceof XmlFile)) {
    return CachedValueProvider.Result.create(XsltChecker.LanguageLevel.NONE, PsiModificationTracker.MODIFICATION_COUNT);
  }

  final XmlFile xmlFile = (XmlFile)psiFile;
  if (psiFile instanceof PsiFileEx) {
    if (((PsiFileEx)psiFile).isContentsLoaded()) {
      final XmlDocument doc = xmlFile.getDocument();
      if (doc != null) {
        final XmlTag rootTag = doc.getRootTag();
        if (rootTag != null) {
          XmlAttribute v;
          XsltChecker.LanguageLevel level;
          if (isXsltRootTag(rootTag)) {
            v = rootTag.getAttribute("version");
            level = v != null ? XsltChecker.getLanguageLevel(v.getValue()) : XsltChecker.LanguageLevel.NONE;
          }
          else {
            v = rootTag.getAttribute("version", XSLT_NS);
            level = v != null ? XsltChecker.getLanguageLevel(v.getValue()) : XsltChecker.LanguageLevel.NONE;
          }
          return CachedValueProvider.Result.create(level, rootTag);
        }
      }
    }
  }

  final XsltChecker xsltChecker = new XsltChecker();
  NanoXmlUtil.parseFile(psiFile, xsltChecker);
  return CachedValueProvider.Result.create(xsltChecker.getLanguageLevel(), psiFile);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:33,代码来源:XsltSupport.java


示例16: createParseHandler

import com.intellij.util.xml.NanoXmlUtil; //导入依赖的package包/类
protected IXMLBuilder createParseHandler(final String path, final Map<String, Set<String>> map) {
  return new NanoXmlUtil.IXMLBuilderAdapter() {
    @Override
    public void addAttribute(String key, String nsPrefix, String nsURI, String value, String type) throws Exception {
      if (value != null && FxmlConstants.FX_ID.equals(nsPrefix + ":" + key)) {
        Set<String> paths = map.get(value);
        if (paths == null) {
          paths = new HashSet<String>();
          map.put(value, paths);
        }
        paths.add(path);
      }
    }
  };
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:FxmlDataIndexer.java


示例17: parse

import com.intellij.util.xml.NanoXmlUtil; //导入依赖的package包/类
@Nullable
private static MyIXMLBuilderAdapter parse(CharSequence text, boolean stopIfAccepted) {
  StdXMLReader reader = new StdXMLReader(CharArrayUtil.readerFromCharSequence(text)) {
    @Override
    public Reader openStream(String publicID, String systemID) throws IOException {
      if (!"http://java.sun.com/dtd/properties.dtd".equals(systemID)) throw new IOException();
      return new StringReader(" ");
    }
  };
  MyIXMLBuilderAdapter builder = new MyIXMLBuilderAdapter(stopIfAccepted);
  NanoXmlUtil.parse(reader, builder);
  return builder;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:14,代码来源:XmlPropertiesIndex.java


示例18: compute

import com.intellij.util.xml.NanoXmlUtil; //导入依赖的package包/类
public CachedValueProvider.Result<XsltChecker.LanguageLevel> compute(PsiFile psiFile) {
  if (!(psiFile instanceof XmlFile)) {
    return CachedValueProvider.Result.create(XsltChecker.LanguageLevel.NONE);
  }

  final XmlFile xmlFile = (XmlFile)psiFile;
  if (psiFile instanceof PsiFileEx) {
    if (((PsiFileEx)psiFile).isContentsLoaded()) {
      final XmlDocument doc = xmlFile.getDocument();
      if (doc != null) {
        final XmlTag rootTag = doc.getRootTag();
        if (rootTag != null) {
          XmlAttribute v;
          XsltChecker.LanguageLevel level;
          if (isXsltRootTag(rootTag)) {
            v = rootTag.getAttribute("version");
            level = v != null ? XsltChecker.getLanguageLevel(v.getValue()) : XsltChecker.LanguageLevel.NONE;
          }
          else {
            v = rootTag.getAttribute("version", XSLT_NS);
            level = v != null ? XsltChecker.getLanguageLevel(v.getValue()) : XsltChecker.LanguageLevel.NONE;
          }
          return CachedValueProvider.Result.create(level, rootTag);
        }
      }
    }
  }

  final XsltChecker xsltChecker = new XsltChecker();
  NanoXmlUtil.parseFile(psiFile, xsltChecker);
  return CachedValueProvider.Result.create(xsltChecker.getLanguageLevel(), psiFile);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:33,代码来源:XsltSupport.java


示例19: testDtdHeader

import com.intellij.util.xml.NanoXmlUtil; //导入依赖的package包/类
@Test
public void testDtdHeader() throws Exception {
  XmlFileHeader xmlFileHeader = NanoXmlUtil.parseHeaderWithException(new StringReader("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" +
                                                                                      "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n" +
                                                                                      "\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n" +
                                                                                      "<!-- the XHTML document body starts here-->\n" +
                                                                                      "<html xmlns=\"http://www.w3.org/1999/xhtml\">\n" +
                                                                                      "</html>"));

  assertEquals("html", xmlFileHeader.getRootTagLocalName());
  assertEquals("http://www.w3.org/1999/xhtml", xmlFileHeader.getRootTagNamespace());
  assertEquals("-//W3C//DTD XHTML 1.0 Transitional//EN", xmlFileHeader.getPublicId());
  assertEquals("http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd", xmlFileHeader.getSystemId());
}
 
开发者ID:consulo,项目名称:consulo,代码行数:15,代码来源:NanoXmlUtilTest.java


示例20: compute

import com.intellij.util.xml.NanoXmlUtil; //导入依赖的package包/类
public CachedValueProvider.Result<XsltChecker.LanguageLevel> compute(PsiFile psiFile) {
  if (!(psiFile instanceof XmlFile)) {
    return CachedValueProvider.Result.create(XsltChecker.LanguageLevel.NONE);
  }

  final XmlFile xmlFile = (XmlFile)psiFile;
  if (psiFile instanceof PsiFileEx) {
    if (((PsiFileEx)psiFile).isContentsLoaded()) {
      final XmlDocument doc = xmlFile.getDocument();
      if (doc != null) {
        final XmlTag rootTag = doc.getRootTag();
        if (rootTag != null) {
          XmlAttribute v;
          XsltChecker.LanguageLevel level;
          if (isXsltRootTag(rootTag)) {
            v = rootTag.getAttribute("version");
            level = v != null ? XsltChecker.getLanguageLevel(v.getValue()) : XsltChecker.LanguageLevel.NONE;
          } else {
            v = rootTag.getAttribute("version", XSLT_NS);
            level = v != null ? XsltChecker.getLanguageLevel(v.getValue()) : XsltChecker.LanguageLevel.NONE;
          }
          return CachedValueProvider.Result.create(level, rootTag);
        }
      }
    }
  }

  final XsltChecker xsltChecker = new XsltChecker();
  NanoXmlUtil.parseFile(psiFile, xsltChecker);
  return CachedValueProvider.Result.create(xsltChecker.getLanguageLevel(), psiFile);
}
 
开发者ID:consulo,项目名称:consulo-xslt,代码行数:32,代码来源:XsltSupport.java



注:本文中的com.intellij.util.xml.NanoXmlUtil类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java JndiLdapRealm类代码示例发布时间:2022-05-22
下一篇:
Java LocalDisplay类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap