Package org.vectomatic.dom.svg.utils

Examples of org.vectomatic.dom.svg.utils.ParserException


    SVGDocument doc = null;
    try {
      doc = parseFromString(rawSvg, "text/xml").cast();
     
    } catch(JavaScriptException e) {
      throw new ParserException(ParserException.Type.NotWellFormed, e.getMessage());
    }
    Element elt = doc.getDocumentElement();
    if ("parsererror".equals(DOMHelper.getLocalName(elt))) {
      String message = "Parsing error";
      if (elt.getFirstChild() != null) {
        message = elt.getFirstChild().<Text>cast().getData();
      }
      throw new ParserException(ParserException.Type.NotWellFormed, message);
    }
    SVGSVGElement svg = DOMHelper.importNode(DOMHelper.getCurrentDocument(), elt, true).cast();
    // IE9 bug workaround: update all SVG style elements by
    // adding a trailing whitespace char, otherwise IE9 will
    // ignore them
View Full Code Here


    if ("parsererror".equals(DOMHelper.getLocalName(elt))) {
      String message = "Parsing error";
      if (elt.getFirstChild() != null) {
        message = elt.getFirstChild().<Text>cast().getData();
      }
      throw new ParserException(ParserException.Type.NotWellFormed, message);
    }
    SVGSVGElement svg = DOMHelper.importNode(DOMHelper.getCurrentDocument(), elt, true).cast();
    operaFix(svg);
      return svg;
  }
View Full Code Here

    if ("parsererror".equals(DOMHelper.getLocalName(elt))) {
      String message = "Parsing error";
      if (elt.getFirstChild() != null) {
        message = elt.getFirstChild().<Text>cast().getData();
      }
      throw new ParserException(ParserException.Type.NotWellFormed, message);
    }
    SVGSVGElement svg = DOMHelper.importNode(DOMHelper.getCurrentDocument(), elt, true).cast();
    // For some reason xlink:href are not correctly evaluated in
    // some cases in mozilla. If one clones the node this seems
    // to solve the problem
View Full Code Here

    if ("parsererror".equals(DOMHelper.getLocalName(elt))) {
      String message = "Parsing error";
      if (elt.getFirstChild() != null) {
        message = elt.getFirstChild().<Text>cast().getData();
      }
      throw new ParserException(ParserException.Type.NotWellFormed, message);
    } else if ("html".equals(DOMHelper.getLocalName(elt))) {
      String message = DOMHelper.evaluateStringXPath(elt, "./x:body/x:parsererror/x:div/text()", new XPathPrefixResolver() {
        @Override
        public String resolvePrefix(String prefix) {
          if ("x".equals(prefix)) {
            return "http://www.w3.org/1999/xhtml";
          }
          return null;
        }
      });
      throw new ParserException(ParserException.Type.NotWellFormed, message);
    }
    SVGSVGElement svg = DOMHelper.importNode(DOMHelper.getCurrentDocument(), elt, true).cast();
    // For some reason xlink:href are not correctly evaluated in
    // some cases in mozilla. If one clones the node this seems
    // to solve the problem
View Full Code Here

    if ("parsererror".equals(DOMHelper.getLocalName(elt))) {
      String message = "Parsing error";
      if (elt.getFirstChild() != null) {
        message = elt.getFirstChild().<Text>cast().getData();
      }
      throw new ParserException(ParserException.Type.NotWellFormed, message);
    }
    return DOMHelper.importNode(DOMHelper.getCurrentDocument(), elt, true).<SVGSVGElement>cast();
  }
View Full Code Here

TOP

Related Classes of org.vectomatic.dom.svg.utils.ParserException

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.