use of com.intellij.psi.xml.XmlDoctype in project intellij-community by JetBrains.
the class UpdateJspxFileCopyright method scanFile.
protected void scanFile() {
logger.debug("updating " + getFile().getVirtualFile());
XmlDocument doc = ((XmlFile) getFile()).getDocument();
XmlProlog xmlProlog = doc.getProlog();
if (xmlProlog == null) {
return;
}
PsiElement elem = xmlProlog.getFirstChild();
PsiElement docTypeStart = null;
while (elem != null) {
if (elem instanceof XmlDoctype) {
docTypeStart = elem;
break;
}
elem = getNextSibling(elem);
}
PsiElement first = xmlProlog.getFirstChild();
int location = getLanguageOptions().getFileLocation();
if (docTypeStart != null) {
final ArrayList<PsiComment> comments = new ArrayList<>();
collectComments(doc.getFirstChild(), xmlProlog, comments);
collectComments(first, docTypeStart, comments);
checkComments(first, location == XmlOptions.LOCATION_BEFORE_DOCTYPE, comments);
checkComments(docTypeStart, doc.getRootTag(), location == XmlOptions.LOCATION_BEFORE_ROOTTAG);
return;
} else if (location == XmlOptions.LOCATION_BEFORE_DOCTYPE) {
location = XmlOptions.LOCATION_BEFORE_ROOTTAG;
}
final ArrayList<PsiComment> comments = new ArrayList<>();
collectComments(doc.getFirstChild(), xmlProlog, comments);
collectComments(first, doc.getRootTag(), comments);
checkComments(doc.getRootTag(), location == XmlOptions.LOCATION_BEFORE_ROOTTAG, comments);
}
Aggregations