Java 类org.jdom.Element 实例源码

项目:parabuild-ci    文件:RSS090Parser.java   
/**
 * Parses an item element of an RSS document looking for item information.
 * <p/>
 * It reads title and link out of the 'item' element.
 * <p/>
 *
 * @param rssRoot the root element of the RSS document in case it's needed for context.
 * @param eItem the item element to parse.
 * @return the parsed RSSItem bean.
 */
protected Item parseItem(Element rssRoot,Element eItem) {
    Item item = new Item();
    Element e = eItem.getChild("title",getRSSNamespace());
    if (e!=null) {
        item.setTitle(e.getText());
    }
    e = eItem.getChild("link",getRSSNamespace());
    if (e!=null) {
        item.setLink(e.getText());
    }

    item.setModules(parseItemModules(eItem));

    return item;
}
项目:parabuild-ci    文件:Atom10Parser.java   
private Content parseContent(Element e) {
    String value = null;
    String src = e.getAttributeValue("src");//getAtomNamespace()); DONT KNOW WHY DOESN'T WORK
    String type = e.getAttributeValue("type");//getAtomNamespace()); DONT KNOW WHY DOESN'T WORK
    type = (type!=null) ? type : Content.TEXT;
    if (type.equals(Content.TEXT)) {
        // do nothing XML Parser took care of this
        value = e.getText();
    }
    else if (type.equals(Content.HTML)) {
        value = e.getText();
    }
    else if (type.equals(Content.XHTML)) {
        XMLOutputter outputter = new XMLOutputter();
        List eContent = e.getContent();
        Iterator i = eContent.iterator();
        while (i.hasNext()) {
            org.jdom.Content c = (org.jdom.Content) i.next();
            if (c instanceof Element) {
                Element eC = (Element) c;
                if (eC.getNamespace().equals(getAtomNamespace())) {
                    ((Element)c).setNamespace(Namespace.NO_NAMESPACE);
                }
            }
        }
        value = outputter.outputString(eContent);
    }

    Content content = new Content();
    content.setSrc(src);
    content.setType(type);
    content.setValue(value);
    return content;
}
项目:parabuild-ci    文件:Atom10Parser.java   
private Person parsePerson(URL baseURI, Element ePerson) {
    Person person = new Person();
    Element e = ePerson.getChild("name",getAtomNamespace());
    if (e!=null) {
        person.setName(e.getText());
    }
    e = ePerson.getChild("uri",getAtomNamespace());
    if (e!=null) {
        person.setUri(resolveURI(baseURI, ePerson, e.getText()));
    }
    e = ePerson.getChild("email",getAtomNamespace());
    if (e!=null) {
        person.setEmail(e.getText());
    }
    return person;
}
项目:parabuild-ci    文件:Atom03Parser.java   
private List parseLinks(List eLinks,boolean alternate) {
    List links = new ArrayList();
    for (int i=0;i<eLinks.size();i++) {
        Element eLink = (Element) eLinks.get(i);
        //Namespace ns = getAtomNamespace();
        String rel = eLink.getAttributeValue("rel");//getAtomNamespace()); DONT KNOW WHY DOESN'T WORK
        if (alternate) {
            if ("alternate".equals(rel)) {
                links.add(parseLink(eLink));
            }
        }
        else {
            if (!("alternate".equals(rel))) {
                links.add(parseLink(eLink));
            }
        }
    }
    return (links.size()>0) ? links : null;
}
项目:gate-core    文件:Plugin.java   
@Override
public Document getCreoleXML() throws Exception, JDOMException {
  Document doc = new Document();
  Element element;
  doc.addContent(element = new Element("CREOLE-DIRECTORY"));
  element.addContent(element = new Element("CREOLE"));
  element.addContent(element = new Element("RESOURCE"));
  Element classElement  = new Element("CLASS");
  classElement.setText(resourceClass.getName());
  element.addContent(classElement);

  return doc;
}
项目:gate-core    文件:CreoleAnnotationHandler.java   
/**
 * Process the given RESOURCE element, adding extra elements to it based on
 * the annotations on the resource class.
 * 
 * @param element
 *          the RESOURCE element to process.
 */
