/** * * * @return */ public String getFullAnnotationString() { XMLNode fullAnnotation = getFullAnnotation(); // System.out.println("getFullAnnotationString - " + fullAnnotation); if (fullAnnotation != null) { try { return fullAnnotation.toXMLString(); } catch (XMLStreamException e) { Logger logger = Logger.getLogger(Annotation.class); if (logger.isDebugEnabled()) { e.printStackTrace(); } } } return ""; }
/** * Writes the {@link Annotation} of an {@link SBase} element. * * @param sbase * the {@link SBase} element. * @param element * the matching {@link SMOutputElement} * @param writer * the {@link XMLStreamWriter} to write to. * @param indent * the number of indent white spaces of this annotation. * @param xmlFragment * @throws XMLStreamException if any error occur while creating the XML document. */ private void writeAnnotation(SBase sbase, SMOutputContainer element, XMLStreamWriter writer, int indent, boolean xmlFragment) throws XMLStreamException { XMLNode fullAnnotationXMLNode = sbase.getAnnotation().getFullAnnotation(); writer.writeCharacters("\n"); XMLNodeWriter xmlNodeWriter = new XMLNodeWriter(writer, indent, indentCount, indentChar); xmlNodeWriter.write(fullAnnotationXMLNode); }
XMLNode annoNode = sb.getAnnotation().getFullAnnotation(); Set<String> namespaceSet = new HashSet<String>();
@Override public boolean check(ValidationContext ctx, SBase sb) { boolean isValid = true; if (sb.isSetAnnotation()) { // loop over the top level elements of the annotation and make sure no SBML core namespace are used XMLNode annoNode = sb.getAnnotation().getFullAnnotation(); for (int i = 0; i < annoNode.getChildCount(); i++) { XMLNode topLevelChild = annoNode.getChild(i); if (topLevelChild.isText()) { continue; } XMLNamespaces namespaces = topLevelChild.getNamespaces(); for (int j = 0; j < namespaces.getLength(); j++) { String namespace = namespaces.getURI(j); if (namespacesTocheckFor10403.contains(namespace)) { // TODO - report error properly return false; } } } } return isValid; } };