Package org.freeplane.n3.nanoxml

Examples of org.freeplane.n3.nanoxml.XMLAttribute


      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

    }
  }

  void saveConditions(final DefaultComboBoxModel filterConditionModel, final String pathToFilterFile)
          throws IOException {
    final XMLElement saver = new XMLElement();
    saver.setName("filter_conditions");
    final Writer writer = new FileWriter(pathToFilterFile);
    for (int i = 0; i < filterConditionModel.getSize(); i++) {
      final ASelectableCondition cond = (ASelectableCondition) filterConditionModel.getElementAt(i);
      if (cond != null && !(cond instanceof NoFilteringCondition)) {
        cond.toXml(saver);
View Full Code Here

    public List<Parser> getParsers() {
        return new ArrayList<Parser>(parsers);
    }

  public XMLElement toXml() {
    final XMLElement xmlElement = new XMLElement(ELEM_SCANNER);
    xmlElement.setAttribute(ATTRIB_LOCALE, StringUtils.join(locales.iterator(), ","));
    if (isDefault)
    xmlElement.setAttribute(ATTRIB_DEFAULT, "true");
    xmlElement.addChild(firstCharsToXml());
    for (Parser parser : parsers) {
      xmlElement.addChild(parser.toXml());
    }
    return xmlElement;
  }
View Full Code Here

    }
    return xmlElement;
  }

  private XMLElement firstCharsToXml() {
    final XMLElement xmlElement = new XMLElement(ELEM_CHECKFIRSTCHAR);
    if (checkFirstChars)
      xmlElement.setAttribute(ATTRIB_CHARS, firstChars);
    else
      xmlElement.setAttribute(ATTRIB_DISABLED, "true");
    return xmlElement;
  }
View Full Code Here

TOP

Related Classes of org.freeplane.n3.nanoxml.XMLAttribute

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.