private void processAnnotationsForResource(Element element)
    throws GateException {
  String className = element.getChildTextTrim("CLASS");
  if(className == null) { throw new GateException(
      "\"CLASS\" element not found for resource in " + plugin); }
  Class<?> resourceClass = null;
  try {
    resourceClass = Gate.getClassLoader().loadClass(className);
  } catch(ClassNotFoundException e) {
    log.debug("Couldn't load class " + className + " for resource in "
        + plugin, e);
    throw new GateException("Couldn't load class " + className
        + " for resource in " + plugin);
  }

  processCreoleResourceAnnotations(element, resourceClass);
}
项目:gate-core    文件:CreoleAnnotationHandler.java   
/**
 * Given a single-argument method whose parameter is a {@link Collection}, use
 * the method's generic type information to determine the collection element
 * type and store it as the ITEM_CLASS_NAME attribute of the given Element.
 * 
 * @param method
 *          the setter method
 * @param paramElt
 *          the PARAMETER element
 */
private void determineCollectionElementType(AnnotatedElement method,
    Type paramType, Element paramElt) {
  if(paramElt.getAttributeValue("ITEM_CLASS_NAME") == null) {
    Class<?> elementType;
    CreoleParameter paramAnnot = method.getAnnotation(CreoleParameter.class);
    if(paramAnnot != null
        && paramAnnot.collectionElementType() != CreoleParameter.NoElementType.class) {
      elementType = paramAnnot.collectionElementType();
    } else {
      elementType = findCollectionElementType(paramType);
    }
    if(elementType != null) {
      paramElt.setAttribute("ITEM_CLASS_NAME", elementType.getName());
    }
  }
}
项目:teamcity-msteams-notifier    文件:MsTeamsNotificationMainSettings.java   
@SuppressWarnings("unchecked")
@Override
public void readFrom(Element rootElement)
/* Is passed an Element by TC, and is expected to persist it to the settings object.
 * Old settings should be overwritten.
 */
{
    if(msteamsNotificationMainConfig.getConfigFileExists()){
        // The MainConfigProcessor approach has been deprecated.
        // Instead we will use our own config file so we have better control over when it is persisted
        return;
    }
    Loggers.SERVER.info("MsTeamsNotificationMainSettings: re-reading main settings using old-style MainConfigProcessor. From now on we will use the msteams/msteams-config.xml file instead of main-config.xml");
    Loggers.SERVER.debug(NAME + ":readFrom :: " + rootElement.toString());
    MsTeamsNotificationMainConfig tempConfig = new MsTeamsNotificationMainConfig(serverPaths);
    Element msteamsNotificationsElement = rootElement.getChild("msteamsnotifications");
    tempConfig.readConfigurationFromXmlElement(msteamsNotificationsElement);
    this.msteamsNotificationMainConfig = tempConfig;
    tempConfig.save();
}
项目:incubator-netbeans    文件:NetbeansBuildActionJDOMWriter.java   
/**
 * Method updateNetbeansActionMapping.
 * 
 * @param value
 * @param element
 * @param counter
 * @param xmlTag
 */
