Package net.n3.nanoxml

Examples of net.n3.nanoxml.XMLElement


  }

  @Override
  protected IExtension createExtension(final NodeModel node, final XMLElement element) {
    final ReminderExtension reminderExtension = new ReminderExtension(node);
    final XMLElement parameters = element.getFirstChildNamed("Parameters");
    final String time = parameters.getAttribute(REMINDUSERAT, "0");
    final String unit = parameters.getAttribute(UNIT, "DAY");
    final String period = parameters.getAttribute(PERIOD, "1");
    reminderExtension.setRemindUserAt(Long.parseLong(time));
    reminderExtension.setPeriodUnit(PeriodUnit.valueOf(unit));
    reminderExtension.setPeriod(Integer.parseInt(period));
    final String script = parameters.getAttribute(SCRIPT, null);
    reminderExtension.setScript(script);
    return reminderExtension;
  }
View Full Code Here


  @Override
  protected void saveExtension(final IExtension extension, final XMLElement element) {
    super.saveExtension(extension, element);
    final ReminderExtension reminderExtension = (ReminderExtension) extension;
    final XMLElement parameters = element.createElement("Parameters");
    parameters.setAttribute(REMINDUSERAT, Long.toString(reminderExtension.getRemindUserAt()));
    parameters.setAttribute(PERIOD, Integer.toString(reminderExtension.getPeriod()));
    parameters.setAttribute(UNIT, reminderExtension.getPeriodUnit().toString());
    final String script = reminderExtension.getScript();
    if(script != null){
      parameters.setAttribute(SCRIPT, script);
    }
   
    element.addChild(parameters);
  }
View Full Code Here

          throws IOException {
    final CloudModel model = extension != null ? (CloudModel) extension : cc.getCloud(node);
    if (model == null) {
      return;
    }
    final XMLElement cloud = new XMLElement();
    cloud.setName("cloud");
    //    final String style = model.getStyle();
    //    if (style != null) {
    //      cloud.setAttribute("STYLE", style);
    //    }
    final Color color = model.getColor();
    if (color != null) {
      cloud.setAttribute("COLOR", ColorUtils.colorToString(color));
    }
    final CloudModel.Shape shape = model.getShape();
    if (shape != null) {
      cloud.setAttribute("SHAPE", shape.toString());
    }
    //    final int width = model.getWidth();
    //    if (width != CloudController.DEFAULT_WIDTH) {
    //      cloud.setAttribute("WIDTH", Integer.toString(width));
    //    }
View Full Code Here

      catch (final IOException e) {
        e.printStackTrace();
      }
      sw.append("</map_styles>");
      sw.append(el);
      final XMLElement element = new XMLElement("hook");
      saveExtension(extension, element);
      writer.addElement(sw.toString(), element);
    }
View Full Code Here

    }

    @Override
        public void endElement(Object parent, String tag, Object userObject, XMLElement xml) {
      // do nothing for not root nodes
      final XMLElement parentNodeElement = xml.getParent().getParent();
      if (parentNodeElement == null || !parentNodeElement.getName().equals("map")) {
        return;
      }
      NodeModel node = (NodeModel) userObject;
      loadMapStyleProperties(MapStyleModel.getExtension(node), xml);
       }
View Full Code Here

   * java.lang.Object, java.lang.String)
   */
  public void writeContent(final ITreeWriter writer, final Object element, final IExtension note) throws IOException {
    RichTextModel note1 = (RichTextModel) note;
    if (note1.getXml() != null) {
          final XMLElement htmlElement = new XMLElement();
        htmlElement.setName(NodeTextBuilder.XML_NODE_XHTML_CONTENT_TAG);
          if(note instanceof NoteModel){
              htmlElement.setAttribute(NodeTextBuilder.XML_NODE_XHTML_TYPE_TAG, NodeTextBuilder.XML_NODE_XHTML_TYPE_NOTE);
          }
          else{
            htmlElement.setAttribute(NodeTextBuilder.XML_NODE_XHTML_TYPE_TAG, "UNKNOWN");
          }
          final String content = note1.getXml().replace('\0', ' ');
          writer.addElement('\n' + content + '\n', htmlElement);
        }
    return;
View Full Code Here

      }
      return description;
    }
 
  public void toXml(final XMLElement element) {
    final XMLElement child = new XMLElement();
    child.setName(getName());
    if(userName != null){
      child.setAttribute("user_name", userName);
    }
    fillXML(child);
    element.addChild(child);
  }
View Full Code Here

    try {
      final IXMLParser parser = XMLParserFactory.createDefaultXMLParser();
      inputStream = new BufferedInputStream(new FileInputStream(configXml));
      final IXMLReader reader = new StdXMLReader(inputStream);
      parser.setReader(reader);
      final XMLElement loader = (XMLElement) parser.parse();
      final Vector<XMLElement> formats = loader.getChildren();
      for (XMLElement elem : formats) {
        final String type = elem.getAttribute("type", null);
        final String style = elem.getAttribute("style", null);
        final String name = elem.getAttribute("name", null);
        final String locale = elem.getAttribute("locale", null);
View Full Code Here

    formats.addAll(stringFormats);
    return formats;
  }

  private void saveFormats(final List<PatternFormat> formats) throws IOException {
    final XMLElement saver = new XMLElement();
    saver.setName(ROOT_ELEMENT);
    final String sep = System.getProperty("line.separator");
    final String header = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
            + sep //
            + "<!-- 'type' selects the kind of data the formatter is intended to format. -->"
            + sep //
            + "<!-- 'style' selects the formatter implementation: -->"
            + sep //
            + "<!--   - 'date': http://download.oracle.com/javase/6/docs/api/java/text/SimpleDateFormat.html -->"
            + sep //
            + "<!--   - 'decimal': http://download.oracle.com/javase/6/docs/api/java/text/DecimalFormat.html -->"
            + sep //
            + "<!--   - 'formatter': http://download.oracle.com/javase/6/docs/api/java/util/Formatter.html -->"
            + sep //
            + "<!--   - 'name': a informal name, a comment that's not visible in the app -->" + sep //
            + "<!--   - 'locale': the name of the locale, only set for locale dependent format codes -->" + sep;
    for (PatternFormat patternFormat : formats) {
            if (!patternFormat.getType().equals(PatternFormat.TYPE_IDENTITY)
                    && !patternFormat.getType().equals(PatternFormat.TYPE_STANDARD)) {
                saver.addChild(patternFormat.toXml());
            }
    }
    final Writer writer = new FileWriter(pathToFile);
    final XMLWriter xmlWriter = new XMLWriter(writer);
    xmlWriter.addRawContent(header);
View Full Code Here

      final IXMLParser parser = XMLParserFactory.createDefaultXMLParser();
      File filterFile = new File(pathToFilterFile);
      final IXMLReader reader = new StdXMLReader(new BufferedInputStream(new FileInputStream(filterFile)));
      parser.setReader(reader);
      reader.setSystemID(filterFile.toURL().toString());
      final XMLElement loader = (XMLElement) parser.parse();
      final Vector<XMLElement> conditions = loader.getChildren();
      for (int i = 0; i < conditions.size(); i++) {
        final ASelectableCondition condition = getConditionFactory().loadCondition(conditions.get(i));
        if(condition != null){
          filterConditionModel.addElement(condition);
        }
View Full Code Here

TOP

Related Classes of net.n3.nanoxml.XMLElement

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.