/** * Writes the attributes of the {@link ASTNodePlugin}s present on the ASTNode. * * @param astNode */ private void writePlugins(ASTNode astNode) { // TODO - for now only writing the attributes, we will need to revisit if // one package add elements to mathML elements. ASTNodePlugin plugin = astNode.getPlugin("multi"); Map<String, String> attributes = plugin.writeXMLAttributes(); if (attributes.size() > 0) { for (String attributeKey : attributes.keySet()) { String attributeValue = attributes.get(attributeKey); try { writer.writeAttribute(attributeKey, attributeValue); } catch (XMLStreamException e) { e.printStackTrace(); } } } }
@Override public boolean processAttribute(String elementName, String attributeName, String value, String uri, String prefix, boolean isLastAttribute, Object contextObject) { // logger.debug("processAttribute -> " + prefix + ":" + attributeName + " = " + value + " (" + contextObject.getClass().getName() + ")"); if (contextObject instanceof SBase && ((SBase) contextObject).getPackageName().equals("core")) { if (!(contextObject instanceof SBMLDocument)) { contextObject = ((SBase) contextObject).getPlugin(getShortLabel()); } } else if (contextObject instanceof ASTNode) { contextObject = ((ASTNode) contextObject).getPlugin(getShortLabel()); } // TODO - ASTNode2 when it is used for reading. return super.processAttribute(elementName, attributeName, value, uri, prefix, isLastAttribute, contextObject); }