protected void updateNetbeansActionMapping(NetbeansActionMapping value, String xmlTag, Counter counter, Element element)
{
    Element root = element;
    Counter innerCount = new Counter(counter.getDepth() + 1);
    findAndReplaceSimpleElement(innerCount, root,  "actionName", value.getActionName(), null);
    findAndReplaceSimpleElement(innerCount, root,  "displayName", value.getDisplayName(), null);
    findAndReplaceSimpleElement(innerCount, root,  "basedir", value.getBasedir(), null);
    findAndReplaceSimpleElement(innerCount, root,  "reactor", value.getReactor(), null);
    findAndReplaceSimpleElement(innerCount, root,  "preAction", value.getPreAction(), null);
    findAndReplaceSimpleElement(innerCount, root,  "recursive", value.isRecursive() == true ? null : String.valueOf( value.isRecursive() ), "true");
    findAndReplaceSimpleLists(innerCount, root, value.getPackagings(), "packagings", "packaging");
    findAndReplaceSimpleLists(innerCount, root, value.getGoals(), "goals", "goal");
    findAndReplaceProperties(innerCount, root,  "properties", value.getProperties());
    findAndReplaceSimpleLists(innerCount, root, value.getActivatedProfiles(), "activatedProfiles", "activatedProfile");
}
项目:educational-plugin    文件:StudySerializationUtils.java   
public static Element convertToThirdVersion(Element state, Project project) throws StudyUnrecognizedFormatException {
  Element taskManagerElement = state.getChild(MAIN_ELEMENT);
  XMLOutputter outputter = new XMLOutputter();

  Map<String, String> placeholderTextToStatus = fillStatusMap(taskManagerElement, STUDY_STATUS_MAP, outputter);
  Map<String, String> taskFileToStatusMap = fillStatusMap(taskManagerElement, TASK_STATUS_MAP, outputter);

  Element courseElement = getChildWithName(taskManagerElement, COURSE).getChild(COURSE_TITLED);
  for (Element lesson : getChildList(courseElement, LESSONS)) {
    int lessonIndex = getAsInt(lesson, INDEX);
    for (Element task : getChildList(lesson, TASK_LIST)) {
      String taskStatus = null;
      int taskIndex = getAsInt(task, INDEX);
      Map<String, Element> taskFiles = getChildMap(task, TASK_FILES);
      for (Map.Entry<String, Element> entry : taskFiles.entrySet()) {
        Element taskFileElement = entry.getValue();
        String taskFileText = outputter.outputString(taskFileElement);
        String taskFileStatus = taskFileToStatusMap.get(taskFileText);
        if (taskFileStatus != null && (taskStatus == null || taskFileStatus.equals(StudyStatus.Failed.toString()))) {
          taskStatus = taskFileStatus;
        }
        Document document = StudyUtils.getDocument(project.getBasePath(), lessonIndex, taskIndex, entry.getKey());
        if (document == null) {
          continue;
        }
        for (Element placeholder : getChildList(taskFileElement, ANSWER_PLACEHOLDERS)) {
          taskStatus = addStatus(outputter, placeholderTextToStatus, taskStatus, placeholder);
          addOffset(document, placeholder);
          addInitialState(document, placeholder);
        }
      }
      if (taskStatus != null) {
        addChildWithName(task, STATUS, taskStatus);
      }
    }
  }
  return state;
}
项目:incubator-netbeans    文件:ModuleConvertor.java   
private void processModule(Element module, String path, Properties props) {
    if (!"module".equals(module.getName())) {
        return;
    }
    String moduleName = module.getAttributeValue("name");
    @SuppressWarnings("unchecked")
    List<Element> propElements = module.getChildren("property");
    Map<String, String> moduleProps = new HashMap<String, String>();
    for (Element prp : propElements) {
        String name = prp.getAttributeValue("name");
        String value = prp.getAttributeValue("value");
        assert name != null && value != null;
        moduleProps.put(name, value);
    }
    String modulePath = path + "/" + moduleName;
    checkRules(modulePath, moduleProps, props);
    //now check child modules..
    @SuppressWarnings("unchecked")
    List<Element> childs = module.getChildren("module");
    for (Element child : childs) {
        processModule(child, modulePath, props);
    }
}
项目:quicknotes    文件:NoteListRenderer.java   
/**
 * @param list
 * @param value
 * @param index
 * @param isSelected
 * @param cellHasFocus
 * @return
 */
