use of net.n3.nanoxml.XMLElement in project freeplane by freeplane.
the class TreeXmlReader method elementAttributesProcessed.
/*
* (non-Javadoc)
* @see
* freeplane.persistence.xml.n3.nanoxml.IXMLBuilder#elementAttributesProcessed
* (java.lang.String, java.lang.String, java.lang.String)
*/
public void elementAttributesProcessed(final String name, final String nsPrefix, final String nsURI) throws Exception {
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;
nodeCreator = null;
saveAsXmlUntil = lastBuiltElement;
}
}
use of net.n3.nanoxml.XMLElement in project freeplane by freeplane.
the class WindowConfigurationStorage method marshall.
private String marshall() {
final XMLElement xml = new XMLElement();
xml.setAttribute("x", Integer.toString(x));
xml.setAttribute("y", Integer.toString(y));
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;
}
}
use of net.n3.nanoxml.XMLElement in project freeplane by freeplane.
the class TreeXmlWriter method addElement.
public void addElement(final Object userObject, final String name) throws IOException {
final XMLElement element = new XMLElement(name);
addElement(userObject, element);
}
use of net.n3.nanoxml.XMLElement in project freeplane by freeplane.
the class CloudBuilder method writeContentImpl.
private void writeContentImpl(final ITreeWriter writer, final NodeModel node, final IExtension extension) 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));
// }
writer.addElement(model, cloud);
}
use of net.n3.nanoxml.XMLElement in project freeplane by freeplane.
the class AttributeBuilder method saveLayout.
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);
}
}
}
Aggregations