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 AW: XMLForm and Table output
Date Mon, 02 Dec 2002 10:10:13 GMT
I already solved the problem and I am now sure that the xml output is
correct. 
But how do I address this in the xml file. I tried the following, but it
didn't 
worked out.
	<xf:selectMany ref="/Users" selectUIType="checkbox">
      <xf:caption>Usernames:</xf:caption>
      	<xf:itemset nodeset="User">
        		<xf:caption ref="custname"/>
        		<xf:caption ref="address"/>
        		<xf:caption ref="city"/>
        		<xf:caption ref="zip"/>
      	</xf:itemset>
	</xf:selectMany>	

But maybe another reason is that the DOM is created correctly but not passed
to
the pipeline. the node system for this or thinking that this is the var that
is 
passed. I assign my dom node root to the system node. is this correct or do
I have
to do something else to pass the dom.

ciao Lars



> -----Urspr√ľngliche Nachricht-----
> Von: Kirchhoff, Lars 
> Gesendet: Montag, 2. Dezember 2002 14:15
> An: 'cocoon-users@xml.apache.org'
> Betreff: 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>


Mime
View raw message