public Component getListCellRendererComponent( final JList list,
                                               final Object value,
                                               final int index,
                                               final boolean isSelected,
                                               boolean cellHasFocus ) {
    return new JPanel() {
        public void paintComponent( Graphics g ) {
            super.paintComponent( g );
            Element e = ( Element ) value;
            String title = e.getAttributeValue( "title" );
            String text = e.getText().trim();

            g.setColor( isSelected ? COLOR_SELECTED : index % 2 == 0 ? COLOR_EVEN : COLOR_ODD );
            g.fillRect( 0, 0, getWidth(), getHeight() );

            g.setColor( isSelected ? Color.WHITE : list.getForeground() );
            g.setFont( new Font( Font.SANS_SERIF, Font.BOLD, 12 ) );
            g.drawString( ( index + 1 ) + ". " + title, 5, 16 );
            g.setFont( new Font( Font.SANS_SERIF, Font.PLAIN, 12 ) );

            if ( text.indexOf( "\n" ) != -1 ) {
                text = text.substring( 0, text.indexOf( "\n" ) );
            }
            g.drawString( text, 20, 32 );
        }

        public Dimension getPreferredSize() {
            return new Dimension( 200, 40 );
        }
    };
}
项目:parabuild-ci    文件:Atom10Parser.java   
private Link parseLink(Feed feed , Entry entry, URL baseURI, Element eLink) {
    Link link = new Link();
    String att = eLink.getAttributeValue("rel");//getAtomNamespace()); DONT KNOW WHY DOESN'T WORK
    if (att!=null) {
        link.setRel(att);
    }
    att = eLink.getAttributeValue("type");//getAtomNamespace()); DONT KNOW WHY DOESN'T WORK
    if (att!=null) {
        link.setType(att);
    }
    att = eLink.getAttributeValue("href");//getAtomNamespace()); DONT KNOW WHY DOESN'T WORK
    if (att!=null) {
        if (isRelativeURI(att)) { //
            link.setHref(resolveURI(baseURI, eLink, ""));
        } else {
            link.setHref(att);
        }
    }
    att = eLink.getAttributeValue("hreflang");//getAtomNamespace()); DONT KNOW WHY DOESN'T WORK
    if (att!=null) {
        link.setHreflang(att);
    }
    att = eLink.getAttributeValue("length");//getAtomNamespace()); DONT KNOW WHY DOESN'T WORK
    if (att!=null) {
        link.setLength(Long.parseLong(att));
    }
    return link;
}
项目:parabuild-ci    文件:Atom10Generator.java   
protected Element generateTagLineElement(Content tagline) {
    Element taglineElement = new Element("subtitle", getFeedNamespace());

    if (tagline.getType() != null) {
        Attribute typeAttribute = new Attribute("type", tagline.getType());
        taglineElement.setAttribute(typeAttribute);
    }

    if (tagline.getValue() != null) {
        taglineElement.addContent(tagline.getValue());
    }
    return taglineElement;
}
项目:apache-maven-shade-plugin    文件:MavenJDOMWriter.java   
/**
 * Method updatePlugin
 *
 * @param value
 * @param element
 * @param counter
 * @param xmlTag
 */
protected void updatePlugin( Plugin value, String xmlTag, Counter counter, Element element )
{
    Element root = element;
    Counter innerCount = new Counter( counter.getDepth() + 1 );
    findAndReplaceSimpleElement( innerCount, root, "groupId", value.getGroupId(), "org.apache.maven.plugins" );
    findAndReplaceSimpleElement( innerCount, root, "artifactId", value.getArtifactId(), null );
    findAndReplaceSimpleElement( innerCount, root, "version", value.getVersion(), null );
    findAndReplaceSimpleElement( innerCount, root, "extensions",
                                 !value.isExtensions() ? null : String.valueOf( value.isExtensions() ), "false" );
    iteratePluginExecution( innerCount, root, value.getExecutions(), "executions", "execution" );
    iterateDependency( innerCount, root, value.getDependencies(), "dependencies", "dependency" );
    findAndReplaceXpp3DOM( innerCount, root, "goals", (Xpp3Dom) value.getGoals() );
    findAndReplaceSimpleElement( innerCount, root, "inherited", value.getInherited(), null );
    findAndReplaceXpp3DOM( innerCount, root, "configuration", (Xpp3Dom) value.getConfiguration() );
}
项目:processing-idea    文件:ProcessingRunConfiguration.java   
@Override
public void readExternal(Element element) throws InvalidDataException {
    super.readExternal(element);

    String name = ProcessingRunSettings.class.getSimpleName();
    Element settingsElement = element.getChild(name);

    if (settingsElement == null) return;

    ProcessingRunSettings deserializedConfig = XmlSerializer.deserialize(settingsElement, ProcessingRunSettings.class);

    runSettings.setModule(deserializedConfig.getModule());
    runSettings.setSketchClass(deserializedConfig.getSketchClass());
    runSettings.setFullscreen(deserializedConfig.isFullscreen());
    runSettings.setHideStopButton(deserializedConfig.isHideStopButton());
    runSettings.setJvmArguments(deserializedConfig.getJvmArguments());
    runSettings.setSketchArguments(deserializedConfig.getSketchArguments());
    runSettings.setWindowBackgroundColor(deserializedConfig.getWindowBackgroundColor());
    runSettings.setStopButtonColor(deserializedConfig.getStopButtonColor());
    runSettings.setSketchOutputPath(deserializedConfig.getSketchOutputPath());
    runSettings.setLocation(deserializedConfig.getLocation());

    readModule(element);
}
项目:apache-maven-shade-plugin    文件:MavenJDOMWriter.java   
/**
 * Method updateBuild
 *
 * @param value
 * @param element
 * @param counter
 * @param xmlTag
 */
