Package com.trolltech.qt.xml

Examples of com.trolltech.qt.xml.QDomText


        valueEnd = value.substring(end);
      }
     
      previousPosition = end;
      if (!valueStart.equals("")) {
        QDomText startText = doc.createTextNode(valueStart);
        fragment.appendChild(startText);
      }
     
      QDomElement hilight = doc.createElement("en-hilight");
      hilight.appendChild(doc.createTextNode(valueMiddle));
      fragment.appendChild(hilight);
    }
    if (matchFound) {
      if (previousPosition != value.length()) {
        QDomText endText = doc.createTextNode(valueEnd);
        fragment.appendChild(endText);
      }
      newNodes.add(fragment);
      oldNodes.add(node);
    }
View Full Code Here


      // Check if we have an en-crypt tag.  Change it from an img to en-crypt
      if (enType.equalsIgnoreCase("en-crypt")) {
       
        String encrypted = e.attribute("alt");
       
        QDomText crypt = doc.createTextNode(encrypted);
        e.appendChild(crypt);
       
        e.removeAttribute("v:shapes");
        e.removeAttribute("en-tag");
        e.removeAttribute("contenteditable");
        e.removeAttribute("alt");
        e.removeAttribute("src");
        e.removeAttribute("id");
        e.removeAttribute("onclick");
        e.removeAttribute("onmouseover");
        e.setTagName("en-crypt");
        node.removeChild(e);
        return;
      }

      // Check if we have a LaTeX image.  Remove the parent link tag
      if (enType.equalsIgnoreCase("en-latex")) {
        enType = "en-media";
        QDomNode parent = e.parentNode();
        parent.removeChild(e);
        parent.parentNode().replaceChild(e, parent);
      }
     
      // If we've gotten this far, we have an en-media tag
      e.setTagName(enType);
      resources.add(e.attribute("guid"));
      e.removeAttribute("guid");
      e.removeAttribute("src");
      e.removeAttribute("en-new");
      e.removeAttribute("en-tag");
    }
   
    // Tags like <ul><ul><li>1</li></ul></ul> are technically valid, but Evernote
    // expects that a <ul> tag only has a <li>, so we will need to change them
    // to this:  <ul><li><ul><li>1</li></ul></li></ul>
    if (node.nodeName().equalsIgnoreCase("ul")) {
      QDomNode firstChild = node.firstChild();
      QDomElement childElement = firstChild.toElement();
      if (childElement.nodeName().equalsIgnoreCase("ul")) {
        QDomElement newElement = doc.createElement("li");
        node.insertBefore(newElement, firstChild);
        node.removeChild(firstChild);
        newElement.appendChild(firstChild);
      }
    }
   
    if (node.nodeName().equalsIgnoreCase("en-hilight")) {
      QDomElement e = node.toElement();
      QDomText newText = doc.createTextNode(e.text());
      e.parentNode().replaceChild(newText,e);
    }
    if (node.nodeName().equalsIgnoreCase("span")) {
      QDomElement e = node.toElement();
      if (e.attribute("class").equalsIgnoreCase("en-hilight") || e.attribute("class").equalsIgnoreCase("en-spell")) {
        QDomText newText = doc.createTextNode(e.text());
        e.parentNode().replaceChild(newText,e);
      }
      if (e.attribute("pdfnavigationtable").equalsIgnoreCase("true")) {
        node.parentNode().removeChild(node);
      }
    }
   
    // Fix up encryption tag
    if (node.nodeName().equalsIgnoreCase("en-crypt-temp")) {
      QDomElement e = node.toElement();
      e.setTagName("en-crypt");
      String crypt = e.attribute("value");
      e.removeAttribute("value");
      QDomText cryptValue = doc.createTextNode(crypt);
      e.appendChild(cryptValue);
    }
  }
View Full Code Here

TOP

Related Classes of com.trolltech.qt.xml.QDomText

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.