You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hivemind.apache.org by Derek Brown <ze...@yahoo.com> on 2005/08/25 18:27:35 UTC

Configuration and XML Files

Hello,

I would like to implement hivemind configurations in
my application but have a few questions. I have a
folder in my web app (Tapestry), it contains a number
of xml files. Their structure is something like:

<books>
  <book>
    <name/>
    <chapters/>
  </book>
</books>

I would like to scan for all the xml files in a
directory and be able to create Book objects.

How do I specify where to find these files? Can this
be done in a module file? It would be ideal to combine
all the xml files, so I just get a list of the Book
objects, since the root element is irrelevant.

Thanks


		
____________________________________________________
Start your day with Yahoo! - make it your home page 
http://www.yahoo.com/r/hs 
 

---------------------------------------------------------------------
To unsubscribe, e-mail: hivemind-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: hivemind-user-help@jakarta.apache.org


Re: XML Parsing Question

Posted by Johan Lindquist <jo...@kawoo.co.uk>.
Hi Derek,

The functionality that you are asking for is currently not implemented,
but there is an issue logged in the JIRA -
http://issues.apache.org/jira/browse/HIVEMIND-62 - so it may be coming up.
 :)
Cheers,

Johan

> Hello,
>
> If a schema is declared in a hive module, is it
> possible to use this schema to build objects out of
> xml files I pass in?
>
> For example, I have a directory of XML files that my
> application reads, can I "pass" in these files to
> Hivemind so that it can build the objects for me,
> using the schema?
>
> Thanks
>
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: hivemind-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: hivemind-user-help@jakarta.apache.org
>
>
>


-- 
you too?


---------------------------------------------------------------------
To unsubscribe, e-mail: hivemind-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: hivemind-user-help@jakarta.apache.org


Re: Configuration and XML Files

Posted by Derek Brown <ze...@yahoo.com>.
Thanks for your reply and the example is greatly
appreciated. I can start replacing a lot of clunky
commons digester code with this.