//CHECKSTYLE_OFF: LineLength
protected void updateBuild( Build value, String xmlTag, Counter counter, Element element )
{
    boolean shouldExist = value != null;
    Element root = updateElement( counter, element, xmlTag, shouldExist );
    if ( shouldExist )
    {
        Counter innerCount = new Counter( counter.getDepth() + 1 );
        findAndReplaceSimpleElement( innerCount, root, "sourceDirectory", value.getSourceDirectory(), null );
        findAndReplaceSimpleElement( innerCount, root, "scriptSourceDirectory", value.getScriptSourceDirectory(),
                                     null );
        findAndReplaceSimpleElement( innerCount, root, "testSourceDirectory", value.getTestSourceDirectory(), null );
        findAndReplaceSimpleElement( innerCount, root, "outputDirectory", value.getOutputDirectory(), null );
        findAndReplaceSimpleElement( innerCount, root, "testOutputDirectory", value.getTestOutputDirectory(), null );
        iterateExtension( innerCount, root, value.getExtensions(), "extensions", "extension" );
        findAndReplaceSimpleElement( innerCount, root, "defaultGoal", value.getDefaultGoal(), null );
        iterateResource( innerCount, root, value.getResources(), "resources", "resource" );
        iterateResource( innerCount, root, value.getTestResources(), "testResources", "testResource" );
        findAndReplaceSimpleElement( innerCount, root, "directory", value.getDirectory(), null );
        findAndReplaceSimpleElement( innerCount, root, "finalName", value.getFinalName(), null );
        findAndReplaceSimpleLists( innerCount, root, value.getFilters(), "filters", "filter" );
        updatePluginManagement( value.getPluginManagement(), "pluginManagement", innerCount, root );
        iteratePlugin( innerCount, root, value.getPlugins(), "plugins", "plugin" );
    }
}
项目:AppleScript-IDEA    文件:AppleScriptSystemDictionaryRegistryService.java   
private static void hashSimpleElementForObject(@NotNull Element suiteObjectElement, @NotNull String applicationName,
                                               Map<String, HashSet<String>> objectNameToApplicationNameListMap) {
  final String objectName = suiteObjectElement.getAttributeValue("name");
  final String code = suiteObjectElement.getAttributeValue("code");
  if (objectName == null || code == null) return;

  updateObjectNameSetForApplication(objectName, applicationName, objectNameToApplicationNameListMap);
}
项目:idea-php-typo3-plugin    文件:TYPO3CMSSettings.java   
@Nullable
@Override
public Element getState() {
    final Element element = new Element(KEY.ROOT.toString());
    element.setAttribute(KEY.VERSION.toString(), version);

    return element;
}
项目:MultiHighlight    文件:NamedTextAttr.java   
public NamedTextAttr(@NotNull Element element) {
    super(element);
    final Attribute attribute = element.getAttribute(ATTR_NAME);
    if (attribute != null) {
        name = attribute.getValue();
    }
    if (name == null) {
        name = "";
    }
}
项目:parabuild-ci    文件:SyModuleGenerator.java   
public void generate(Module module, Element element) {

        SyModule syModule = (SyModule)module;

        Element updatePeriodElement = new Element("updatePeriod", SY_NS);
        updatePeriodElement.addContent(syModule.getUpdatePeriod().toString());
        element.addContent(updatePeriodElement);

        Element updateFrequencyElement = new Element("updateFrequency", SY_NS);
        updateFrequencyElement.addContent(String.valueOf(syModule.getUpdateFrequency()));
        element.addContent(updateFrequencyElement);

        Element updateBaseElement = new Element("updateBase", SY_NS);
        updateBaseElement.addContent(DateParser.formatW3CDateTime(syModule.getUpdateBase()));
        element.addContent(updateBaseElement);
    }
