/** * Returns the content of the 'desc' child of the given element. */ public static String getDescription(SVGElement elt) { String result = ""; boolean preserve = false; Node n = elt.getFirstChild(); if (n != null && n.getNodeType() == Node.ELEMENT_NODE) { String name = (n.getPrefix() == null) ? n.getNodeName() : n.getLocalName(); if (name.equals(SVG_DESC_TAG)) { preserve = ((SVGLangSpace)n).getXMLspace().equals (SVG_PRESERVE_VALUE); for (n = n.getFirstChild(); n != null; n = n.getNextSibling()) { if (n.getNodeType() == Node.TEXT_NODE) { result += n.getNodeValue(); } } } } return (preserve) ? XMLSupport.preserveXMLSpace(result) : XMLSupport.defaultXMLSpace(result); }
/** * Returns the content of the 'desc' child of the given element. */ public static String getDescription(SVGElement elt) { String result = ""; boolean preserve = false; Node n = elt.getFirstChild(); if (n != null && n.getNodeType() == Node.ELEMENT_NODE) { String name = (n.getPrefix() == null) ? n.getNodeName() : n.getLocalName(); if (name.equals(SVG_DESC_TAG)) { preserve = ((SVGLangSpace)n).getXMLspace().equals (SVG_PRESERVE_VALUE); for (n = n.getFirstChild(); n != null; n = n.getNextSibling()) { if (n.getNodeType() == Node.TEXT_NODE) { result += n.getNodeValue(); } } } } return (preserve) ? XMLSupport.preserveXMLSpace(result) : XMLSupport.defaultXMLSpace(result); }
/** * <b>DOM</b>: Implements {@link SVGDocument#getTitle()}. */ public String getTitle() { StringBuffer sb = new StringBuffer(); boolean preserve = false; for (Node n = getDocumentElement().getFirstChild(); n != null; n = n.getNextSibling()) { String ns = n.getNamespaceURI(); if (ns != null && ns.equals(SVG_NAMESPACE_URI)) { if (n.getLocalName().equals(SVG_TITLE_TAG)) { preserve = ((SVGLangSpace)n).getXMLspace().equals("preserve"); for (n = n.getFirstChild(); n != null; n = n.getNextSibling()) { if (n.getNodeType() == Node.TEXT_NODE) { sb.append(n.getNodeValue()); } } break; } } } String s = sb.toString(); return (preserve) ? XMLSupport.preserveXMLSpace(s) : XMLSupport.defaultXMLSpace(s); }
/** * <b>DOM</b>: Implements {@link SVGDocument#getTitle()}. */ public String getTitle() { StringBuffer sb = new StringBuffer(); boolean preserve = false; for (Node n = getDocumentElement().getFirstChild(); n != null; n = n.getNextSibling()) { String ns = n.getNamespaceURI(); if (ns != null && ns.equals(SVG_NAMESPACE_URI)) { if (n.getLocalName().equals(SVG_TITLE_TAG)) { preserve = ((SVGLangSpace)n).getXMLspace().equals("preserve"); for (n = n.getFirstChild(); n != null; n = n.getNextSibling()) { if (n.getNodeType() == Node.TEXT_NODE) { sb.append(n.getNodeValue()); } } break; } } } String s = sb.toString(); return (preserve) ? XMLSupport.preserveXMLSpace(s) : XMLSupport.defaultXMLSpace(s); }
/** * <b>DOM</b>: Implements {@link SVGDocument#getTitle()}. */ public String getTitle() { StringBuffer sb = new StringBuffer(); boolean preserve = false; for (Node n = getDocumentElement().getFirstChild(); n != null; n = n.getNextSibling()) { String ns = n.getNamespaceURI(); if (ns != null && ns.equals(SVG_NAMESPACE_URI)) { if (n.getLocalName().equals(SVG_TITLE_TAG)) { preserve = ((SVGLangSpace)n).getXMLspace().equals("preserve"); for (n = n.getFirstChild(); n != null; n = n.getNextSibling()) { if (n.getNodeType() == Node.TEXT_NODE) { sb.append(n.getNodeValue()); } } break; } } } String s = sb.toString(); return (preserve) ? XMLSupport.preserveXMLSpace(s) : XMLSupport.defaultXMLSpace(s); }
/** * Returns the content of the 'desc' child of the given element. */ public static String getDescription(SVGElement elt) { String result = ""; boolean preserve = false; Node n = elt.getFirstChild(); if (n != null && n.getNodeType() == Node.ELEMENT_NODE) { String name = (n.getPrefix() == null) ? n.getNodeName() : n.getLocalName(); if (name.equals(SVG_DESC_TAG)) { preserve = ((SVGLangSpace)n).getXMLspace().equals (SVG_PRESERVE_VALUE); for (n = n.getFirstChild(); n != null; n = n.getNextSibling()) { if (n.getNodeType() == Node.TEXT_NODE) { result += n.getNodeValue(); } } } } return (preserve) ? XMLSupport.preserveXMLSpace(result) : XMLSupport.defaultXMLSpace(result); }