Nobody can help me? Nobody knows? Nobody uses XML files? Everybody knows how
to do a digester but nobody knows how to use it?

I hope you can help me.

Regards,

Manuel

-----Original Message-----
From: Henrique, Manuel
To: 'tomcat-user@jakarta.apache.org'
Sent: 02/05/2005 17:12
Subject: Digester / vector usage

Hello all,

It made now 2 weeks that I have a little issue with the XML parsing. I
use
examples founds in the net. My question is very simple, if I have for
example an XML file like that:

<catalog library="somewhere">

   <book>
      <author>Author 1</author>
      <title>Title 1</title>
   </book>

   <book>
      <author>Author 2</author>
      <title>His One Book</title>
   </book>

   <magazine>
      <name>Mag Title 1</name>

      <article page="5">
         <headline>Some Headline</headline>
      </article>

      <article page="9">
         <headline>Another Headline</headline>
      </article>
   </magazine>

   <book>
      <author>Author 2</author>
      <title>His Other Book</title>
   </book>

   <magazine>
      <name>Mag Title 2</name>

      <article page="17">
         <headline>Second Headline</headline>
      </article>
   </magazine>

</catalog>

I have the catalog.class:
package com.erdv.logicacmg.control;

import java.util.Vector;

public class Catalog {
   private Vector books;
   private Vector magazines;

   //constructeur de catalog
   public Catalog() {
      books = new Vector();
      magazines = new Vector();
   }
        //gestion des livres
   public void addBook(Book newBook) {
      books.addElement(newBook);
   }
   public void setBooks(Vector books){
           this.books = books;
   }
   
   public Vector getBooks(){
           return books;
   }
   
   //gestion des magazines
   public void addMagazine(Magazine newMagazine) {
      magazines.addElement(newMagazine);
   }
   public void setMagazines(Vector magazines){
           this.magazines = magazines;
   }
   
   public Vector getMagazines(){
           return magazines;
   }

}

book class:
package com.erdv.logicacmg.control;

public class Book {
   private String author;
   private String title;

   public Book() {}

   public void setAuthor(String newAuthor) {author = newAuthor;}
   public void setTitle(String newTitle) {title  = newTitle;}
   
   public String getAuthor(){
           return author;
   }
   
   public string getTitle(){
           return title;
   }
   
}
the magazine class:
package com.erdv.logicacmg.control;

import java.util.Vector;

public class Magazine {
   private String name;
   private Vector articles;

   public Magazine() {
      articles = new Vector();
   }

   public void setName(String newName) {name = newName;}
   
   public String getName(){
           return name;
   }

   public void addArticle(Article a) {
      articles.addElement(a);
   }
   
   public void setArticles(Vector articles){
           this.articles = articles;
   }
   
   public Vector getArticles(){
           return articles;
   }
   


}

and so on...

I have also a digester class that create the rules and parse the file as
I
want. All is ok into the log file. It indicates no issue.

Now what I what is to get my values from my java code. I dont know how
to
do. I search help with the vector usage but nothing helps me to get my
values.

For example: in a java code how can I get the Headline value for the
magazine called "Mag 1" for the article page "5".

I tried in my java code to create a c as new catalog and after? How can
I
do. In all examples they uses Vectors but nobody explains how to do
after.

What it seems is that everybody talks about parsing, about digester but
nobody gives how to get the wanted value from the XML. Each time I ask
to
someone always the same answers "digest.parse()", "now catch your object
and
it's finished". Yes, it's exactly what I want but how can I do??

Could somebody help me please?

Regards,

Manuel

PS: I know I am a newbee in Tomcat/Java so no need to mock at me.

This e-mail and any attachment is for authorised use by the intended
recipient(s) only. It may contain proprietary material, confidential
information and/or be subject to legal privilege. It should not be
copied, disclosed to, retained or used by, any other party. If you are
not an intended recipient then please promptly delete this e-mail and
any attachment and all copies and inform the sender. Thank you.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

This e-mail and any attachment is for authorised use by the intended 
recipient(s) only. It may contain proprietary material, confidential 
information and/or be subject to legal privilege. It should not be copied, 
disclosed to, retained or used by, any other party. If you are not an intended 
recipient then please promptly delete this e-mail and any attachment and all 
copies and inform the sender. Thank you.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to