项目:airsonic    文件:LyricsService.java   
private LyricsInfo parseSearchResult(String xml) throws Exception {
    SAXBuilder builder = new SAXBuilder();
    Document document = builder.build(new StringReader(xml));

    Element root = document.getRootElement();
    Namespace ns = root.getNamespace();

    String lyric = StringUtils.trimToNull(root.getChildText("Lyric", ns));
    String song =  root.getChildText("LyricSong", ns);
    String artist =  root.getChildText("LyricArtist", ns);

    return new LyricsInfo(lyric, artist, song);
}
项目:airsonic    文件:PodcastService.java   
private String getChannelImageUrl(Element channelElement) {
    String result = getITunesAttribute(channelElement, "image", "href");
    if (result == null) {
        Element imageElement = channelElement.getChild("image");
        if (imageElement != null) {
            result = imageElement.getChildTextTrim("url");
        }
    }
    return result;
}
项目:airsonic    文件:PodcastService.java   
private String getITunesAttribute(Element element, String childName, String attributeName) {
    for (Namespace ns : ITUNES_NAMESPACES) {
        Element elem = element.getChild(childName, ns);
        if (elem != null) {
            return StringUtils.trimToNull(elem.getAttributeValue(attributeName));
        }
    }
    return null;
}
项目:gate-core    文件:CreoleAnnotationHandler.java   
@SuppressWarnings("unchecked")
private void findResourceElements(Map<String, Element> map, Element elt) {
  if(elt.getName().equals("RESOURCE")) {
    String className = elt.getChildTextTrim("CLASS");
    if(className != null) {
      map.put(className, elt);
    }
  } else {
    for(Element child : (List<Element>)elt.getChildren()) {
      findResourceElements(map, child);
    }
  }
}
项目:apache-maven-shade-plugin    文件:MavenJDOMWriter.java   
/**
 * Method updateModelBase
 *
 * @param value
 * @param element
 * @param counter
 * @param xmlTag
 */
//CHECKSTYLE_OFF: LineLength
protected void updateModelBase( ModelBase value, String xmlTag, Counter counter, Element element )
{
    boolean shouldExist = value != null;
    Element root = updateElement( counter, element, xmlTag, shouldExist );
    if ( shouldExist )
    {
        Counter innerCount = new Counter( counter.getDepth() + 1 );
        findAndReplaceSimpleLists( innerCount, root, value.getModules(), "modules", "module" );
        iterateRepository( innerCount, root, value.getRepositories(), "repositories", "repository" );
        iterateRepository( innerCount, root, value.getPluginRepositories(), "pluginRepositories",
                           "pluginRepository" );
        iterateDependency( innerCount, root, value.getDependencies(), "dependencies", "dependency" );
        findAndReplaceXpp3DOM( innerCount, root, "reports", (Xpp3Dom) value.getReports() );
        updateReporting( value.getReporting(), "reporting", innerCount, root );
        updateDependencyManagement( value.getDependencyManagement(), "dependencyManagement", innerCount, root );
        updateDistributionManagement( value.getDistributionManagement(), "distributionManagement", innerCount, root );
        findAndReplaceProperties( innerCount, root, "properties", value.getProperties() );
    }
}
项目:gate-core    文件:CreoleAnnotationHandler.java   
/**
 * Recursive method to process the {@link CreoleResource} elements that can be
 * inherited from superclasses and interfaces (everything except the PRIVATE
 * and MAIN_VIEWER flags, the NAME and the AUTOINSTANCEs). Once data has been
 * extracted from the current class the method calls itself recursively for
 * the superclass and any implemented interfaces. For any given attribute, the
 * first value specified wins (i.e. the one on the most specific class).
 * 
 * @param clazz
 *          the class to process
 * @param element
 *          the RESOURCE element to which data should be added.
 */
