Here is an example of how JFBP (the Java implementation of FBP) might specify a network to read XML, parse it and throw away the result (yes it was a test):
public class ProcXML extends Network {
protected void define() throws Throwable {
connect(component("Read", ReadText.class),
port("OUT"),
component("XMLToObj", XMLToObj.class),
port("IN"));
connect(component("XMLToObj"),
port("OUT"),
component("Discard", Discard.class),
port("IN"));
initialize(new FileReader("c:\\com\\jpmorrsn\\eb2engine\\te
+st\\data\\myXML3.txt"),
component("Read"),
port("SOURCE"));
}
public static void main(String[] argv) {
new ProcXML().go();
}
}
It names 3 components, and links them together using named ports. It is actually not too dissimilar from the SAX machine syntax, but your network can be as complex as you like.
XMLToObj is an XML parser I wrote that runs in the JFBP environment.
Your comment in the second para seems to suggest that you can use such a specification to link components written in different languages - I didn't know you could do that in Java. Where would I look to find out?
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
|
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.
|
|