com.intellij.xml.util.XmlUtil Java Examples
The following examples show how to use
com.intellij.xml.util.XmlUtil.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ViewHelperUtil.java From idea-php-typo3-plugin with MIT License | 6 votes |
@Nullable public static XmlElementDescriptor xmlElementDescriptorForCurrentTag(@NotNull Project project, @NotNull XmlTag tag) { String tagName = tag.getName(); // Fluid ViewHelpers are always prefixed if (tag.getNamespacePrefix().isEmpty()) { return null; } boolean tagDefinedByNamespace = XmlUtil.isTagDefinedByNamespace(tag); if (tagDefinedByNamespace) { // return null; } ViewHelper viewHelperInContext = findViewHelperInContext(project, tag, tagName); if (viewHelperInContext == null) { return null; } return new ViewHelperXmlElementDescriptor(tagName, tag, viewHelperInContext); }
Example #2
Source File: MuleSchemaUtils.java From mule-intellij-plugins with Apache License 2.0 | 6 votes |
public static void insertSchemaLocationLookup(XmlFile xmlFile, String namespace, String locationLookup) { final XmlTag rootTag = xmlFile.getRootTag(); if (rootTag == null) return; final XmlAttribute attribute = rootTag.getAttribute("xsi:schemaLocation", HTTP_WWW_W3_ORG_2001_XMLSCHEMA); if (attribute != null) { final String value = attribute.getValue(); attribute.setValue(value + "\n\t\t\t" + namespace + " " + locationLookup); } else { final XmlElementFactory elementFactory = XmlElementFactory.getInstance(xmlFile.getProject()); final XmlAttribute schemaLocation = elementFactory.createXmlAttribute("xsi:schemaLocation", XmlUtil.XML_SCHEMA_INSTANCE_URI); schemaLocation.setValue(namespace + " " + locationLookup); rootTag.add(schemaLocation); } }
Example #3
Source File: IdeaUtils.java From camel-idea-plugin with Apache License 2.0 | 5 votes |
@SuppressWarnings("unchecked") public <T> void iterateXmlNodes(XmlTag root, Class<T> nodeClass, Predicate<T> nodeProcessor) { XmlUtil.processXmlElementChildren(root, element -> { if (nodeClass.isAssignableFrom(element.getClass())) { return nodeProcessor.test((T) element); } return true; }, true); }
Example #4
Source File: BPMNFileExtension.java From intellij-bpmn-editor with GNU General Public License v3.0 | 4 votes |
@Nullable @Override public String[][] getNamespacesFromDocument(XmlDocument parent, boolean declarationsExist) { return XmlUtil.getDefaultNamespaces(parent); }