private void processInheritableResourceData(Class<?> clazz, Element element) {
  CreoleResource cr = clazz.getAnnotation(CreoleResource.class);
  if(cr != null) {
    addElement(element, cr.comment(), "COMMENT");
    addElement(element, cr.helpURL(), "HELPURL");
    addElement(element, cr.interfaceName(), "INTERFACE");
    addElement(element, cr.icon(), "ICON");
    if(cr.guiType() != GuiType.NONE && element.getChild("GUI") == null) {
      Element guiElement =
          new Element("GUI").setAttribute("TYPE", cr.guiType().toString());
      element.addContent(guiElement);
      addElement(guiElement, cr.resourceDisplayed(), "RESOURCE_DISPLAYED");
    }
    addElement(element, cr.annotationTypeDisplayed(),
        "ANNOTATION_TYPE_DISPLAYED");
  }

  Class<?> superclass = clazz.getSuperclass();
  if(superclass != null) {
    processInheritableResourceData(superclass, element);
  }

  for(Class<?> intf : clazz.getInterfaces()) {
    processInheritableResourceData(intf, element);
  }
}
项目:MultiHighlight    文件:MultiHighlightConfig.java   
private void readColors(Element element) {
    if (namedTextAttrs == null) {
        namedTextAttrs = new ArrayList<>();
    }

    final Element colorListTag = element.getChild(COLOR_LIST_TAG);
    if (colorListTag != null) {
        for (Element colorTag : colorListTag.getChildren(COLOR_TAG)) {
            namedTextAttrs.add(new NamedTextAttr(colorTag));
        }
    }
}
项目:parabuild-ci    文件:RSS092Generator.java   
protected Element generateSourceElement(Source source) {
    Element sourceElement = new Element("source",getFeedNamespace());
    if (source.getUrl() != null) {
        sourceElement.setAttribute(new Attribute("url", source.getUrl()));
    }
    sourceElement.addContent(source.getValue());
    return sourceElement;
}
项目:educational-plugin    文件:StudySerializationUtils.java   
public static String addStatus(XMLOutputter outputter,
                               Map<String, String> placeholderTextToStatus,
                               String taskStatus,
                               Element placeholder) {
  String placeholderText = outputter.outputString(placeholder);
  String status = placeholderTextToStatus.get(placeholderText);
  if (status != null) {
    addChildWithName(placeholder, STATUS, status);
    if (taskStatus == null || status.equals(StudyStatus.Failed.toString())) {
      taskStatus = status;
    }
  }
  return taskStatus;
}
项目:gate-core    文件:TestResourceReference.java   
@Override
public Document getCreoleXML() throws Exception, JDOMException {
  Document doc = new Document();
  Element element = null;
  doc.addContent(element = new Element("CREOLE-DIRECTORY"));

  element.addContent(element = new Element("CREOLE"));
  element.addContent(element = new Element("RESOURCE"));
  Element classElement = new Element("CLASS");
  classElement.setText(TestResource.class.getName());
  element.addContent(classElement);
  return doc;
}
项目:parabuild-ci    文件:SampleModuleGenerator.java   
public void generate(Module module, Element element) {

        SampleModule fm = (SampleModule)module;

        if (fm.getBar() != null) {
            element.addContent(generateSimpleElement("bar", fm.getBar()));
        }

        List foos = fm.getFoos();
        for (int i = 0; i < foos.size(); i++) {
            element.addContent(generateSimpleElement("foo",foos.get(i).toString()));
        }
        if (fm.getDate() != null) {
            element.addContent(
                generateSimpleElement("date", DateParser.formatW3CDateTime(fm.getDate())));
        }
    }
