Package jp.aonir.fuzzyxml

Examples of jp.aonir.fuzzyxml.FuzzyXMLElement


  }

  public boolean beforeOpenTag(FuzzyXMLNode node, RenderContext renderContext, StringBuffer xmlBuffer) {
    boolean renderSurroundingTags = true;
    if (node instanceof FuzzyXMLElement) {
      FuzzyXMLElement element = (FuzzyXMLElement) node;
      String tagName = element.getName();
      if (WodHtmlUtils.isWOTag(tagName)) {
        renderSurroundingTags = false;
      }
      else if ("document".equals(tagName)) {
        renderSurroundingTags = false;
View Full Code Here


      }
     
      // getting TLDs from xmlns
      try {
        this._doc = new FuzzyXMLParser(false).parse(HTMLUtil.scriptlet2space(source,false));
        FuzzyXMLElement root = (FuzzyXMLElement)XPath.selectSingleNode(_doc.getDocumentElement(),"*");
        if(root!=null){
          FuzzyXMLAttribute[] attrs = root.getAttributes();
          for(int i=0;i<attrs.length;i++){
            if(attrs[i].getName().startsWith("xmlns:")){
              String[] dim = attrs[i].getName().split(":");
              if(dim.length > 1){
                TLDInfo info = null;
View Full Code Here

    try {
      WodParserCache cache = ((TemplateEditor) _editorInteraction.getHtmlDocumentProvider()).getSourceEditor().getParserCache();
      FuzzyXMLDocument htmlDocument = cache.getHtmlEntry().getModel();
      RenderContext renderContext = new RenderContext(true);
      renderContext.setDelegate(new PreviewRenderDelegate(cache));
      FuzzyXMLElement documentElement = htmlDocument.getDocumentElement();
      documentContents = documentElement.toXMLString(renderContext);
    } catch (Exception e) {
      e.printStackTrace();
    }

    if (_browser != null) {
View Full Code Here

        for (ElementRename rename : _renames) {
          FuzzyXMLDocument htmlModel = _cache.getHtmlEntry().getModel();
          FuzzyXMLNode[] woTags = NodeSelectUtil.getNodeByFilter(htmlModel.getDocumentElement(), new NamedWebobjectTagFilter(rename.getOldName()));

          for (FuzzyXMLNode woTag : woTags) {
            FuzzyXMLElement woElement = (FuzzyXMLElement) woTag;
            FuzzyXMLAttribute woNameAttr = woElement.getAttributeNode("name");
            if (woNameAttr != null) {
              int offset = woElement.getOffset() + woNameAttr.getValueDataOffset() + 1;
              int length = woNameAttr.getValueDataLength();
              htmlEdits.add(new ReplaceEdit(offset, length, rename.getNewName()));
            }
          }
        }
View Full Code Here

    TemplateSourceEditor sourceEditor = getSourceEditor();
    if (sourceEditor != null) {
      try {
        FuzzyXMLDocument xmlDocument = sourceEditor.getHtmlXmlDocument(true);
        if (xmlDocument != null) {
          FuzzyXMLElement selectedElement = xmlDocument.getElementByOffset(offset);
          if (selectedElement != null) {
            String tagName = selectedElement.getName();
            if (WodHtmlUtils.isWOTag(tagName)) {
              String woElementName = selectedElement.getAttributeValue("name");
              if (woElementName != null && woElementName.length() > 0) {
                _editorInteraction.fireWebObjectTagSelected(woElementName);
              }
            }
          }
View Full Code Here

  @Override
  protected List<TagInfo> getTagList() {
    ArrayList<TagInfo> list = new ArrayList<TagInfo>();
    list.addAll(this._tagList);
    // get namespace
    FuzzyXMLElement element = getOffsetElement();
    HashMap<String, String> nsPrefixMap = new HashMap<String, String>();
    getNamespace(nsPrefixMap, element);
    // add prefix to tag names
    Iterator ite = this._nsTagListMap.keySet().iterator();
    while (ite.hasNext()) {
View Full Code Here

  protected Image getNodeImage(FuzzyXMLNode element) {
    if (element instanceof FuzzyXMLCDATA) {
      return null;
    }
    else if (element instanceof FuzzyXMLElement) {
      FuzzyXMLElement e = (FuzzyXMLElement) element;
      if (e.getName().equalsIgnoreCase("html")) {
        return HTMLPlugin.getDefault().getImageRegistry().get(HTMLPlugin.ICON_TAG_HTML);
      }
      else if (e.getName().equalsIgnoreCase("title")) {
        return HTMLPlugin.getDefault().getImageRegistry().get(HTMLPlugin.ICON_TITLE);
      }
      else if (e.getName().equalsIgnoreCase("body")) {
        return HTMLPlugin.getDefault().getImageRegistry().get(HTMLPlugin.ICON_BODY);
      }
      else if (e.getName().equalsIgnoreCase("form")) {
        return HTMLPlugin.getDefault().getImageRegistry().get(HTMLPlugin.ICON_FORM);
      }
      else if (e.getName().equalsIgnoreCase("img")) {
        return HTMLPlugin.getDefault().getImageRegistry().get(HTMLPlugin.ICON_IMAGE);
      }
      else if (e.getName().equalsIgnoreCase("a")) {
        return HTMLPlugin.getDefault().getImageRegistry().get(HTMLPlugin.ICON_LINK);
      }
      else if (e.getName().equalsIgnoreCase("table")) {
        return HTMLPlugin.getDefault().getImageRegistry().get(HTMLPlugin.ICON_TABLE);
      }
      else if (e.getName().equalsIgnoreCase("input")) {
        String type = e.getAttributeValue("type");
        if (type != null) {
          if (type.equalsIgnoreCase("button") || type.equalsIgnoreCase("reset") || type.equalsIgnoreCase("submit")) {
            return HTMLPlugin.getDefault().getImageRegistry().get(HTMLPlugin.ICON_BUTTON);
          }
          else if (type.equalsIgnoreCase("radio")) {
            return HTMLPlugin.getDefault().getImageRegistry().get(HTMLPlugin.ICON_RADIO);
          }
          else if (type.equalsIgnoreCase("checkbox")) {
            return HTMLPlugin.getDefault().getImageRegistry().get(HTMLPlugin.ICON_CHECK);
          }
          else if (type.equalsIgnoreCase("text")) {
            return HTMLPlugin.getDefault().getImageRegistry().get(HTMLPlugin.ICON_TEXT);
          }
          else if (type.equalsIgnoreCase("password")) {
            return HTMLPlugin.getDefault().getImageRegistry().get(HTMLPlugin.ICON_PASS);
          }
          else if (type.equalsIgnoreCase("hidden")) {
            return HTMLPlugin.getDefault().getImageRegistry().get(HTMLPlugin.ICON_HIDDEN);
          }
        }
      }
      else if (e.getName().equalsIgnoreCase("select")) {
        return HTMLPlugin.getDefault().getImageRegistry().get(HTMLPlugin.ICON_SELECT);
      }
      else if (e.getName().equalsIgnoreCase("textarea")) {
        return HTMLPlugin.getDefault().getImageRegistry().get(HTMLPlugin.ICON_TEXTAREA);
      }
      return HTMLPlugin.getDefault().getImageRegistry().get(HTMLPlugin.ICON_TAG);
    }
    else if (element instanceof FuzzyXMLDocType) {
View Full Code Here

    return null;
  }

  private IHyperlink detectHyperlink(IDocument doc, int offset) {
    FuzzyXMLDocument document = new FuzzyXMLParser(false).parse(editor.getHTMLSource());
    FuzzyXMLElement element = document.getElementByOffset(offset);
    if (element == null) {
      return null;
    }
    FuzzyXMLAttribute[] attrs = element.getAttributes();
    HTMLHyperlinkInfo info = getOpenFileInfo(document, element, null, null, offset);
    if (info != null) {
      return (IHyperlink) info.getObject();
    }
    else {
View Full Code Here

   */
  protected String[] getIDs() {
    FuzzyXMLDocument doc = getDocument();
    List<String> list = new ArrayList<String>();
    if (doc != null) {
      FuzzyXMLElement element = doc.getDocumentElement();
      extractID(element, list);
    }
    return list.toArray(new String[list.size()]);
  }
View Full Code Here

    if (doc != null) {
      _woElements = new HashSet<FuzzyXMLElement>();

      final List<InlineWodProblem> inlineProblems = new LinkedList<InlineWodProblem>();

      FuzzyXMLElement rootElement = doc.getDocumentElement();
      //FuzzyXMLElement rootElement = (FuzzyXMLElement) XPath.selectSingleNode(doc.getDocumentElement(), "*");
      visitElement(rootElement, inlineProblems, validate);

      if (validate) {
        HtmlCacheEntry htmlCacheEntry = _cache.getHtmlEntry();
View Full Code Here

TOP

Related Classes of jp.aonir.fuzzyxml.FuzzyXMLElement

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.