Package org.jdom

Examples of org.jdom.Attribute


      java.util.List ec = e.getChildren();
      for (int i=0; i<ec.size(); i++) {
        Element e1 = (Element)ec.get(i);
        java.util.List ac = e1.getAttributes();
        for (int j=0; j<ac.size(); j++) {
          Attribute a1 = (Attribute)ac.get(j);
          if (a1.getName().equals(attrName)) {
            if (a1.getValue() != null && a1.getValue().trim().equalsIgnoreCase(attrValue)) {
              return e1;
            }
          }
        }
        Element e2 = matchItByAttributeNameValueRecursive(e1,attrName,attrValue);
        if (e2 != null) {
          java.util.List ac2 = e2.getAttributes();
          for (int j=0; j<ac2.size(); j++) {
            Attribute a2 = (Attribute)ac2.get(j);
            if (a2.getName().equals(attrName)) {
              if (a2.getValue() != null && a2.getValue().trim().equalsIgnoreCase(attrValue)) {
                return e2;
              }
            }
          }
        }
View Full Code Here


    java.util.List eChildren1 = e.getChildren();
    for (int i=0; i<eChildren1.size(); i++) {
      Element e1 = (Element)eChildren1.get(i);
      java.util.List aChildren = e1.getAttributes();
      for (int j=0; j<aChildren.size(); j++) {
        Attribute a1 = (Attribute)aChildren.get(j);
        if (a1.getValue() != null && a1.getValue().trim().equals(attrValue)) {
          return e1;
        }
      }
      Element e2 = matchItByAttributeValue(e1, attrValue);
      if (e2 != null) {
View Full Code Here

      java.util.List ec = e.getChildren();
      for (int i=0; i<ec.size(); i++) {
        Element e1 = (Element)ec.get(i);
        java.util.List ac = e1.getAttributes();
        for (int j=0; j<ac.size(); j++) {
          Attribute a1 = (Attribute)ac.get(j);
          if (a1.getValue() != null && a1.getValue().trim().equals(attrValue)) {
            return e1;
          }
        }
        Element e2 = matchItByAttributeValue(e1,attrValue);
        if (e2 == null) {
          return null;
        }
        java.util.List ac2 = e2.getAttributes();
        for (int j=0; j<ac2.size(); j++) {
          Attribute a2 = (Attribute)ac2.get(j);
          if (a2.getValue() != null && a2.getValue().trim().equals(attrValue)) {
            return e2;
          }
        }
      }
    }
View Full Code Here

    // Add all attributes as 'Properties'
    try {
      java.util.List attrs = configElement.getAttributes();
      for (int i=0; i<attrs.size(); i++) {
        Attribute attr = (Attribute)attrs.get(i);
        String key = attr.getName();
        String value = attr.getValue();
        logger.debug("ConsumerConfig, Adding " + key + " - " + value);
        addProperty(key, value);
      }

      // Now the Elements.
View Full Code Here

    // Add all attributes as 'Properties'
    try {
      java.util.List attrs = configElement.getAttributes();
      for (int i=0; i<attrs.size(); i++) {
        Attribute attr = (Attribute)attrs.get(i);
        String key = attr.getName();
        String value = attr.getValue();
        logger.debug("ScheduledAppConfig, Adding " + key + " - " + value);
        addProperty(key, value);
      }

      // Now the Elements.
View Full Code Here

  public Element getEODocRoot() {
    return m_docRoot;
  }

  private void addFieldsForObject(Element eObjectDef) throws EnterpriseFieldException {
    Attribute aName = eObjectDef.getAttribute("name");
    String objectDefName = null;
    if (aName != null) {
      objectDefName = aName.getValue();
    }
    else {
      logger.debug("No 'name' attribute associated to element " +
                   eObjectDef.getName());
      return;
    }
    if (m_fieldsForObject.containsKey(objectDefName)) {
      //    if (ObjectDefinitions.OBJECTS.containsKey(objectDefName)) {
      logger.debug("Field " + objectDefName +
                   " already exists.  No need to add it.");
      return;
    }
    logger.debug("Building EnterpriseFields for " + objectDefName);
    java.util.List lFields = eObjectDef.getChildren("Field");
    HashMap hm_fields = new HashMap();
    for (int i = 0; i < lFields.size(); i++) {
      Element eField = (Element)lFields.get(i);
      String fieldType = eField.getAttribute("type").getValue();
      String fieldName = eField.getAttribute("name").getValue();
      Attribute aIsKey = eField.getAttribute("isKey");
      boolean isKey = false;
      if (aIsKey != null) {
        isKey = new Boolean(aIsKey.getValue()).booleanValue();
      }
      Element eFormatter = eField.getChild("Format");
      if (eFormatter != null) {
        EnterpriseFormatter aFormatter =
          buildFormatter(objectDefName, fieldName, eFormatter);
View Full Code Here

    // Build formatter object
    logger.debug("Building Formatter for " + objectName + "/" + fieldName);
    EnterpriseFormatter aFormatter = new EnterpriseFormatter();
    if (eFormatter != null) {
      Attribute aDatatype = eFormatter.getAttribute("datatype");
      if (aDatatype != null) {
        aFormatter.setDatatype(aDatatype.getValue());
      }
      aFormatter.setRequired(new Boolean(eFormatter.getAttribute("required").getValue()).booleanValue());

      // Build the translator
      Element eTranslator = eFormatter.getChild("Translation");
View Full Code Here

  /* ControlArea Convenience methods */

  private String getControlAreaAttributeValue( Document inDoc, String attrName ) {
    Element eControlArea = getControlArea(inDoc.getRootElement());
    if (eControlArea != null) {
      Attribute a = eControlArea.getAttribute( attrName );
      if (a != null) {
        return a.getValue();
      }
    }
    return null;
  }
View Full Code Here

    logger.debug("Element returned: ");
    logger.debug("  - " + configElement.getName());
    logger.debug("  - " + scheduleName);

    Attribute aImmediate = configElement.getAttribute("isImmediate");
    if (aImmediate != null) {
      setImmediate(new Boolean(aImmediate.getValue()).booleanValue());
    }
    else {
      // Use default values...
      aImmediate = getDefaultParms().getAttribute("isImmediate");
      if (aImmediate != null) {
        setImmediate(new Boolean(aImmediate.getValue()).booleanValue());
      }
      else {
        setImmediate(false);
      }
    }

    // look for default Runtimes associated to all Schedules.  This will
    // be overridden if the Schedule has its owne Runtime associated to it.
    Element eDefaultRuntimes = getDefaultParms().getChild(RUN_TIME);
    if (eDefaultRuntimes != null) {
      addRuntimes(eDefaultRuntimes);         
    }
   
    // look for default MailService to be used for all Scheduleds.  This will
    // be overridden if the Schedule has its own MailService associated to it.
    Element eDefaultMailService = getDefaultParms().getChild(MAIL_SERVICE_CONFIG);
    if (eDefaultMailService != null) {
      MailServiceConfig mcf = new MailServiceConfig();
      mcf.init(eDefaultMailService);
      try {
        setMailService(new MailService(mcf));
      }
      catch (Exception e) {
        logger.fatal("Error configuring MailService.  Exception: " + e.getMessage(), e);
        throw new EnterpriseConfigurationObjectException(e.getMessage(), e);       
      }
    }

    // Add all attributes as 'Properties'
    try {
      java.util.List attrs = configElement.getAttributes();
      for (int i=0; i<attrs.size(); i++) {
        Attribute attr = (Attribute)attrs.get(i);
        String key = attr.getName();
        String value = attr.getValue();
        logger.debug("ScheduleConfig, Adding " + key + " - " + value);
        addProperty(key, value);
      }

      // Now the Elements.
View Full Code Here

    }

    public void testAttributes() throws Exception
    {
        Element e = new Element("root", "urn:test");
        e.setAttribute(new Attribute("att1", "value1"));
        e.setAttribute(new Attribute("att2""value2", Namespace.getNamespace("p", "urn:test2")));
       
        JDOMStreamReader reader = new JDOMStreamReader(e);
        testAttributes(reader);
    }
View Full Code Here

TOP

Related Classes of org.jdom.Attribute

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.