Examples of XMLElement


Examples of javax.xml.bind.annotation.XmlElement

                jaxbMethods.add(null);
            }

            if (elField != null) {
                // JAXB Type get XmlElement Annotation
                XmlElement el = elField.getAnnotation(XmlElement.class);
                if (el != null
                    && (partName.equals(el.name())
                        || "##default".equals(el.name()))) {
                    ReflectionUtil.setAccessible(elField);
                    fields.add(elField);
                } else {
                    if (getMethod == null && setMethod == null) {
                        if (el != null) {
                            LOG.warning("Could not create accessor for property " + partName
                                        + " of type " + wrapperType.getName() + " as the @XmlElement "
                                        + "defines the name as " + el.name());
                        } else {
                            LOG.warning("Could not create accessor for property " + partName
                                        + " of type " + wrapperType.getName());
                        }
                    }
View Full Code Here

Examples of javax.xml.bind.annotation.XmlElement

    private static Field getElField(String partName, final Class<?> wrapperType) {
        String fieldName = JAXBUtils.nameToIdentifier(partName, JAXBUtils.IdentifierType.VARIABLE);
        Field[] fields = ReflectionUtil.getDeclaredFields(wrapperType);
        for (Field field : fields) {
            XmlElement el = field.getAnnotation(XmlElement.class);
            if (el != null
                && partName.equals(el.name())) {
                return field;
            }
            if (field.getName().equals(fieldName)) {
                return field;
            }
View Full Code Here

Examples of javax.xml.bind.annotation.XmlElement

    public Long getWrapperPartMinOccurs(MessagePartInfo mpi) {
        Annotation[] a = (Annotation[])mpi.getProperty(ReflectionServiceFactoryBean.PARAM_ANNOTATION);
        if (a != null) {
            for (Annotation a2 : a) {
                if (a2 instanceof XmlElement) {
                    XmlElement e = (XmlElement)a2;
                    if (e.required()) {
                        return 1L;
                    }
                }
            }
        }
View Full Code Here

Examples of nanoxml.XMLElement

      throw new ElasticEmailException(response);
    }
  }

  private MailerStatus parseXmlReponse(String response) {
    XMLElement xml = new XMLElement();
    try {
      xml.parseString(response);
      // System.out.println(xml);

      MailerStatus status = new MailerStatus();
      @SuppressWarnings("rawtypes")
      Vector children = xml.getChildren();
      for ( Object c : children ) {
        XMLElement x = (XMLElement) c;
        if ( "status".equals(x.getName()) ) {
          DeliveryStatus ds = DeliveryStatus.valueOf(x.getContent());
          status.setStatus(ds);
        }
        else {
          int val = Integer.parseInt(x.getContent());
          if ( "recipients".equals(x.getName()) ) {
            status.setRecipients(val);
          }
          else if ( "delivered".equals(x.getName()) ) {
            status.setDelivered(val);
          }
          else if ( "failed".equals(x.getName()) ) {
            status.setFailed(val);
          }
          else if ( "pending".equals(x.getName()) ) {
            status.setPending(val);
          }
          else if ( "opened".equals(x.getName()) ) {
            status.setOpened(val);
          }
          else if ( "clicked".equals(x.getName()) ) {
            status.setClicked(val);
          }
          else if ( "unsubscribed".equals(x.getName()) ) {
            status.setUnsubscribed(val);
          }
          else if ( "abusereports".equals(x.getName()) ) {
            status.setAbusereports(val);
          }
        }
      }
View Full Code Here

Examples of net.n3.nanoxml.XMLElement

  }

  public XMLBeanWriter(Object bean) throws XMLException
  {
    super();
    _rootElement = new XMLElement(XMLConstants.ROOT_ELEMENT_NAME);
    if (bean != null)
    {
      addToRoot(bean);
    }
  }
View Full Code Here

Examples of net.n3.nanoxml.XMLElement

    }
    catch (IntrospectionException ex)
    {
      throw new XMLException(ex);
    }
    elem = new XMLElement(name != null ? name : XMLConstants.BEAN_ELEMENT_NAME);
    if (info != null)
    {
      if (bean instanceof IXMLAboutToBeWritten)
      {
        ((IXMLAboutToBeWritten) bean).aboutToBeWritten();
      }
      PropertyDescriptor[] propDesc = info.getPropertyDescriptors();
      elem = new XMLElement(name != null ? name : XMLConstants.BEAN_ELEMENT_NAME);
      elem.setAttribute(XMLConstants.CLASS_ATTRIBUTE_NAME,
                      bean.getClass().getName());
      for (int i = 0; i < propDesc.length; ++i)
      {
        processProperty(propDesc[i], bean, elem);
View Full Code Here

Examples of net.n3.nanoxml.XMLElement

        {
          final boolean isStringArray = returnType.getName().equals("[Ljava.lang.String;");
          Object[] props = (Object[]) getter.invoke(bean, (Object[])null);
          if (props != null)
          {
            IXMLElement indexElem = new XMLElement(propName);
            indexElem.setAttribute(XMLConstants.INDEXED, "true");
            beanElem.addChild(indexElem);
            for (int i = 0; i < props.length; ++i)
            {
              if (isStringArray)
              {
                StringWrapper sw = new StringWrapper((String)props[i]);
                indexElem.addChild(createElement(sw,
                      XMLConstants.BEAN_ELEMENT_NAME));
              }
              else
              {
                indexElem.addChild(createElement(props[i],
                        XMLConstants.BEAN_ELEMENT_NAME));
              }
            }
          }
        }
        else if (returnType == boolean.class
            || returnType == int.class
            || returnType == short.class
            || returnType == long.class
            || returnType == float.class
            || returnType == double.class
            || returnType == char.class)
        {
          IXMLElement propElem = new XMLElement(propName);
          propElem.setContent("" + getter.invoke(bean, (Object[])null));
          beanElem.addChild(propElem);
        }
        else if (returnType == String.class)
        {
          IXMLElement propElem = new XMLElement(propName);
          propElem.setContent((String) getter.invoke(bean, (Object[])null));
          beanElem.addChild(propElem);
        }
        else
        {
          beanElem.addChild(createElement(getter.invoke(bean, (Object[])null), propName));
View Full Code Here

Examples of net.n3.nanoxml.XMLElement

        request.setHeaderField("Host", con.getHostHeaderValue()); //$NON-NLS-1$
        if (depth != null)
            request.setHeaderField("Depth", depth); //$NON-NLS-1$
        request.setHeaderField("Content-Type", "text/xml; charset=\"UTF-8\""); //$NON-NLS-1$ //$NON-NLS-2$

        IXMLElement root = new XMLElement(WebDAVConstants.PROPFIND_ELEM, WebDAVConstants.XML_DAV_NAMESPACE);
        root.addChild(new XMLElement(WebDAVConstants.ALLPROP_ELEM));

        StringWriter xml = new StringWriter();
        XMLWriter writer = new XMLWriter(xml);
        writer.write(root);
View Full Code Here

Examples of net.n3.nanoxml.XMLElement

     *
     * @param xmlFile xml file associated with configuration info
     */
   public XmlConfig(String xmlFile, String tag) {
     file = xmlFile;
     XMLElement el = null;
     boolean fileMissing = false;
     try {
       try{
         try {
           IXMLParser parser = XMLParserFactory.createDefaultXMLParser();
           // IXMLReader reader = StdXMLReader.fileReader(file); // fails on pc
           BufferedReader breader = new BufferedReader(new FileReader(file));
           IXMLReader reader = new StdXMLReader(breader);
           parser.setReader(reader);
           el = (XMLElement) parser.parse();
           if (el == null) {
             el = promptToOverwrite(xmlFile, tag);
           } else {
             LogBuffer.println("created xml config from file " + file);
           }
         } catch (java.io.FileNotFoundException e) {
           LogBuffer.println("File not found, will try from URL");
           fileMissing = true;
           url = new URL(xmlFile);
           el = getXMLElementFromURL();
         } catch (java.security.AccessControlException e) {
           LogBuffer.println("AccessControlException, will try from URL");
           url = new URL(xmlFile);
           el = getXMLElementFromURL();
         }
       } catch (java.net.MalformedURLException e) {
         if (!file.contains(":")) {
           url = new URL("file://" + xmlFile);
           el = getXMLElementFromURL();
         } else if (fileMissing) {
           // well, let's make our own...
           el = makeNewConfig(tag);
         } else {
       System.out.println("Invalid URL");
       System.out.println(e);
         }
       }
     } catch (XMLException ex) {
       try {
         el = promptToOverwrite(xmlFile, tag);
       } catch (Exception e) {
         System.out.println("Problem opening window: " + e.toString());
         System.out.println("Error parsing XML code in configuration file");
         System.out.println(file);
         System.out.println("Manually deleting file may fix, but you'll lose settings.");
         System.out.println("error was: " + ex);
         file = null;
         el = new XMLElement(tag);
       }
     } catch (java.io.FileNotFoundException e) {
       // well, let's make our own...
       el = makeNewConfig(tag);
     } catch (Exception ex) {
View Full Code Here

Examples of net.n3.nanoxml.XMLElement

       System.out.println(ex);
     }
     root = new XmlConfigNode(el);
   }
  private XMLElement promptToOverwrite(String xmlFile, String tag) {
    XMLElement el;
    int response = JOptionPane.showConfirmDialog (null, "Problem Parsing Settings " + xmlFile + ", Should I replace?", "Replace Faulty Settings File?", JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE);
     if (response == JOptionPane.OK_OPTION) {
       el = makeNewConfig(tag);
     } else {
       LogBuffer.println("Using dummy config nodes");
       file = null;
       el = new XMLElement(tag);
     }
    return el;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.