Package org.apache.wicket.markup.parser

Examples of org.apache.wicket.markup.parser.XmlTag


   * @param type
   *            The type of tag
   */
  public ComponentTag(final String name, final XmlTag.TagType type)
  {
    final XmlTag tag = new XmlTag();
    tag.setName(name);
    tag.setType(type);
    xmlTag = tag;
  }
View Full Code Here


  public String getWicketAjaxBaseUrlEncodedInLastResponse() throws IOException,
    ResourceStreamNotFoundException, ParseException
  {
    XmlPullParser parser = new XmlPullParser();
    parser.parse(getLastResponseAsString());
    XmlTag tag;
    while ((tag = parser.nextTag()) != null)
    {
      if (tag.isOpen() && tag.getName().equals("script") &&
        "wicket-ajax-base-url".equals(tag.getAttribute("id")))
      {
        parser.next();
        return parser.getString().toString().split("\\\"")[1];
      }
    }
View Full Code Here

      }

      // If a <head> tag is missing, insert it automatically
      if ((hasOpenWicketHead != -1) && (hasHead == -1))
      {
        final XmlTag headOpenTag = new XmlTag();
        headOpenTag.setName("head");
        headOpenTag.setType(TagType.OPEN);
        final ComponentTag openTag = new ComponentTag(headOpenTag);
        openTag.setId(HtmlHeaderSectionHandler.HEADER_ID);
        openTag.setAutoComponentTag(true);

        final XmlTag headCloseTag = new XmlTag();
        headCloseTag.setName(headOpenTag.getName());
        headCloseTag.setType(TagType.CLOSE);
        final ComponentTag closeTag = new ComponentTag(headCloseTag);
        closeTag.setOpenTag(openTag);
        closeTag.setId(HtmlHeaderSectionHandler.HEADER_ID);

        addMarkupElement(hasOpenWicketHead, openTag);
View Full Code Here

        if (Strings.isEmpty(markup) == false)
        {
          XmlPullParser p = new XmlPullParser();
          p.parse(markup);

          XmlTag tag;
          while ((tag = p.nextTag()) != null)
          {
            if (tagName.equalsIgnoreCase(tag.getName()))
            {
              hasChild = true;
              break;
            }
          }
View Full Code Here

        markup = AJAX_COMPONENT_CDATA_CLOSE.matcher(markup).replaceAll("</component>");

        XmlPullParser parser = new XmlPullParser();
        parser.parse(markup);

        XmlTag elm;
        XmlTag openTag = null;
        XmlTag closeTag = null;
        int level = 0;
        while ((elm = parser.nextTag()) != null && closeTag == null)
        {
          XmlTag xmlTag = elm;

          String xmlTagName = xmlTag.getName();
          if (openTag == null && xmlTagName.equalsIgnoreCase(tagName))
          {
            if (xmlTag.isOpen())
            {
              openTag = xmlTag;
            }
            else if (xmlTag.isOpenClose())
            {
              openTag = xmlTag;
              closeTag = xmlTag;
            }
          }
          else if (openTag != null)
          {
            String openTagName = openTag.getName();
            if (xmlTag.isOpen() && xmlTagName.equals(openTagName))
            {
              level++;
            }

            if (xmlTag.isClose())
            {
              if (xmlTagName.equals(openTagName))
              {
                if (level == 0)
                {
View Full Code Here

        markup = AJAX_COMPONENT_CDATA_CLOSE.matcher(markup).replaceAll("</component>");

        XmlPullParser parser = new XmlPullParser();
        parser.parse(markup);

        XmlTag elm;
        XmlTag openTag = null;
        XmlTag closeTag = null;
        int level = 0;
        while ((elm = parser.nextTag()) != null && closeTag == null)
        {
          XmlTag xmlTag = elm;

          if (openTag == null)
          {
            IValueMap attributeMap = xmlTag.getAttributes();

            for (Map.Entry<String, Object> entry : attributeMap.entrySet())
            {
              String attr = entry.getKey();
              if (attr.equals(attribute) && value.equals(entry.getValue()))
              {
                if (xmlTag.isOpen())
                {
                  openTag = xmlTag;
                }
                else if (xmlTag.isOpenClose())
                {
                  openTag = xmlTag;
                  closeTag = xmlTag;
                }
              }
            }
          }
          else
          {
            if (xmlTag.isOpen() && xmlTag.getName().equals(openTag.getName()))
            {
              level++;
            }

            if (xmlTag.isClose())
            {
              if (xmlTag.getName().equals(openTag.getName()))
              {
                if (level == 0)
                {
                  closeTag = xmlTag;
                  closeTag.setOpenTag(openTag);
View Full Code Here

        markup = AJAX_COMPONENT_CDATA_CLOSE.matcher(markup).replaceAll("</component>");

        XmlPullParser parser = new XmlPullParser();
        parser.parse(markup);

        XmlTag elm = null;
        XmlTag openTag = null;
        XmlTag closeTag = null;
        int level = 0;
        while ((elm = parser.nextTag()) != null)
        {
          XmlTag xmlTag = elm;
          if (openTag == null)
          {
            IValueMap attributeMap = xmlTag.getAttributes();
            for (Map.Entry<String, Object> entry : attributeMap.entrySet())
            {
              if (entry.getKey().equals(attribute) && value.equals(entry.getValue()))
              {
                if (xmlTag.isOpen())
                {
                  openTag = xmlTag;
                }
                else if (xmlTag.isOpenClose())
                {
                  openTag = xmlTag;
                  closeTag = xmlTag;
                }
              }
            }
          }
          else
          {
            if (xmlTag.isOpen() && xmlTag.getName().equals(openTag.getName()))
            {
              level++;
            }

            if (xmlTag.isClose())
            {
              if (xmlTag.getName().equals(openTag.getName()))
              {
                if (level == 0)
                {
                  closeTag = xmlTag;
                  closeTag.setOpenTag(openTag);
View Full Code Here

  public String getWicketAjaxBaseUrlEncodedInLastResponse() throws IOException,
    ResourceStreamNotFoundException, ParseException
  {
    XmlPullParser parser = new XmlPullParser();
    parser.parse(getLastResponseAsString());
    XmlTag tag;
    while ((tag = parser.nextTag()) != null)
    {
      if (tag.isOpen() && tag.getName().equals("script") &&
        "wicket-ajax-base-url".equals(tag.getAttribute("id")))
      {
        parser.next();
        return parser.getString().toString().split("\\\"")[1];
      }
    }
View Full Code Here

  private static class TestMarkupElement extends WicketTag
  {
    public TestMarkupElement()
    {
      super(new XmlTag());
    }
View Full Code Here

      }

      // If a <head> tag is missing, insert it automatically
      if ((hasOpenWicketHead != -1) && (hasHead == -1))
      {
        final XmlTag headOpenTag = new XmlTag();
        headOpenTag.setName("head");
        headOpenTag.setType(TagType.OPEN);
        final ComponentTag openTag = new ComponentTag(headOpenTag);
        openTag.setId(HtmlHeaderSectionHandler.HEADER_ID);
        openTag.setAutoComponentTag(true);

        final XmlTag headCloseTag = new XmlTag();
        headCloseTag.setName(headOpenTag.getName());
        headCloseTag.setType(TagType.CLOSE);
        final ComponentTag closeTag = new ComponentTag(headCloseTag);
        closeTag.setOpenTag(openTag);
        closeTag.setId(HtmlHeaderSectionHandler.HEADER_ID);

        addMarkupElement(hasOpenWicketHead, openTag);
View Full Code Here

TOP

Related Classes of org.apache.wicket.markup.parser.XmlTag

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.