cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kirchhoff, Lars" <Lars.Kirchh...@wincor-nixdorf.com>
Subject Re: XMLForm and Table output
Date Tue, 03 Dec 2002 04:57:58 GMT
I mean NOW I can access the dom..

> -----Ursprüngliche Nachricht-----
> Von: Kirchhoff, Lars 
> Gesendet: Dienstag, 3. Dezember 2002 12:54
> An: 'cocoon-users@xml.apache.org'
> Betreff: AW: XMLForm and Table output
> 
> 
> no I didn't, but I forget to set the get and set method in 
> the JavaBean.
> No I can access the dom   with the following:
> 
> 	<xf:selectMany ref="/system" selectUIType="checkbox">
> 	      <xf:caption>Username:</xf:caption>
> 	     	<xf:itemset nodeset="/system">
> 	     		<xf:caption ref="user/custname"/>
> 	     	</xf:itemset>
> 	</xf:selectMany>		
> 	
> 	<xf:caption>Userlist:</xf:caption>
> 	<xf:repeat nodeset="/system" id="system">
> 		<xf:textbox ref="user/custname" 
> class="info"></xf:textbox>
> 		<xf:textbox ref="user/address" 
> class="info"></xf:textbox>
> 		<xf:textbox ref="user/zip" class="info"></xf:textbox>
> 		<xf:textbox ref="user/city" class="info"></xf:textbox>
> 	</xf:repeat>  	
> 
> but the funny thing is, that I only can access the first 
> <user> element. I
> don't 
> get all <user> elements.
> 
> > -----Ursprüngliche Nachricht-----
> > Von: Ivelin Ivanov [mailto:ivelin@apache.org]
> > Gesendet: Dienstag, 3. Dezember 2002 12:05
> > An: cocoon-users@xml.apache.org
> > Betreff: Re: XMLForm and Table output
> > 
> > 
> > Did you try setting your form model as a DocumentContainer 
> > which contains
> > the DOM object?
> > 
> > http://jakarta.apache.org/commons/jxpath/users-guide.html#Containers
> > 
> > 
> > 
> > 
> > ----- Original Message -----
> > From: "Kirchhoff, Lars" <Lars.Kirchhoff@wincor-nixdorf.com>
> > To: <cocoon-users@xml.apache.org>
> > Sent: Monday, December 02, 2002 8:35 PM
> > Subject: AW: XMLForm and Table output
> > 
> > 
> > maybe I was a bit unprecise. I already could see that the xml 
> > output is
> > correct.
> > the only thing I'm still not sure is how to reference the dom 
> > in the xml
> > page.
> > I tried the following:
> > <xf:repeat nodeset="/Users/user" id="myUsers">
> > <xf:textbox ref="custname" class="info"></xf:textbox>
> > <xf:textbox ref="address" class="info"></xf:textbox>
> > <xf:textbox ref="city" class="info"></xf:textbox>
> > <xf:textbox ref="zip" class="info"></xf:textbox>
> > </xf:repeat>
> > 
> > and
> > 
> > <xf:selectMany ref="/" selectUIType="checkbox">
> >       <xf:caption>Usernames:</xf:caption>
> >       <xf:itemset nodeset="/Users/user">
> >         <xf:caption ref="custname"/>
> >         <xf:caption ref="address"/>
> >         <xf:caption ref="city"/>
> >         <xf:caption ref="zip"/>
> >       </xf:itemset>
> > </xf:selectMany>
> > 
> > and several others ... (but this seemed to be the most logical ones
> > after reading the xmlform specs from w3c)
> > 
> > but it's not working. Now my guess is that probably the data is not
> > return probaply to the xml page or better the pipeline. In 
> the action
> > java file I have this getForm().getModel(); statement and am now
> > wondering if this returns all Data, not only the bean data?
> > 
> > maybe you can help finding the light out of this...
> > 
> > ciao Lars
> > 
> > > -----Ursprüngliche Nachricht-----
> > > Von: Ivelin Ivanov [mailto:ivelin@apache.org]
> > > Gesendet: Dienstag, 3. Dezember 2002 10:00
> > > An: cocoon-users@xml.apache.org
> > > Betreff: Re: XMLForm and Table output
> > >
> > >
> > > I am not sure what exactly the problem is,
> > > but I guess you might be actually looking for a file reader 
> > instead of
> > > generator.
> > >
> > > I have not really used Cocoon for printing.
> > >
> > > Ivelin
> > >
> > >
> > > ----- Original Message -----
> > > From: "Kirchhoff, Lars" <Lars.Kirchhoff@wincor-nixdorf.com>
> > > To: <cocoon-users@xml.apache.org>
> > > Sent: Monday, December 02, 2002 12:15 AM
> > > Subject: AW: XMLForm and Table output
> > >
> > >
> > > thanks Ivelin,
> > >
> > > but now I'm right in front of a new problem, how to print out
> > > the document
> > > using
> > > cocoon? I couldn't find a generator that gets the input right
> > > from a stream?
> > > Do I have to write my own generator? If yes, can you point 
> > me to some
> > > documentation
> > > about this, because I couldn't found it.
> > >
> > > thanks Lars
> > >
> > > > -----Ursprüngliche Nachricht-----
> > > > Von: Ivelin Ivanov [mailto:ivelin@apache.org]
> > > > Gesendet: Sonntag, 1. Dezember 2002 00:03
> > > > An: cocoon-users@xml.apache.org
> > > > Betreff: Re: XMLForm and Table output
> > > >
> > > >
> > > > Yes. You are on the right track.
> > > > Why don't you print the XML document once it is created to
> > > see what it
> > > > actually contains.
> > > > I suspect this might be a simple mistake due to misuse of the
> > > > API. It is not
> > > > very convenient.
> > > > Actually if you plan writing a lot of DOM code, you may want
> > > > to look at JDOM
> > > > or some of the O/R mapping frameworks.
> > > >
> > > >
> > > > Ivelin
> > > >
> > > >
> > > >
> > > > ----- Original Message -----
> > > > From: "Kirchhoff, Lars" <Lars.Kirchhoff@wincor-nixdorf.com>
> > > > To: "Cocoon-Users (E-Mail)" <cocoon-users@xml.apache.org>
> > > > Sent: Thursday, November 28, 2002 4:49 AM
> > > > Subject: XMLForm and Table output
> > > >
> > > >
> > > > > Hi,
> > > > >
> > > > > it's me again and I hope I'm still getting answers and not
> > > > starting to
> > > > > bother you all
> > > > > with all my questions.
> > > > > I've tried to create an application which simple should get
> > > > some user data
> > > > > from a
> > > > > database, by simply enter the name. So my first form is
> > > > just a text field
> > > > > where the name
> > > > > can be inserted. If the name is found all data will be
> > > > shown. so far so
> > > > > good. But now
> > > > > I would like to built something more. Because I do not look
> > > > at the exact
> > > > > name in the
> > > > > database it could be possible to get more then one entry. I
> > > > now want to
> > > > > create a page,
> > > > > where all possible names are shown and some more additional
> > > > information
> > > > > about them.
> > > > > So what I would like to have should be looking like this:
> > > > >       ----------------------------------------------
> > > > >       | name   | address   | city     | zip        |
> > > > >       ----------------------------------------------
> > > > >       | name1  | address1  | city1    | zip1       |
> > > > >       | name2  | address2  | city2    | zip2       |
> > > > >       | name3  | address3  | city3    | zip3       |
> > > > >       | ...    | ...       | ...      | ...        |
> > > > >
> > > > > where the user has the possibility to click on the a name
> > > > to get the full
> > > > > detail.
> > > > > So what I thought is to write a method which get me the
> > > > data from the
> > > > > database and
> > > > > put this in a DOM Nodes. I thought this would enable me to
> > > > use them in the
> > > > > <xf:repeat>
> > > > > statement, but unfortunately it didn't worked out so far.
> > > > >
> > > > > Here is the code I used to create the DOM Nodes:
> > > > >
> > > > --------------------------------------------------------------
> > > > ------------
> > > > --
> > > > > ---------------
> > > > >    // ========================================================
> > > > >    // Use DOM nodes to store values
> > > > >    // ========================================================
> > > > >    DOMImplementation impl;
> > > > >
> > > > >    try {
> > > > > DocumentBuilderFactory factory =
> > > > > DocumentBuilderFactory.newInstance();
> > > > > factory.setNamespaceAware( false );
> > > > > factory.setValidating( false );
> > > > > DocumentBuilder builder = factory.newDocumentBuilder();
> > > > > impl = builder.getDOMImplementation();
> > > > >    }
> > > > >    catch ( Exception e ) {
> > > > > throw new RuntimeException( "Failed to initialize DOM
> > > factory. Root
> > > > > cause: \n" + e );
> > > > >    }
> > > > >
> > > > >    // ========================================================
> > > > >    // Use DOM nodes to store values
> > > > >    // ========================================================
> > > > >   Document doc = impl.createDocument( null, "Users", null );
> > > > >   Node root = doc.getDocumentElement();
> > > > >   Node custname = null;
> > > > >   Node address = null;
> > > > >   Node zip = null;
> > > > >   Node city = null;
> > > > >   Node user = null;
> > > > > Text text;
> > > > >
> > > > > try {
> > > > > Class.forName( "org.postgresql.Driver" );
> > > > > Connection con =
> > > > > DriverManager.getConnection( DB_URL, DB_USER, DB_PASS );
> > > > > Statement stmt = con.createStatement();
> > > > > String update = "select custname, busname,
> > > > > address, city, state, zip, pobox, pocode from customer
> > > > where custname like
> > > > > '%" + name + "%'";
> > > > > ResultSet rs = stmt.executeQuery( update
> > > > > );
> > > > >
> > > > > while ( rs.next() ) {
> > > > > user = doc.createElement( "user" );
> > > > > root.appendChild( user );
> > > > >
> > > > > custname = doc.createElement( "custname" );
> > > > >
> > > > > text = doc.createTextNode( rs.getString(
> > > > > "custname" ) );
> > > > > custname.appendChild( text );
> > > > > user.appendChild( custname );
> > > > >
> > > > > address = doc.createElement( "address" );
> > > > >
> > > > > text = doc.createTextNode( rs.getString(
> > > > > "address" ) );
> > > > > address.appendChild( text );
> > > > > user.appendChild( address );
> > > > >
> > > > > zip = doc.createElement( "zip" );
> > > > >
> > > > > text = doc.createTextNode( rs.getString( "zip" )
> > > > > );
> > > > > zip.appendChild( text );
> > > > > user.appendChild( zip );
> > > > >
> > > > > city = doc.createElement( "city" );
> > > > >
> > > > > text = doc.createTextNode( rs.getString( "city" )
> > > > > );
> > > > > city.appendChild( text );
> > > > > user.appendChild( city );
> > > > >
> > > > > system = root;
> > > > > }
> > > > > }
> > > > > catch( Exception e ) { }
> > > > >
> > > > --------------------------------------------------------------
> > > > ------------
> > > > --
> > > > > ---------------
> > > > >
> > > > > I expected to create the following structure with it:
> > > > >
> > > > > <users>
> > > > > <user>
> > > > > <custname></custname>
> > > > > <address></address>
> > > > > <zip></zip>
> > > > > <city></city>
> > > > > </user>
> > > > > <user>
> > > > > <custname></custname>
> > > > > <address></address>
> > > > > <zip></zip>
> > > > > <city></city>
> > > > > </user>
> > > > > </users>
> > > > >
> > > > > So what I'm now wondering is, if I'm on the right track and
> > > > just doing
> > > > some
> > > > > beginner mistakes
> > > > > or if this won't work at all.
> > > > >
> > > > > Thanks in advance that you read up to here.
> > > > >
> > > > > ciao Lars
> > > > >
> > > > >
> > > >
> > > 
> > 
> ---------------------------------------------------------------------
> > > > > Please check that your question  has not already been
> > > > answered in the
> > > > > FAQ before posting.
> > > > <http://xml.apache.org/cocoon/faq/index.html>
> > > > >
> > > > > To unsubscribe, e-mail:
> > > > <cocoon-users-unsubscribe@xml.apache.org>
> > > > > For additional commands, e-mail:
> > > > <cocoon-users-help@xml.apache.org>
> > > > >
> > > >
> > > >
> > > >
> > > 
> > 
> ---------------------------------------------------------------------
> > > > Please check that your question  has not already been
> > > answered in the
> > > > FAQ before posting.
> > > <http://xml.apache.org/cocoon/faq/index.html>
> > > >
> > > > To unsubscribe, e-mail:
> > > <cocoon-users-unsubscribe@xml.apache.org>
> > > > For additional commands, e-mail:
> > > <cocoon-users-help@xml.apache.org>
> > > >
> > >
> > > 
> > 
> ---------------------------------------------------------------------
> > > Please check that your question  has not already been 
> > answered in the
> > > FAQ before posting.     
> > <http://xml.apache.org/cocoon/faq/index.html>
> > >
> > > To unsubscribe, e-mail:     
> > <cocoon-users-unsubscribe@xml.apache.org>
> > > For additional commands, e-mail:   
> > <cocoon-users-help@xml.apache.org>
> > >
> > >
> > >
> > > 
> > 
> ---------------------------------------------------------------------
> > > Please check that your question  has not already been 
> > answered in the
> > > FAQ before posting.     
> > <http://xml.apache.org/cocoon/faq/index.html>
> > >
> > > To unsubscribe, e-mail:     
> > <cocoon-users-unsubscribe@xml.apache.org>
> > > For additional commands, e-mail:   
> > <cocoon-users-help@xml.apache.org>
> > >
> > 
> > 
> ---------------------------------------------------------------------
> > Please check that your question  has not already been 
> answered in the
> > FAQ before posting.     
<http://xml.apache.org/cocoon/faq/index.html>
> 
> To unsubscribe, e-mail:     <cocoon-users-unsubscribe@xml.apache.org>
> For additional commands, e-mail:   <cocoon-users-help@xml.apache.org>
> 
> 
> 
> ---------------------------------------------------------------------
> Please check that your question  has not already been answered in the
> FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>
> 
> To unsubscribe, e-mail:     <cocoon-users-unsubscribe@xml.apache.org>
> For additional commands, e-mail:   <cocoon-users-help@xml.apache.org>
> 

---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <cocoon-users-unsubscribe@xml.apache.org>
For additional commands, e-mail:   <cocoon-users-help@xml.apache.org>

---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <cocoon-users-unsubscribe@xml.apache.org>
For additional commands, e-mail:   <cocoon-users-help@xml.apache.org>


Mime
View raw message