当前位置: 首页>>代码示例>>Java>>正文


Java XmlProlog.getDoctype方法代码示例

本文整理汇总了Java中com.intellij.psi.xml.XmlProlog.getDoctype方法的典型用法代码示例。如果您正苦于以下问题:Java XmlProlog.getDoctype方法的具体用法?Java XmlProlog.getDoctype怎么用?Java XmlProlog.getDoctype使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.psi.xml.XmlProlog的用法示例。


在下文中一共展示了XmlProlog.getDoctype方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: is23

import com.intellij.psi.xml.XmlProlog; //导入方法依赖的package包/类
private static boolean is23(final ConvertContext context) {
  final DomElement element = DomUtil.getFileElement(context.getInvocationElement()).getRootElement();
  final XmlTag tag = element.getXmlTag();
  if (tag != null && "web-app".equals(element.getXmlElementName()) && tag.getAttribute("version") == null) {
    XmlDocument document = (XmlDocument)tag.getParent();
    final XmlProlog prolog = document.getProlog();
    if (prolog != null) {
      final XmlDoctype doctype = prolog.getDoctype();
      if (doctype != null) {
        final String uri = doctype.getDtdUri();
        if (uri != null && uri.contains("2_3")) return true;
      }
    }
    return false;
  }
  return true;
}
 
开发者ID:consulo,项目名称:consulo-javaee,代码行数:18,代码来源:ResAuthConverter.java

示例2: hasDtdDeclaration

import com.intellij.psi.xml.XmlProlog; //导入方法依赖的package包/类
private boolean hasDtdDeclaration() {
  XmlDocument document = myFile.getDocument();
  if (document == null) return false;
  XmlProlog prolog = document.getProlog();
  if (prolog == null) return false;
  XmlDoctype doctype = prolog.getDoctype();
  if (doctype == null) return false;

  return true;
}
 
开发者ID:consulo,项目名称:consulo-xml,代码行数:11,代码来源:ValidateXmlActionHandler.java

示例3: hasNonHtml5Doctype

import com.intellij.psi.xml.XmlProlog; //导入方法依赖的package包/类
public static boolean hasNonHtml5Doctype(XmlElement context)
{
	XmlDocument doc = PsiTreeUtil.getParentOfType(context, XmlDocument.class);
	if(doc == null)
	{
		return false;
	}
	XmlProlog prolog = doc.getProlog();
	XmlDoctype doctype = prolog != null ? prolog.getDoctype() : null;
	return doctype != null && !isHtml5Doctype(doctype);
}
 
开发者ID:consulo,项目名称:consulo-xml,代码行数:12,代码来源:HtmlUtil.java

示例4: getRootElementsDescriptors

import com.intellij.psi.xml.XmlProlog; //导入方法依赖的package包/类
@Override
@NotNull
public XmlElementDescriptor[] getRootElementsDescriptors(@Nullable final XmlDocument document)
{
	// Suggest more appropriate variant if DOCTYPE <element_name> exists
	final XmlProlog prolog = document != null ? document.getProlog() : null;

	if(prolog != null)
	{
		final XmlDoctype doctype = prolog.getDoctype();

		if(doctype != null)
		{
			final XmlElement element = doctype.getNameElement();

			if(element != null)
			{
				final XmlElementDescriptor descriptor = getElementDescriptor(element.getText());

				if(descriptor != null)
				{
					return new XmlElementDescriptor[]{descriptor};
				}
			}
		}
	}

	return getElements();
}
 
开发者ID:consulo,项目名称:consulo-xml,代码行数:30,代码来源:XmlNSDescriptorImpl.java

示例5: getChildrenBase

