Package org.freeplane.n3.nanoxml

Examples of org.freeplane.n3.nanoxml.ContentReader


   * java.lang.Object, java.lang.String)
   */
  public void writeContent(final ITreeWriter writer, final Object element, final IExtension note) throws IOException {
    DetailTextModel model = (DetailTextModel) note;
    if (model.getXml() != null) {
      final XMLElement htmlElement = new XMLElement();
      htmlElement.setName(NodeTextBuilder.XML_NODE_XHTML_CONTENT_TAG);
      htmlElement.setAttribute(NodeTextBuilder.XML_NODE_XHTML_TYPE_TAG, NodeTextBuilder.XML_NODE_XHTML_TYPE_DETAILS);
      if(model.isHidden()){
        htmlElement.setAttribute("HIDDEN", "true");
      }
      final String content = model.getXml().replace('\0', ' ');
      writer.addElement('\n' + content + '\n', htmlElement);
    }
    return;
View Full Code Here


  }

  /**
   */
  public XMLElement save() {
    final XMLElement element = new XMLElement();
    if (isVisible()) {
      element.setAttribute("VISIBLE", "true");
    }
    if (isManual()) {
      element.setAttribute("MANUAL", "true");
    }
    if (isRestricted()) {
      element.setAttribute("RESTRICTED", "true");
    }
    if (isManual() || isRestricted()) {
      for (int i = 0; i < values.getSize(); i++) {
        final XMLElement xmlValue = new XMLElement();
        xmlValue.setName(AttributeBuilder.XML_NODE_REGISTERED_ATTRIBUTE_VALUE);
        final Object value = values.getElementAt(i);
        final String string = value.toString();
        xmlValue.setAttribute("VALUE", string);
        if(! (value  instanceof String)){
          final String spec = TypeReference.toSpec(value);
          xmlValue.setAttribute("OBJECT", spec);
        }
        element.addChild(xmlValue);
      }
    }
    element.setName(AttributeBuilder.XML_NODE_REGISTERED_ATTRIBUTE_NAME);
View Full Code Here

import org.freeplane.n3.nanoxml.XMLElement;

class TimeWindowConfigurationStorage extends WindowConfigurationStorage {
  public static TimeWindowConfigurationStorage decorateDialog(final String marshalled, final JDialog dialog) {
    final TimeWindowConfigurationStorage storage = new TimeWindowConfigurationStorage();
    final XMLElement xml = storage.unmarschall(marshalled, dialog);
    if (xml != null) {
      final Iterator<XMLElement> iterator = xml.getChildren().iterator();
      while (iterator.hasNext()) {
        storage.addTimeWindowColumnSetting(TimeWindowColumnSetting.create(iterator.next()));
      }
      return storage;
    }
View Full Code Here

  public int getColumnWidth() {
    return columnWidth;
  }

  void marschall(final XMLElement xml) {
    final XMLElement child = new XMLElement("time_window_column_setting");
    child.setAttribute("column_sorting", Integer.toString(columnSorting));
    child.setAttribute("column_width", Integer.toString(columnWidth));
    xml.addChild(child);
  }
View Full Code Here

          }
          else if (ch == '!') {
            final char read1 = reader.read();
            final char read2 = reader.read();
            if (read1 != '-' || read2 != '-') {
              throw new XMLParseException(reader.getSystemID(), reader.getLineNr(), "Invalid input: <!"
                      + read1 + read2);
            }
            inComment = true;
            waitingBuf.append("<!--");
            continue;
          }
          else {
            level++;
          }
          waitingBuf.append('<');
        }
        else if (ch == '/') {
          ch = reader.read();
          if (ch == '>') {
            level--;
            if (level == 0) {
              throw new XMLParseException(reader.getSystemID(), reader.getLineNr(), "Invalid input: />");
            }
          }
          else if (ch == '<') {
            waitingBuf.append('/');
            reader.unread(ch);
View Full Code Here

    if (nsPrefix != null) {
      fullName = nsPrefix + ':' + key;
    }
    final XMLElement top = stack.peek();
    if (top.hasAttribute(fullName)) {
      throw new XMLParseException(top.getSystemID(), top.getLineNr(), "Duplicate attribute: " + key);
    }
    if (nsPrefix != null) {
      top.setAttribute(fullName, nsURI, value);
    }
    else {
View Full Code Here

    final String header = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + sep + description;
    for (Scanner scanner : scanners) {
      saver.addChild(scanner.toXml());
    }
    final Writer writer = new FileWriter(pathToFile);
    final XMLWriter xmlWriter = new XMLWriter(writer);
    xmlWriter.addRawContent(header);
    xmlWriter.write(saver, true);
    writer.close();
  }
View Full Code Here

                    && !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);
    xmlWriter.write(saver, true);
    writer.close();
  }
View Full Code Here

      final ASelectableCondition cond = (ASelectableCondition) filterConditionModel.getElementAt(i);
      if (cond != null && !(cond instanceof NoFilteringCondition)) {
        cond.toXml(saver);
      }
    }
    final XMLWriter xmlWriter = new XMLWriter(writer);
    xmlWriter.write(saver, true);
    writer.close();
  }
View Full Code Here

    xml.setAttribute("width", Integer.toString(width));
    xml.setAttribute("height", Integer.toString(height));
    xml.setName(name);
    marshallSpecificElements(xml);
    final StringWriter string = new StringWriter();
    final XMLWriter writer = new XMLWriter(string);
    try {
      writer.write(xml);
      return string.toString();
    }
    catch (final IOException e) {
      LogUtils.severe(e);
      return null;
View Full Code Here

TOP

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

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.