Package org.jdom2

Examples of org.jdom2.CDATA


        return element;
    }

    protected Element generateCDATAElement(String name, String value) {
        Element element = new Element(name, CONTENT_NS);
        CDATA cdata = new CDATA(value);
        element.addContent(cdata);

        return element;
    }
View Full Code Here


        Element root = new Element(tag);
        if (value != null) {
            root.addContent(makeElement("timeStamp", value.getTimeStamp()));
            root.addContent(makeElement("location", value.getLocation()));
            root.addContent(makeElement("type", value.getType()));
            root.addContent(makeElement("full", new CDATA(value.getTranscriptText())));
        }
        return root;
    }
View Full Code Here

            root.addContent(makeElementList("cosponsors", "string", value.getCoSponsors()));
            root.addContent(makeElementList("multisponsors", "string", value.getMultiSponsors()));
            root.addContent(makeElement("summary", value.getSummary()));
            root.addContent(makeElement("committee", value.getCurrentCommittee()));
            root.addContent(makeElementList("actions", "action", value.getActions()));
            root.addContent(makeElement("text", new CDATA(value.getFulltext())));
            root.addContent(makeElement("memo", new CDATA(value.getMemo())));
            root.addContent(makeElement("law", value.getLaw()));
            root.addContent(makeElementList("votes", "vote", value.getVotes()));
            root.addContent(makeElement("uniBill", String.valueOf(value.isUniBill())));
        }
        return root;
View Full Code Here

            votesElement.addContent(voteElement);
        }
        billElement.addContent(votesElement);

        if (bill.getFulltext()!=null) {
            billElement.addContent(makeElement("text", new CDATA(bill.getFulltext())));
        }

        if (bill.getMemo()!=null) {
            billElement.addContent(makeElement("memo", new CDATA(bill.getMemo())));
        }

        write(makeElement("docket", billElement), out);
    }
View Full Code Here

        Element root = new Element("transcript");
        root.setAttribute("id", transcript.getId());
        root.addContent(makeElement("location", String.valueOf(transcript.getTimeStamp().getTime())));
        root.addContent(makeElement("location", transcript.getLocation()));
        root.addContent(makeElement("session", String.valueOf(transcript.getSession())));
        root.addContent(makeElement("text", new CDATA(transcript.getTranscriptText())));
        write(root, out);
    }
View Full Code Here

    sentence+="\t\t\t<s snum=\""+String.valueOf(s)+"\">\n";
    ArrayList<Content> stack=new ArrayList<Content>();
    stack.addAll(body.getContent());
    while(stack.size()>0)
    {
      Content c=stack.get(0);
      stack.remove(0);
      if(c.getCType().equals(CType.Text))//actual text
      {
        //a dot creates a new sentence after processing
        String line=c.getValue().trim();
        while(!line.equals(""))
        {         
          int idx=line.indexOf(" ");
          String words;
          if(idx>=0)
            words=line.substring(0,idx);
          else
            words=line;
          line=line.substring(words.length()).trim();
          String punct=words.replaceAll("\\p{Punct}","�");
          int index=0;
          while(!punct.equals(""))
          {
            idx=punct.indexOf("�");
            String word;
            if(idx>=0)
              word=punct.substring(0,idx);
            else
              word=punct;
            if(word.equals(""))
            {
              //first the punctuation then the word
              //add a punc node
             
              if(words.charAt(index)=='<')
              {
                sentence+="\t\t\t\t<punc>&lt;</punc>\n";
              }
              else
              {
                if(words.charAt(index)=='>')
                  sentence+="\t\t\t\t<punc>&gt;</punc>\n";
                else
                  sentence+="\t\t\t\t<punc>"+words.charAt(index)+"</punc>\n";
              }
              if(words.charAt(index)=='.')
              {
                sentence+=("\t\t\t</s>\n");
                if(sentence.contains("wf"))
                {
                  System.out.print(".");
                  s++;
                  paragraph+=sentence;
                }
                sentence="\t\t\t<s snum=\""+String.valueOf(s)+"\">\n";
              }
              index++;
              punct=punct.substring(1);
            }
            else
            {
              index+=word.length();
              sentence+="\t\t\t\t<wf cmd=\"tag\" pos=\"\" lemma=\""+word+"\" wnsn=\"0\" lexsn=\"NA\">";
              sentence+=word;
              sentence+="</wf>\n";
              punct=punct.substring(word.length());
            }
             
          }
           
        }
      }
      if(c.getCType().equals(CType.Element))//other html elements such a or table should extract the text inside these elements
      {
        Element current=(Element)c;
        //tr creates a new sentence after processing
        String href=current.getAttributeValue("href");
     
View Full Code Here

    /**
     * @since 1.4.5
     */
    public JDom2Writer(final Element container, final NameCoder nameCoder) {
        this(container, new DefaultJDOMFactory(), nameCoder);
    }
View Full Code Here

    /**
     * @since 1.4.5
     */
    public JDom2Writer(final Element container) {
        this(container, new DefaultJDOMFactory());
    }
View Full Code Here

    /**
     * @since 1.4.5
     */
    public JDom2Writer() {
        this(new DefaultJDOMFactory());
    }
View Full Code Here

            DOMBuilder domBuilder = new DOMBuilder();
            if (node.getNodeType() == Node.ELEMENT_NODE) {
                return domBuilder.build((org.w3c.dom.Element) node);
            }
            else if (node.getNodeType() == Node.DOCUMENT_NODE) {
                Document document = domBuilder.build((org.w3c.dom.Document) node);
                return document.getRootElement();
            }
        }
        // we have no other option than to transform
        JDOMResult jdomResult = new JDOMResult();
        transform(requestPayload, jdomResult);
View Full Code Here

TOP

Related Classes of org.jdom2.CDATA

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.