Eliminating XML dependency in pococapsule

9 views
Skip to first unread message

hawkeye parker

unread,
Jul 8, 2009, 5:12:20 PM7/8/09
to pococapsule
Hi Ke Jin,

First, thanks so much for pococapsule. Really happy to have this in C+
+. Also, really appreciating your clear presentation of IoC.

This is in response to a previous post, "Java dependency". (I
accidentally sent a direct reply to you. Sending to the list now).

http://groups.google.com/group/pococapsule/browse_thread/thread/9986e150bc7e1167/c14fb23cda153c75?lnk=gst&q=java#c14fb23cda153c75

On Feb 29 2008, 12:35 am, Ke Jin <kjin...@gmail.com> wrote:
> ...
> Therefore, in real production environments (especially, considering
> they are C++ applications), it is not that desirable that XML
> descriptions would be directly used without first going through
> testing/verification/packaging etc. manipulations. For instance, many
> component frameworks (such as EJB, CCM, etc.) require XML descriptors
> to be used after being packaged in .ear, war, or .zip files.
> Therefore, in PocoCapsule, directly using XML descriptions is believed
> to be mostly useful for learning, testing, and product development. In
> PocoCapsule, XML descriptions can be pre-parsed, validated, model
> transformed, and encoded off-line using the PocoCapsule development
> tool pxencode. PocoCapsule runtime engine is able to read these pre-
> encode descriptions directly without using any XML parser at all.
> ...
> For production applicatins, if the XML library's runtime footprint is
> an concern, then the best solution is simply eliminate the XML
> handling instead of reduce it. By eliminating XML handling completely,
> the PocoCapsule engine is able to have a runtime footprint of
> ~70Kbytes.
> ...

When you say, "...the best solution is simply eliminate the XML
handling...", do you mean by using pxencode (as you suggest above)?
Or do you mean to somehow remove the XML dependency entirely from the
runtime (i.e., no call to POCO_AppContext::create("setup.xml",
"file"))?

If you mean the latter, can you give an example or brief explanation
of how you would do this? All of the pococapsule examples seem to
depend very explicitly on the call to POCO_AppContext::create(). I
can imagine how to get around this, but I'd love to hear your thoughts
on the topic (before I try it).

Thanks,
Hawkeye Parker
Message has been deleted

Ke Jin

unread,
Jul 9, 2009, 12:09:24 PM7/9/09
to pococapsule
On Jul 8, 2:12 pm, hawkeye parker <haug...@gmail.com> wrote:
> Hi Ke Jin,
>
> First, thanks so much for pococapsule.  Really happy to have this in C+
> +.  Also, really appreciating your clear presentation of IoC.
>

Good to hear this. Many thanks!

> This is in response to a previous post, "Java dependency".  (I
> accidentally sent a direct reply to you.  Sending to the list now).
>
> http://groups.google.com/group/pococapsule/browse_thread/thread/9986e...
in that post, I mean:
1. to remove the XML dependency entirely from the runtime
2. however, this doesn't mean no call to POCO_AppContext::create().
3. this needs pxencode.

POCO_AppContext::create() does not necessary load XML parser. It only
loads the parser when it is given a XML doc or string to handle. If
you save the pxencode output to a file, say setup.xyz, then, give that
file to this method, pococapsule will create the application context
without looking and loading the XML parser.

> If you mean the latter, can you give an example or brief explanation
> of how you would do this? All of the pococapsule examples seem to
> depend very explicitly on the call to POCO_AppContext::create(). I
> can imagine how to get around this, but I'd love to hear your thoughts
> on the topic (before I try it).

All examples in pococapsule can be used. In fact, all these examples
were tested on VxWorks platform (where we don't have a decent XML
parser with XSLT support) in this approach. To do this, pickup any
example,
say the hello example, then:

1. use pxencode to encode the setup.xml and save the output to a file,
say setup.xyz.
2. change the POCO_AppContext::create("setup.xml", "file") to
POCO_AppContext::create("setup.xyz", "file);

Then you done. Now, you don't need link your application with any XML
parser. It is easy to see that there is almost no application code
change to do this (therefore, these examples were tested on VxWorks
without code change). The only thing changed is the input XML document
file is substituded with its encoded configure file. By the way, the
pococapsule engine does _not_ use the extension name (e.g. ".xml" or
".xyz") to determine whether a given file is a XML document or a
encoded document. It uses the magic id in the file header ("<?xml" vs
something else). Therefore, you can name these files (xml or encoded)
with any extensions you like (or even no extension).

Hope this helps!
Ke

>
> Thanks,
> Hawkeye Parker

Ke Jin

unread,
Jul 9, 2009, 12:26:01 PM7/9/09
to pococapsule
Also, see section 2.3.1 in the developer guide <http://
pococapsule.googlecode.com/files/pococpp-iocdsm-dev-guide102.pdf>

Ke

hawkeye parker

unread,
Jul 20, 2009, 4:16:52 PM7/20/09
to pococapsule
Hi Ke Jin,

Thanks very much for the extensive reply. Makes perfect sense!

Hawkeye
> > Hawkeye Parker- Hide quoted text -
>
> - Show quoted text -- Hide quoted text -
>
> - Show quoted text -
Reply all
Reply to author
Forward
0 new messages