Package org.freeplane.n3.nanoxml

Examples of org.freeplane.n3.nanoxml.XMLWriter


        break;
      }
      str.append(buf, 0, size);
      sizeRead += size;
    }
    final XMLElement elt = prototype.createElement(null, systemID, lineNr);
    elt.setContent(str.toString());
    if (!stack.empty()) {
      final XMLElement top = (XMLElement) stack.peek();
      top.addChild(elt);
    }
  }
View Full Code Here


   *            the URI associated with the namespace. If no namespace has
   *            been specified, or no URI is associated with nsPrefix, this
   *            parameter is null.
   */
  public void endElement(final String name, final String nsPrefix, final String nsURI) {
    final XMLElement elt = (XMLElement) stack.pop();
    if (elt.getChildrenCount() == 1) {
      final XMLElement child = elt.getChildAtIndex(0);
      if (child.getName() == null) {
        elt.setContent(child.getContent());
        elt.removeChildAtIndex(0);
      }
    }
  }
View Full Code Here

                           final int lineNr) {
    String fullName = name;
    if (nsPrefix != null) {
      fullName = nsPrefix + ':' + name;
    }
    final XMLElement elt = new XMLElement(fullName, nsURI, systemID, lineNr);
    last = elt;
    if (stack.empty()) {
      root = elt;
    }
    else {
      final XMLElement top = (XMLElement) stack.peek();
      top.addChild(elt);
    }
    stack.push(elt);
  }
View Full Code Here

* 17.01.2009
*/
public class UnknownElementWriter implements IExtensionAttributeWriter, IExtensionElementWriter {
  public void writeAttributes(final ITreeWriter writer, final Object userObject, final IExtension extension) {
    final UnknownElements elements = (UnknownElements) extension;
    final XMLElement unknownElements = elements.getUnknownElements();
    if (unknownElements != null) {
      final Enumeration<String> unknownAttributes = unknownElements.enumerateAttributeNames();
      while (unknownAttributes.hasMoreElements()) {
        final String name = unknownAttributes.nextElement();
        final String value = unknownElements.getAttribute(name, null);
        writer.addAttribute(name, value);
      }
    }
  }
View Full Code Here

  }

  public void writeContent(final ITreeWriter writer, final Object element, final IExtension extension)
          throws IOException {
    final UnknownElements elements = (UnknownElements) extension;
    final XMLElement unknownElements = elements.getUnknownElements();
    if (unknownElements != null) {
      final Enumeration<XMLElement> unknownChildren = unknownElements.enumerateChildren();
      while (unknownChildren.hasMoreElements()) {
        writer.addElement(null, unknownChildren.nextElement());
      }
    }
  }
View Full Code Here

    }
  }

  private void writeAttributesGenerateContent(final ITreeWriter writer, final NodeModel node) {
    /** fc, 12.6.2005: XML must not contain any zero characters. */
    xmlNode = new XMLElement();
    EncryptionModel encryptionModel = EncryptionModel.getModel(node);
    mayWriteChildren = true;
    final Object mode = mode(writer);
    final boolean isNodeAlreadyWritten = isAlreadyWritten(node);
    if (encryptionModel != null && !(encryptionModel.isAccessible() && Mode.EXPORT.equals(mode)) && ! isNodeAlreadyWritten) {
View Full Code Here

  public static String getNameKey(final String name) {
        return "addons." + name;
    }

  public XMLElement toXml() {
    final XMLElement xmlElement = super.toXml();
    addScriptsAsChild(xmlElement);
        addLibAsChild(xmlElement);
    return xmlElement;
  }
View Full Code Here

        addLibAsChild(xmlElement);
    return xmlElement;
  }

  private void addScriptsAsChild(XMLElement parent) {
    XMLElement xmlElement = new XMLElement("scripts");
    for (Script script : scripts) {
      XMLElement scriptXmlElement = new XMLElement("script");
      scriptXmlElement.setAttribute("name", script.name);
      scriptXmlElement.setAttribute("menuTitleKey", script.menuTitleKey);
      scriptXmlElement.setAttribute("menuLocation", script.menuLocation);
      scriptXmlElement.setAttribute("executionMode", script.executionMode.toString());
      final List<String> permissionNames = ScriptingPermissions.getPermissionNames();
      for (String permission : permissionNames) {
        scriptXmlElement.setAttribute(permission, Boolean.toString(script.permissions.get(permission)));
      }
      xmlElement.addChild(scriptXmlElement);
    }
    parent.addChild(xmlElement);
  }
View Full Code Here

    }
    parent.addChild(xmlElement);
  }

    private void addLibAsChild(XMLElement parent) {
        final XMLElement xmlElement = new XMLElement("libs");
        if (lib != null) {
            for (String l : lib) {
                final XMLElement libElement = new XMLElement("lib");
                libElement.setAttribute("name", l);
                xmlElement.addChild(libElement);
            }
        }
        parent.addChild(xmlElement);
    }
View Full Code Here

  }

  private static final int DEFAULT_COLUMN_WIDTH = 75;
  private void saveLayout(AttributeTableLayoutModel layout, final ITreeWriter writer) throws IOException {
    if (layout != null) {
      XMLElement attributeElement = null;
      if (layout.getColumnWidth(0) != DEFAULT_COLUMN_WIDTH) {
        attributeElement = initializeNodeAttributeLayoutXMLElement(attributeElement);
        attributeElement.setAttribute("NAME_WIDTH", Integer.toString(layout.getColumnWidth(0)));
      }
      if (layout.getColumnWidth(1) != DEFAULT_COLUMN_WIDTH) {
        attributeElement = initializeNodeAttributeLayoutXMLElement(attributeElement);
        attributeElement.setAttribute("VALUE_WIDTH", Integer.toString(layout.getColumnWidth(1)));
      }
      if (attributeElement != null) {
        writer.addElement(layout, attributeElement);
      }
    }
View Full Code Here

TOP

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

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.