Package org.infoglue.cms.util.dom

Examples of org.infoglue.cms.util.dom.DOMBuilder


  {
    List<SiteNodeVO> siteNodes = new ArrayList<SiteNodeVO>();

    try
    {
      Document document = new DOMBuilder().getDocument(qualifyerXML);
      String entity = document.getRootElement().attributeValue("entity");
      Map<String, SiteNodeVO> addedSiteNodes = new HashMap<String, SiteNodeVO>();
     
      List<Element> children = document.getRootElement().elements();
      Iterator<Element> i = children.iterator();
View Full Code Here


    try
    {
            if(this.qualifyerXML != null && this.qualifyerXML.length() != 0)
        {
            Document document = new DOMBuilder().getDocument(this.qualifyerXML);
        List siteNodes = parseSiteNodesFromXML(this.qualifyerXML);
        Iterator iterator = siteNodes.iterator();
        int i=0;
        while(iterator.hasNext())
        {
View Full Code Here

  {
    List<SiteNodeVO> siteNodes = new ArrayList<SiteNodeVO>();

    try
    {
      Document document = new DOMBuilder().getDocument(qualifyerXML);
      String entity = document.getRootElement().attributeValue("entity");
      Map<String, SiteNodeVO> addedSiteNodes = new HashMap<String, SiteNodeVO>();

      @SuppressWarnings("unchecked")
      List<Element> children = document.getRootElement().elements();
View Full Code Here

    if(qualifyerXML == null || qualifyerXML.length() == 0)
      return contents;
   
    try
    {
      org.dom4j.Document document = new DOMBuilder().getDocument(qualifyerXML);
     
      String entity = document.getRootElement().attributeValue("entity");
     
      List children = document.getRootElement().elements();
      Iterator i = children.iterator();
View Full Code Here

    if(qualifyerXML == null || qualifyerXML.length() == 0)
      return siteNodes;
   
    try
    {
      org.dom4j.Document document = new DOMBuilder().getDocument(qualifyerXML);
     
      String entity = document.getRootElement().attributeValue("entity");
     
      List children = document.getRootElement().elements();
      Iterator i = children.iterator();
View Full Code Here

          }
        }
           
            logger.info("userPropertiesAttributesMap:" + userPropertiesAttributesMap.size());
           
            DOMBuilder domBuilder = new DOMBuilder();
            Document document = domBuilder.createDocument();
            Element rootElement = null;
            Element attributesRoot = null;
           
            logger.info("keepExistingAttributes:" + keepExistingAttributes);
            if(keepExistingAttributes && userPropertiesVO.getValue() != null)
          {
        String propertyXML = userPropertiesVO.getValue();
        document = domBuilder.getDocument(propertyXML);
       
            attributesRoot = (Element)document.getRootElement().element("attributes");
          }
          else
          {
              rootElement = domBuilder.addElement(document, "article");
              attributesRoot = domBuilder.addElement(rootElement, "attributes");
          }
           
            logger.info("attributesRoot:" + attributesRoot);
            logger.info("XML before:" + document.asXML());

            Iterator attributesIterator = userPropertiesAttributesMap.keySet().iterator();
            while(attributesIterator.hasNext())
            {
                String attributeName  = (String)attributesIterator.next();
                String attributeValue = (String)userPropertiesAttributesMap.get(attributeName);
               
                logger.info(attributeName + "=" + attributeValue);
               
                List<Element> elements = attributesRoot.elements(attributeName);
                logger.info("elements:" + elements.size());
                for(Element attribute : elements)
                {
                  logger.info("attribute:" + attribute);
                    if(attribute != null)
                      attributesRoot.remove(attribute);                 
                }
                Element attribute = domBuilder.addElement(attributesRoot, attributeName);
                
                logger.info("attribute after:" + attribute);
               
                domBuilder.addCDATAElement(attribute, attributeValue);
            }                 
           
            logger.info("XML:" + document.asXML());
           
            userPropertiesVO.setValue(document.asXML());
View Full Code Here

              contentVersionVO.setVersionModifier(this.principal.getName());

            @SuppressWarnings("unchecked")
            Map<String, String> attributes = (Map<String, String>)contentVersion.get("contentVersionAttributes");

            DOMBuilder domBuilder = new DOMBuilder();
            Document document = domBuilder.createDocument();

            Element rootElement = domBuilder.addElement(document, "root");
            domBuilder.addAttribute(rootElement, "xmlns", "x-schema:Schema.xml");
            Element attributesRoot = domBuilder.addElement(rootElement, "attributes");

            Iterator<String> attributesIterator = attributes.keySet().iterator();
            while(attributesIterator.hasNext())
            {
              String attributeName  = attributesIterator.next();
              String attributeValue = attributes.get(attributeName);

              attributeValue = cleanAttributeValue(attributeValue, allowHTMLContent, allowExternalLinks, allowDollarSigns, allowAnchorSigns);

              Element attribute = domBuilder.addElement(attributesRoot, attributeName);
              domBuilder.addCDATAElement(attribute, attributeValue);
            }

            contentVersionVO.setVersionValue(document.asXML());

            ContentVersionVO newContentVersionVO = contentVersionControllerProxy.acCreate(this.principal, newContentVO.getId(), languageId, contentVersionVO);
View Full Code Here

      @SuppressWarnings("unchecked")
      Map<String, String> attributes = (Map<String, String>)contentVersion.get("contentVersionAttributes");
           
            if(attributes != null && attributes.size() > 0)
            {
              DOMBuilder domBuilder = new DOMBuilder();

              Element attributesRoot = null;
            Document document = null;
           
        if (keepExistingAttributes && !isNewlyCreatedVersion)
              {
                String existingXML = contentVersionVO.getVersionValue();
                document = domBuilder.getDocument(existingXML);
                attributesRoot = (Element)document.getRootElement().element("attributes");
              }
              else
              {
                document = domBuilder.createDocument();
                Element rootElement = domBuilder.addElement(document, "root");
                domBuilder.addAttribute(rootElement, "xmlns", "x-schema:Schema.xml");
                attributesRoot = domBuilder.addElement(rootElement, "attributes");
              }

              if(logger.isDebugEnabled())
                logger.info("attributesRoot:" + attributesRoot);
             
              Iterator<String> attributesIterator = attributes.keySet().iterator();
              while(attributesIterator.hasNext())
              {
                  String attributeName  = attributesIterator.next();
                  String attributeValue = attributes.get(attributeName);
                 
                    attributeValue = cleanAttributeValue(attributeValue, allowHTMLContent, allowExternalLinks, allowDollarSigns, allowAnchorSigns);
                   
                    if(keepExistingAttributes)
                  {
                      Element attribute = attributesRoot.element(attributeName);
            if (attribute == null)
            {
              attribute = domBuilder.addElement(attributesRoot, attributeName);
            }
            attribute.clearContent();
            domBuilder.addCDATAElement(attribute, attributeValue);
                  }
                  else
                  {
                      Element attribute = domBuilder.addElement(attributesRoot, attributeName);
            domBuilder.addCDATAElement(attribute, attributeValue);
                  }
              }                 

              contentVersionVO.setVersionValue(document.asXML());
            }
View Full Code Here

     
        try
    {
        if(this.qualifyerXML != null && this.qualifyerXML.length() != 0)
        {
            Document document = new DOMBuilder().getDocument(this.qualifyerXML);
        List contents = parseContentsFromXML(this.qualifyerXML);
        Iterator i = contents.iterator();
        while(i.hasNext())
        {
            ContentVO contentVO = (ContentVO)i.next();
View Full Code Here

     
        try
    {
          if(this.qualifyerXML != null && this.qualifyerXML.length() != 0)
        {
            Document document = new DOMBuilder().getDocument(this.qualifyerXML);
        List contents = parseContentsFromXML(this.qualifyerXML);
        Iterator i = contents.iterator();
        while(i.hasNext())
        {
            ContentVO contentVO = (ContentVO)i.next();
View Full Code Here

TOP

Related Classes of org.infoglue.cms.util.dom.DOMBuilder

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.