Search in sources :

Example 31 with Attribute

use of org.jdom.Attribute in project intellij-community by JetBrains.

the class JDOMCompare method diffAttributes.

public static String diffAttributes(Element element1, Element element2, String pathPrefix, String mode) {
    for (Object o : element1.getAttributes()) {
        final Attribute attr = (Attribute) o;
        final String name = attr.getName();
        final String value1 = attr.getValue();
        final String value2 = element2.getAttributeValue(name);
        if (value2 == null) {
            return MessageFormat.format("Attribute {2} at {0}/@{1}", pathPrefix, name, mode);
        }
        if (!value1.equals(value2)) {
            return MessageFormat.format("Attribute value mismatch at {0}/@{1}, expected={2}, actual={3}", pathPrefix, name, value1, value2);
        }
    }
    return null;
}
Also used : Attribute(org.jdom.Attribute)

Example 32 with Attribute

use of org.jdom.Attribute in project intellij-community by JetBrains.

the class PersistentFileSetManager method getState.

@Override
public Element getState() {
    final Element root = new Element("root");
    for (VirtualFile vf : getSortedFiles()) {
        final Element vfElement = new Element(FILE_ELEMENT);
        final Attribute filePathAttr = new Attribute(PATH_ATTR, VfsUtilCore.pathToUrl(vf.getPath()));
        vfElement.setAttribute(filePathAttr);
        root.addContent(vfElement);
    }
    return root;
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) Attribute(org.jdom.Attribute) Element(org.jdom.Element)

Example 33 with Attribute

use of org.jdom.Attribute in project intellij-community by JetBrains.

the class StateSplitterEx method mergeStateInto.

protected static void mergeStateInto(@NotNull Element target, @NotNull Element subState, @NotNull String subStateName) {
    if (subState.getName().equals(subStateName)) {
        target.addContent(subState);
    } else {
        for (Iterator<Element> iterator = subState.getChildren().iterator(); iterator.hasNext(); ) {
            Element configuration = iterator.next();
            iterator.remove();
            target.addContent(configuration);
        }
        for (Iterator<Attribute> iterator = subState.getAttributes().iterator(); iterator.hasNext(); ) {
            Attribute attribute = iterator.next();
            iterator.remove();
            target.setAttribute(attribute);
        }
    }
}
Also used : Attribute(org.jdom.Attribute) Element(org.jdom.Element)

Example 34 with Attribute

use of org.jdom.Attribute in project intellij-community by JetBrains.

the class UnknownRunConfiguration method writeExternal.

@Override
public void writeExternal(final Element element) throws WriteExternalException {
    if (myStoredElement != null) {
        final List attributeList = myStoredElement.getAttributes();
        for (Object anAttributeList : attributeList) {
            final Attribute a = (Attribute) anAttributeList;
            element.setAttribute(a.getName(), a.getValue());
        }
        final List list = myStoredElement.getChildren();
        for (Object child : list) {
            final Element c = (Element) child;
            element.addContent((Element) c.clone());
        }
    }
}
Also used : Attribute(org.jdom.Attribute) Element(org.jdom.Element) List(java.util.List)

Example 35 with Attribute

use of org.jdom.Attribute in project intellij-community by JetBrains.

the class XmlWriter method writeElement.

public void writeElement(final Element element) {
    startElement(element.getName());
    try {
        for (final Object o1 : element.getAttributes()) {
            final Attribute attribute = (Attribute) o1;
            addAttribute(attribute.getName(), attribute.getValue());
        }
        for (final Object o : element.getChildren()) {
            final Element child = (Element) o;
            writeElement(child);
        }
    } finally {
        endElement();
    }
}
Also used : Attribute(org.jdom.Attribute) Element(org.jdom.Element)

Aggregations

Attribute (org.jdom.Attribute)57 Element (org.jdom.Element)40 ArrayList (java.util.ArrayList)10 DataConversionException (org.jdom.DataConversionException)7 Iterator (java.util.Iterator)4 List (java.util.List)4 Document (org.jdom.Document)4 Namespace (org.jdom.Namespace)3 SAXBuilder (org.jdom.input.SAXBuilder)3 NotNull (org.jetbrains.annotations.NotNull)3 MacroscopicRateConstant (cbit.vcell.math.MacroscopicRateConstant)2 ExpressionException (cbit.vcell.parser.ExpressionException)2 PathMacrosImpl (com.intellij.application.options.PathMacrosImpl)2 PathMacroFilter (com.intellij.openapi.application.PathMacroFilter)2 VirtualFile (com.intellij.openapi.vfs.VirtualFile)2 Content (org.jdom.Content)2 Text (org.jdom.Text)2 BioPaxObject (org.vcell.pathway.BioPaxObject)2 RdfObjectProxy (org.vcell.pathway.persistence.BiopaxProxy.RdfObjectProxy)2 JDOMTreeWalker (cbit.util.xml.JDOMTreeWalker)1