Package org.freeplane.n3.nanoxml

Examples of org.freeplane.n3.nanoxml.StdXMLReader


      }
  }

  @Override
    public void fillXML(final XMLElement element) {
    final XMLElement child = new XMLElement(TAG_NAME);
    super.fillXML(element);
    child.setContent(script.getScript().toString());
    element.addChild(child);
  }
View Full Code Here


    xmlwriter.write(comment);
    xmlwriter.write(" -->\n");
  }

  public void addElement(final Object userObject, final String name) throws IOException {
    final XMLElement element = new XMLElement(name);
    addElement(userObject, element);
  }
View Full Code Here

      return;
    final boolean forceFormatting = Boolean.TRUE.equals(writer.getHint(MapWriter.WriterHint.FORCE_FORMATTING));
    final NodeModel node = (NodeModel) element;
    final Collection<MindIcon> icons = forceFormatting ? IconController.getController().getIcons(node) : node.getIcons();
    for (MindIcon icon : icons) {
      final XMLElement iconElement = new XMLElement();
      iconElement.setName("icon");
      iconElement.setAttribute("BUILTIN", icon.getName());
      writer.addElement(node, iconElement);
    }
  }
View Full Code Here

    xmlBuilder.elementAttributesProcessed(name, nsPrefix, nsURI);
    if (saveAsXmlUntil != null || nodeCreator != null) {
      return;
    }
    final Iterator<IElementHandler> iterator = getElementHandlers().iterator(tag);
    final XMLElement lastBuiltElement = xmlBuilder.getLastBuiltElement();
    while (iterator.hasNext() && currentElement == null) {
      nodeCreator = iterator.next();
      currentElement = nodeCreator.createElement(parentElement, name, lastBuiltElement);
    }
    if (currentElement != null) {
      if (nodeCreator instanceof IElementContentHandler) {
        parser.notParseNextElementContent();
      }
      attributeHandlersForTag = getAttributeLoaders().get(tag);
      if (attributeHandlersForTag == null) {
        return;
      }
      final Enumeration<String> attributeNames = lastBuiltElement.enumerateAttributeNames();
      while (attributeNames.hasMoreElements()) {
        final String atName = (String) attributeNames.nextElement();
        if (addAttribute(atName, lastBuiltElement.getAttribute(atName, null))) {
          lastBuiltElement.removeAttribute(atName);
        }
      }
    }
    else {
      currentElement = null;
View Full Code Here

   * @see
   * freeplane.persistence.xml.n3.nanoxml.IXMLBuilder#endElement(java.lang
   * .String, java.lang.String, java.lang.String)
   */
  public void endElement(final String name, final String nsPrefix, final String nsURI) throws Exception {
    final XMLElement lastBuiltElement = xmlBuilder.getParentElement();
    xmlBuilder.endElement(name, nsPrefix, nsURI);
    if (saveAsXmlUntil == lastBuiltElement) {
      saveAsXmlUntil = null;
    }
    if (saveAsXmlUntil != null) {
      return;
    }
    tag = null;
    if (0 == elementStack.size()) {
      return;
    }
    final Object element = currentElement;
    currentElement = elementStack.removeLast();
    if (nodeCreator instanceof IElementContentHandler) {
      ((IElementContentHandler) nodeCreator).endElement(currentElement, name, element, lastBuiltElement,
          elementContentAsString);
    }
    else if (nodeCreator instanceof IElementDOMHandler) {
      ((IElementDOMHandler) nodeCreator).endElement(currentElement, name, element, lastBuiltElement);
    }
    final XMLElement top = lastBuiltElement.getParent();
    if (nodeCreator != null && top != null && top.hasChildren()) {
      final int lastChildIndex = top.getChildrenCount() - 1;
      top.removeChildAtIndex(lastChildIndex);
    }
    nodeCreator = (IElementHandler) nodeCreatorStack.removeLast();
    elementContentAsString = null;
  }
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

TOP

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

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.