项目:json2java4idea    文件:PersistentJson2JavaSettingsTest.java   
@Test
public void noStateLoadedShouldUseDefaultValue() throws Exception {
    // exercise
    underTest.noStateLoaded();

    // verify
    final Element actual = underTest.getState();
    assertThat(actual)
            .isNotNull()
            .hasName("component")
            .hasAttribute("style", "NONE")
            .hasAttribute("classNamePrefix", "")
            .hasAttribute("classNameSuffix", "")
            .hasAttribute("annotationGenerated", "true")
            .hasAttribute("annotationSuppressWarnings", "true");
}
项目:processing-idea    文件:ProcessingRunConfiguration.java   
@Override
public void writeExternal(Element parentNode) throws WriteExternalException {
    super.writeExternal(parentNode);

    parentNode.addContent(XmlSerializer.serialize(runSettings));

    writeModule(parentNode);
}
项目:educational-plugin    文件:CCProjectService.java   
@Override
public Element getState() {
  if (myCourse == null) {
    return null;
  }
  return XmlSerializer.serialize(this);
}
项目:parabuild-ci    文件:Atom03Parser.java   
private List parseEntries(List eEntries) {
    List entries = new ArrayList();
    for (int i=0;i<eEntries.size();i++) {
        entries.add(parseEntry((Element)eEntries.get(i)));
    }
    return (entries.size()>0) ? entries : null;
}
项目:apache-maven-shade-plugin    文件:MavenJDOMWriter.java   
/**
 * Method updateActivationProperty
 *
 * @param value
 * @param element
 * @param counter
 * @param xmlTag
 */
protected void updateActivationProperty( ActivationProperty value, String xmlTag, Counter counter, Element element )
{
    boolean shouldExist = value != null;
    Element root = updateElement( counter, element, xmlTag, shouldExist );
    if ( shouldExist )
    {
        Counter innerCount = new Counter( counter.getDepth() + 1 );
        findAndReplaceSimpleElement( innerCount, root, "name", value.getName(), null );
        findAndReplaceSimpleElement( innerCount, root, "value", value.getValue(), null );
    }
}
项目:incubator-netbeans    文件:MavenSettingsGrammar.java   
@Override
    protected List<GrammarResult> getDynamicCompletion(String path, HintContext hintCtx, Element lowestParent) {
        if ("/settings/proxies".equals(path)) { //NOI18N
            // doesn't work!!!'
//            if ("proxy".startsWith(hintCtx.getCurrentPrefix())) {
//                ArrayList lst = new ArrayList();
//                lst.add(new MyElement("host"));
//                lst.add(new MyElement("port"));
//                GrammarResult rootRes = new ComplexElement("proxy2", "Insert Proxy", new NodeListImpl(lst));
//                return Collections.singletonList(rootRes);
//            }
        }
        return Collections.<GrammarResult>emptyList();
    }
项目:apache-maven-shade-plugin    文件:MavenJDOMWriter.java   
/**
 * Method findAndReplaceXpp3DOM
 *
 * @param counter
 * @param dom
 * @param name
 * @param parent
 */
protected Element findAndReplaceXpp3DOM( Counter counter, Element parent, String name, Xpp3Dom dom )
{
    boolean shouldExist = dom != null && ( dom.getChildCount() > 0 || dom.getValue() != null );
    Element element = updateElement( counter, parent, name, shouldExist );
    if ( shouldExist )
    {
        replaceXpp3DOM( element, dom, new Counter( counter.getDepth() + 1 ) );
    }
    return element;
}
项目:parabuild-ci    文件:Atom10Parser.java   
private List parsePersons(URL baseURI, List ePersons) {
    List persons = new ArrayList();
    for (int i=0;i<ePersons.size();i++) {
        persons.add(parsePerson(baseURI, (Element)ePersons.get(i)));
    }
    return (persons.size()>0) ? persons : null;
}