Package org.jdom2

Examples of org.jdom2.DocType


                                {
                                    skey.textToShow = trans.get(f);
                                    f = org.size();
                                }

                            Attribute a;
                            if ((a = keyEl.getAttribute(length)) != null)
                                skey.keyWidth = Integer.parseInt(a.getValue());

                            line.add(skey);
                        } else
                            line.add(SpecialKey.getKeyboardKey(fontName, special));
                    }
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

    @Test
  @Ignore
  // TODO
    public void testRTOutputDocumentFull() {
      Document doc = new Document();
      DocType dt = new DocType("root");
      dt.setInternalSubset(" ");
      doc.addContent(dt);
      doc.addContent(new Comment("This is a document"));
      doc.addContent(new ProcessingInstruction("jdomtest", ""));
      Element e = new Element("root");
      e.addContent(new EntityRef("ref"));
View Full Code Here

            break;
          case Comment:
            assertEquals(((Comment)a).getText(), ((Comment)b).getText());
            break;
          case DocType:
            DocType da = (DocType)a;
            DocType db = (DocType)b;
            assertEquals(da.getElementName(), db.getElementName());
            assertEquals(da.getPublicID(), db.getPublicID());
            assertEquals(da.getSystemID(), db.getSystemID());
            assertEquals(da.getInternalSubset(), db.getInternalSubset());
            break;
          case Element:
            Element ea = (Element)a;
            Element eb = (Element)b;
            assertEquals(ea.getName(), eb.getName());
View Full Code Here

  }
 

  @Test
  public void testDocTypeSimple() {
    DocType content = new DocType("root");
    assertEquals("<!DOCTYPE root>",
        outputString(fraw,     content));
    assertEquals("<!DOCTYPE root>",
        outputString(fcompact, content));
    assertEquals("<!DOCTYPE root>",
View Full Code Here

        outputString(ftfw,     content));
  }
 
  @Test
  public void testDocTypeSimpleISS() {
    DocType content = new DocType("root");
    content.setInternalSubset("<!ENTITY name \"value\">");
    assertEquals("<!DOCTYPE root [\n<!ENTITY name \"value\">]>",
        outputString(fraw,     content));
    assertEquals("<!DOCTYPE root [\n<!ENTITY name \"value\">]>",
        outputString(fcompact, content));
    assertEquals("<!DOCTYPE root [\n<!ENTITY name \"value\">]>",
View Full Code Here

        outputString(ftfw,     content));
  }
 
  @Test
  public void testDocTypeSystemID() {
    DocType content = new DocType("root", "sysid");
    assertEquals("<!DOCTYPE root SYSTEM \"sysid\">",
        outputString(fraw,     content));
    assertEquals("<!DOCTYPE root SYSTEM \"sysid\">",
        outputString(fcompact, content));
    assertEquals("<!DOCTYPE root SYSTEM \"sysid\">",
View Full Code Here

TOP

Related Classes of org.jdom2.DocType

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.