--- Johan Lindquist <jo...@kawoo.co.uk> wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Hi Derek,
> 
> You can have any sort of XML inside a configuration
> point (if that is
> what you are asking).  The XML would then be
> translated into an object
> tree and given to your service (or could be
> retrieved using the
> getConfiguration on the Registry.
> 
> So for your example below, a sample schema (for the
> configurastion
> point) could be:
> 
> <configuration-point id="foo">
>   <schema>
>     <element name="books">
>       <element name="book">
>         <element name="name">
>           <conversion class="some.class.Name"
> parent-method="addName"/>
>         </element>
>         <element name="chapters">
>           <conversion class="some.class.Chapter"
> parent-method="addChapter"/>
>         </element>
>         <conversion class="some.class.Book"
> parent-method="addBook"/>
>       </element>
>     </element>
>   </schema>
> </configuration-point>
> 
> The grammar used is based on Digester, so if you are
> familiar with that
> it should be pretty straight forward.   Note you
> would need to code up
> the beans which the schema referes to (Book,
> Chapter, etc).
> 
> Hope that answers your question to some degree.
> 
> Cheers,
> 
> Johan
> 
> 
> Derek Brown wrote:
> > Hello,
> > 
> > To phrase my question better, is there a way to
> have
> > nested elements in module schemas?
> > 
> > Thanks
> > 
> > --- Derek Brown <ze...@yahoo.com> wrote:
> > 
> > 
> >>Hello,
> >>
> >>I would like to implement hivemind configurations
> in
> >>my application but have a few questions. I have a
> >>folder in my web app (Tapestry), it contains a
> >>number
> >>of xml files. Their structure is something like:
> >>
> >><books>
> >>  <book>
> >>    <name/>
> >>    <chapters/>
> >>  </book>
> >></books>
> >>
> >>I would like to scan for all the xml files in a
> >>directory and be able to create Book objects.
> >>
> >>How do I specify where to find these files? Can
> this
> >>be done in a module file? It would be ideal to
> >>combine
> >>all the xml files, so I just get a list of the
> Book
> >>objects, since the root element is irrelevant.
> >>
> >>Thanks
> >>
> >>
> >>		
>
>>____________________________________________________
> >>Start your day with Yahoo! - make it your home
> page 
> >>http://www.yahoo.com/r/hs 
> >> 
> >>
> >>
> > 
> >
>
---------------------------------------------------------------------
> > 
> >>To unsubscribe, e-mail:
> >>hivemind-user-unsubscribe@jakarta.apache.org
> >>For additional commands, e-mail:
> >>hivemind-user-help@jakarta.apache.org
> >>
> >>
> > 
> > 
> > 
> > 
> > 		
> > __________________________________ 
> > Yahoo! Mail 
> > Stay connected, organized, and protected. Take the
> tour: 
> > http://tour.mail.yahoo.com/mailtour.html 
> > 
> > 
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> hivemind-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail:
> hivemind-user-help@jakarta.apache.org
> > 
> > 
> 
> - --
> you too?
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.2.5 (GNU/Linux)
> Comment: Using GnuPG with Thunderbird -
> http://enigmail.mozdev.org
> 
>
iD8DBQFDDtkSHS6c76+IdrwRAptEAKCkCyCTDI9XitwTr11qGQH2/0ZJNgCgsFxD
> haxal+BG4KJaKC5j/NhVy2c=
> =SG40
> -----END PGP SIGNATURE-----
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> hivemind-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> hivemind-user-help@jakarta.apache.org
> 
> 



		
____________________________________________________
Start your day with Yahoo! - make it your home page 
http://www.yahoo.com/r/hs 
 

---------------------------------------------------------------------
To unsubscribe, e-mail: hivemind-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: hivemind-user-help@jakarta.apache.org


XML Parsing Question

Posted by Derek Brown <ze...@yahoo.com>.
Hello,

If a schema is declared in a hive module, is it
possible to use this schema to build objects out of
xml files I pass in?

For example, I have a directory of XML files that my
application reads, can I "pass" in these files to
Hivemind so that it can build the objects for me,
using the schema?

Thanks


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

---------------------------------------------------------------------
To unsubscribe, e-mail: hivemind-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: hivemind-user-help@jakarta.apache.org


Re: Configuration and XML Files

Posted by Johan Lindquist <jo...@kawoo.co.uk>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Derek,

You can have any sort of XML inside a configuration point (if that is
what you are asking).  The XML would then be translated into an object
tree and given to your service (or could be retrieved using the
getConfiguration on the Registry.

So for your example below, a sample schema (for the configurastion
point) could be:

<configuration-point id="foo">
  <schema>
    <element name="books">
      <element name="book">
        <element name="name">
          <conversion class="some.class.Name" parent-method="addName"/>
        </element>
        <element name="chapters">
          <conversion class="some.class.Chapter"
parent-method="addChapter"/>
        </element>
        <conversion class="some.class.Book" parent-method="addBook"/>
      </element>
    </element>
  </schema>
</configuration-point>

The grammar used is based on Digester, so if you are familiar with that
it should be pretty straight forward.   Note you would need to code up
the beans which the schema referes to (Book, Chapter, etc).

Hope that answers your question to some degree.

Cheers,

Johan


Derek Brown wrote:
> Hello,
> 
> To phrase my question better, is there a way to have
> nested elements in module schemas?
> 
> Thanks
> 
> --- Derek Brown <ze...@yahoo.com> wrote:
> 
> 
>>Hello,
>>
>>I would like to implement hivemind configurations in
>>my application but have a few questions. I have a
>>folder in my web app (Tapestry), it contains a
>>number
>>of xml files. Their structure is something like:
>>
>><books>
>>  <book>
>>    <name/>
>>    <chapters/>
>>  </book>
>></books>
>>
>>I would like to scan for all the xml files in a
>>directory and be able to create Book objects.
>>
>>How do I specify where to find these files? Can this
>>be done in a module file? It would be ideal to
>>combine
>>all the xml files, so I just get a list of the Book
>>objects, since the root element is irrelevant.
>>
>>Thanks
>>
>>
>>		
>>____________________________________________________
>>Start your day with Yahoo! - make it your home page 
>>http://www.yahoo.com/r/hs 
>> 
>>
>>
> 
> ---------------------------------------------------------------------
> 
>>To unsubscribe, e-mail:
>>hivemind-user-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail:
>>hivemind-user-help@jakarta.apache.org
>>
>>
> 
> 
> 
> 
> 		
> __________________________________ 
> Yahoo! Mail 
> Stay connected, organized, and protected. Take the tour: 
> http://tour.mail.yahoo.com/mailtour.html 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: hivemind-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: hivemind-user-help@jakarta.apache.org
> 
> 

- --
you too?
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFDDtkSHS6c76+IdrwRAptEAKCkCyCTDI9XitwTr11qGQH2/0ZJNgCgsFxD
haxal+BG4KJaKC5j/NhVy2c=
=SG40
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: hivemind-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: hivemind-user-help@jakarta.apache.org


Re: Configuration and XML Files

Posted by Derek Brown <ze...@yahoo.com>.
Hello,

To phrase my question better, is there a way to have
nested elements in module schemas?

Thanks

--- Derek Brown <ze...@yahoo.com> wrote:

> Hello,
> 
> I would like to implement hivemind configurations in
> my application but have a few questions. I have a
> folder in my web app (Tapestry), it contains a
> number
> of xml files. Their structure is something like:
> 
> <books>
>   <book>
>     <name/>
>     <chapters/>
>   </book>
> </books>
> 
> I would like to scan for all the xml files in a
> directory and be able to create Book objects.
> 
> How do I specify where to find these files? Can this
> be done in a module file? It would be ideal to
> combine
> all the xml files, so I just get a list of the Book
> objects, since the root element is irrelevant.
> 
> Thanks
> 
> 
> 		
> ____________________________________________________
> Start your day with Yahoo! - make it your home page 
> http://www.yahoo.com/r/hs 
>  
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> hivemind-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> hivemind-user-help@jakarta.apache.org
> 
> 



		
__________________________________ 
Yahoo! Mail 
Stay connected, organized, and protected. Take the tour: 
http://tour.mail.yahoo.com/mailtour.html 


---------------------------------------------------------------------
To unsubscribe, e-mail: hivemind-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: hivemind-user-help@jakarta.apache.org