import com.intellij.psi.xml.XmlProlog; //导入方法依赖的package包/类
@NotNull
public Collection<StructureViewTreeElement> getChildrenBase() {
  final XmlDocument document = getElement().getDocument();
  List<XmlTag> rootTags = new ArrayList<XmlTag>();
  if (document != null) {
    for (PsiElement element : document.getChildren())
      if (element instanceof XmlTag) rootTags.add((XmlTag)element);
  }

  Collection<StructureViewTreeElement> structureViewTreeElements =
    AbstractXmlTagTreeElement.getStructureViewTreeElements(rootTags.toArray(new XmlTag[rootTags.size()]));

  Collection<StructureViewTreeElement> dtdStructureViewTreeElements = null;
  final XmlProlog prolog = document != null ? document.getProlog():null;
  if (prolog != null) {
    final XmlDoctype doctype = prolog.getDoctype();

    if (doctype != null) {
      final XmlMarkupDecl xmlMarkupDecl = doctype.getMarkupDecl();
      if (xmlMarkupDecl != null) {
        dtdStructureViewTreeElements = DtdFileTreeElement.collectElements(xmlMarkupDecl);
      }
    }
  }

  if (dtdStructureViewTreeElements != null) {
    final ArrayList<StructureViewTreeElement> result = new ArrayList<StructureViewTreeElement>(
      dtdStructureViewTreeElements.size() + structureViewTreeElements.size()
    );

    result.addAll(dtdStructureViewTreeElements);
    result.addAll(structureViewTreeElements);
    structureViewTreeElements = result;
  }
  return structureViewTreeElements;
}
 
开发者ID:consulo,项目名称:consulo-xml,代码行数:37,代码来源:XmlFileTreeElement.java

示例6: isHtml5Document

import com.intellij.psi.xml.XmlProlog; //导入方法依赖的package包/类
public static boolean isHtml5Document(XmlDocument doc)
{
	if(doc == null)
	{
		return false;
	}
	XmlProlog prolog = doc.getProlog();
	XmlDoctype doctype = prolog != null ? prolog.getDoctype() : null;
	if(!isHtmlTagContainingFile(doc))
	{
		return false;
	}

	final PsiFile htmlFile = doc.getContainingFile();

	final String htmlFileFullName;
	if(htmlFile != null)
	{
		final VirtualFile vFile = htmlFile.getVirtualFile();
		if(vFile != null)
		{
			htmlFileFullName = vFile.getPath();
		}
		else
		{
			htmlFileFullName = htmlFile.getName();
		}
	}
	else
	{
		htmlFileFullName = "unknown";
	}

	if(doctype == null)
	{
		LOG.debug("DOCTYPE for " + htmlFileFullName + " is null");
		return Html5SchemaProvider.getHtml5SchemaLocation().equals(ExternalResourceManagerEx.getInstanceEx().getDefaultHtmlDoctype(doc.getProject()));
	}

	final boolean html5Doctype = isHtml5Doctype(doctype);
	final String doctypeDescription = "text: " + doctype.getText() + ", dtdUri: " + doctype.getDtdUri() + ", publicId: " + doctype.getPublicId() + ", markupDecl: " + doctype.getMarkupDecl();
	LOG.debug("DOCTYPE for " + htmlFileFullName + "; " + doctypeDescription + "; HTML5: " + html5Doctype);
	return html5Doctype;
}
 
开发者ID:consulo,项目名称:consulo-xml,代码行数:45,代码来源:HtmlUtil.java

示例7: isAcceptable

import com.intellij.psi.xml.XmlProlog; //导入方法依赖的package包/类
@Override
public boolean isAcceptable(Object element, PsiElement context)
{
	if(element instanceof XmlTag)
	{
		final XmlTag psiElement = (XmlTag) element;
		if(!psiElement.isValid())
		{
			return false;
		}
		final String ns = psiElement.getNamespace();

		if(isNamespaceAcceptable(ns))
		{
			return true;
		}

		final PsiFile psiFile = psiElement.getContainingFile();
		if(psiFile instanceof XmlFile)
		{
			// We use file references for as dtd namespace
			// But we should also check PUBLIC ID for namespace
			XmlDocument document = ((XmlFile) psiFile).getDocument();
			if(document == null)
			{
				return false;
			}
			final XmlProlog prolog = document.getProlog();

			if(prolog != null)
			{
				final XmlDoctype doctype = prolog.getDoctype();
				if(doctype != null)
				{
					final String publicId = doctype.getPublicId();

					if(publicId != null)
					{
						if(isNamespaceAcceptable(publicId))
						{
							return true;
						}
					}
				}
			}
		}
	}
	else if(element instanceof XmlDocument)
	{
		return isAcceptable(((XmlDocument) element).getRootTag(), context);
	}
	return false;
}
 
开发者ID:consulo,项目名称:consulo-xml,代码行数:54,代码来源:NamespaceFilter.java


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