[jdom-interest] Creating element

Cassio Prazeres cassio.prazeres at ig.com.br
Thu Aug 28 10:16:43 PDT 2003


Thanks for help. I use the following code:

import java.io.*;

import org.jdom.*;
import org.jdom.input.*;
import org.xml.sax.*;

public class CreateNITF {
  private Document document;

  public CreateNITF (String s) {
    // Create new SAXBuilder, using default parser
    SAXBuilder builder = new SAXBuilder();
    try {
      document = builder.build(new StringBufferInputStream (s));
    }
    catch (JDOMException ex) {
      System.out.println(ex.getMessage());
    }

  }

  public Document getDocument(){
    return document;
  }

}



----- Original Message ----- 
From: "Jason Hunter" <jhunter at servlets.com>
To: "Cassio Prazeres" <cassio.prazeres at ig.com.br>
Cc: "JDOM Interest List" <jdom-interest at jdom.org>
Sent: Wednesday, August 27, 2003 5:55 PM
Subject: Re: [jdom-interest] Creating element


> String content is string content.  If you add a string to an element it
> stays a string.  If you want it as elements: you SAXBuilder against it,
> get the produced content, and use that content.
>
> -jh-
>
> Cassio Prazeres wrote:
>
> > Sorry about duplicates.
> >
> > I can create a JDOM element passing a content text?
> >
> > example:
> >
> > I want create a element <body> whith the content:
> >
> > <p>The advent of the Web as a new publishing media where news may be
> > presented as a multimedia and interactive document and the
> > digitalization of content are imposing changes in the current models for
> > producing journalistic content.</p>
> > <p>These changes look for a rationalization in the way journalists
> > compose their material (possibly a multimedia document), mainly when the
> > same news must be presented trough different communication media and be
> > available for retrieving by tools oriented by metadata, markup and
> > hyperlinks established over contents.</p>
> > <p>The aims of this paper are to present and to discuss some problems
> > and solutions related to the authoring of hypermedia/multimedia news.
> > Issues like multimedia news content production (Multimedia Journalism),
> > news content production for publishing in multiple media (Journalism for
> > Multiple Media), preserving semantic of news content and establishing
> > hyperlinks among news are discussed in the paper.</p>
> > <p>A model to represent and manage news, based on markup languages, is
> > presented, together with a tool designed to minimize possible resistance
> > journalists may offer to these changes.</p>
> >
> > i try:
> >     String s = [text above]
> >     Element root = new Element("body");
> >     root.addContent(s);
> >     document = new Document();
> >     document.setRootElement(root);
> >
> > the tags <p> need to be elements too. The code above dont work. Anybody
> > have a suggestion???
> >
> >
> > Thanks and sorry about my wrong English.
>
> _______________________________________________
> To control your jdom-interest membership:
>
http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com
>




More information about the jdom-interest mailing list