Sponsored Content
Top Forums Programming Unix/Linux Newbie(ish) Question - IPC/Signals Post 13603 by theultimatechuf on Sunday 20th of January 2002 10:38:06 PM
Old 01-20-2002
MySQL

Thank you very much, might seem obvious but hey - i'm new to all this.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Newbie question about unix flavours

Hi, I am newbie to unix. I am been immensily impressed by this forum. I have installed sun solaris in my pc and started learning unix. The question is, If i know one unix flavour (say sun solaris) is that i can claim, i know all the unix and linux flavours. Can i be able to work on other vendor... (3 Replies)
Discussion started by: Balaji
3 Replies

2. UNIX for Dummies Questions & Answers

linux newbie question...

I'm running Vector Linux on this computer, and everythign works fine, except for the NIC. I run netconfig, and then when I reboot it says: DC21140 at 0x9400(PCI BUS 0, device 11) h/w address 00:00:C0:2E:13:dC, and reqquires IRQ 9(provided by PCI BIOS) Setting up net subsytems. ... (5 Replies)
Discussion started by: Corey
5 Replies

3. UNIX for Dummies Questions & Answers

Newbie's question about COBOL Installation in Unix

I wanna to install a COBOL on the AIX unix server. Would u like to tell me the disk usage of COBOL installation? Thanks in advance. (2 Replies)
Discussion started by: GCTEII
2 Replies

4. Programming

signals related question

Hi all, Just a little question relative to signals. I know that if an application is in the sleep state, When a signal is catched, it will be processed by the handler. But what happens if it's processing something? Does the processing stops?? The following code should illustrate this case ... (2 Replies)
Discussion started by: ninjanesto
2 Replies

5. HP-UX

Question form unix newbie

hi, just starting to learn about unix in school. got stuck on shell script chapter and need some help i completed task one but the other four is byond me. Task 1) Write a shell script/program called dow that takes no arguments and displays just the current day of the week in lower case (i.e.... (2 Replies)
Discussion started by: wesleywu
2 Replies

6. Shell Programming and Scripting

Question using signals in my own shell..

Wasn't really sure where to put this, since I'm using C in UNIX, but I am making my own shell... so, what's going on is this: For our program, we had to create our own shell, and if the user pressed ctrl-c just at the cmdline, then this signal would be ignored, but if there is a foreground... (1 Reply)
Discussion started by: blind melon
1 Replies

7. UNIX for Dummies Questions & Answers

UNIX newbie NEWBIE question!

Hello everyone, Just started UNIX today! In our school we use solaris. I just want to know how do I setup Solaris 10 not the GUI one, the one where you have to type the commands like ECHO, ls, pwd, etc... I have windows xp and I also have vmware. I hope I am not missing anything! :p (4 Replies)
Discussion started by: Hanamachi
4 Replies

8. Shell Programming and Scripting

A question about signals in Unix

Whats a signal 0. An exhaustive search on signals landed me nowhere. Is it possible to do something like this trap "echo $var" 0. If so what signal does this trap catch ? (2 Replies)
Discussion started by: kinny
2 Replies

9. Solaris

errors on Netra-440: "IPC Warning: ipc: tcp_protocol: bad magic number"

I was asked to look into a problem with a Sun Netra 440 in another department. On the server in question, the relevant 'uname -a' information is, "SunOS host1 5.9 Generic_118558-16 sun4u sparc SUNW,Netra-440". That information aside, while the other admin is logged into the ALOM, these errors are... (0 Replies)
Discussion started by: Borealis
0 Replies

10. Programming

C++ signals Linux

how can do this programs in c++ Program description: Infinite loop in a program starts working with 2 seconds the screen (console) "I 'm trying" to write, but it automatically after 10 seconds, the screen "Close" will terminate the execution of typing. c++ code (3 Replies)
Discussion started by: ss54
3 Replies
XML::Filter::Merger(3pm)				User Contributed Perl Documentation				  XML::Filter::Merger(3pm)

NAME
XML::Filter::Merger - Assemble multiple SAX streams in to one document SYNOPSIS
## See XML::SAX::Manifold and XML::SAX::ByRecord for easy ways ## to use this processor. my $w = XML::SAX::Writer->new( Output => *STDOUT ); my $h = XML::Filter::Merger->new( Handler => $w ); my $p = XML::SAX::ParserFactory->parser( Handler => $h ); ## To insert second and later docs in to the first doc: $h->start_manifold_document( {} ); $p->parse_file( $_ ) for @ARGV; $h->end_manifold_document( {} ); ## To insert multiple docs inline (especially useful if ## a subclass does the inline parse): $h->start_document( {} ); $h->start_element( { ... } ); .... $h->start_element( { Name => "foo", ... } ); $p->parse_uri( $uri ); ## Body of $uri inserted in <foo>...</foo> $h->end_element( { Name => "foo", ... } ); ... DESCRIPTION
Combines several documents in to one "manifold" document. This can be done in two ways, both of which start by parsing a master document in to which (the guts of) secondary documents will be inserted. Inlining Secondary Documents The most SAX-like way is to simply pause the parsing of the master document between the two events where you want to insert a secondard document and parse the complete secondard document right then and there so it's events are inserted in the pipeline at the right spot. XML::Filter::Merger only passes the content of the secondary document's root element: my $h = XML::Filter::Merger->new( Handler => $w ); $h->start_document( {} ); $h->start_element( { Name => "foo1" } ); $p->parse_string( "<foo2><baz /></foo2>" ); $h->end_element( { Name => "foo1" } ); $h->end_document( {} ); results in $w seeing a document like "<foo1><baz/></foo1>". This technique is especially useful when subclassing XML::Filter::Merger to implement XInclude-like behavior. Here's a useless example that inserts some content after each "characters()" event: package Subclass; use vars qw( @ISA ); @ISA = qw( XML::Filter::Merger ); sub characters { my $self = shift; return $self->SUPER::characters( @_ ) ## ** unless $self->in_master_document; ## ** my $r = $self->SUPER::characters( @_ ); $self->set_include_all_roots( 1 ); XML::SAX::PurePerl->new( Handler => $self )->parse_string( "<hey/>" ); return $r; } ## **: It is often important to use the recursion guard shown here ## to protect the decision making logic that should only be run on ## the events in the master document from being run on events in the ## subdocument. Of course, if you want to apply the logic ## recursively, just leave the guard code out (and, yes, in this ## example, th guard code is phrased in a slightly redundant fashion, ## but we want to make the idiom clear). Feeding this filter "<foo> </foo>" results in "<foo> <hey/></foo>". We've called set_include_all_roots( 1 ) to get the secondary document's root element included. Inserting Manifold Documents A more involved way suitable to handling consecutive documents it to use the two non-SAX events--"start_manifold_document" and "end_manifold_document"--that are called before the first document to be combined and after the last one, respectively. The first document to be started after the "start_manifold_document" is the master document and is emitted as-is except that it will contain the contents of all of the other documents just before the root "end_element()" tag. For example: $h->start_manifold_document( {} ); $p->parse_string( "<foo1><bar /></foo1>" ); $p->parse_string( "<foo2><baz /></foo2>" ); $h->end_manifold_document( {} ); results in "<foo><bar /><baz /></foo>". The details In case the above was a bit vague, here are the rules this filter lives by. For the master document: o Events before the root "end_element" are forwarded as received. Because of the rules for secondary documents, any secondary documents sent to the filter in the midst of a master document will be inserted inline as their events are received. o All remaining events, from the root "end_element" are buffered until the end_manifold_document() received, and are then forwarded on. For secondary documents: o All events before the root "start_element" are discarded. There is no way to recover these (though we can add an option for most non- DTD events, I believe). o The root "start_element" is discarded by default, or forwarded if "set_include_all_roots( $v )" has been used to set a true value. o All events up to, but not including, the root "end_element" are forwarded as received. o The root "end_element" is discarded or forwarded if the matching "start_element" was. o All remaining events until and including the "end_document" are forwarded and processing. o Secondary documents may contain other secondary documents. o Secondary documents need not be well formed. The must, however, be well balanced. This requires very little buffering and is "most natural" with the limitations: o All of each secondary document's events must all be received between two consecutive events of it's master document. This is because most master document events are not buffered and this filter cannot tell from which upstream source a document came. o If the master document should happen to have some egregiously large amount of whitespace, commentary, or illegal events after the root element, buffer memory could be huge. This should be exceedingly rare, even non-existent in the real world. o If any documents are not well balanced, the result won't be. o METHODS
new my $d = XML::Filter::Merger->new( \%options ); reset Clears the filter after an accident. Useful when reusing the filter. new() and start_manifold_document() both call this. start_manifold_document This must be called before the master document's "start_document()" if you want XML::Filter::Merger to insert documents that will be sent after the master document. It does not need to be called if you are going to insert secondary documents by sending their events in the midst of processing the master document. It is passed an empty ({}) data structure. Additional Methods These are provided to make it easy for subclasses to find out roughly where they are in the document structure. Generally, these should be called after calling SUPER::start_...() and before calling SUPER::end_...() to be accurate. in_master_document Returns TRUE if the current event is in the first top level document. document_depth Gets how many nested documents surround the current document. 0 means that you are in a top level document. In manifold mode, This may or may not be a secondary document: secondary documents may also follow the primary document, in which case they have a document depth of 0. element_depth Gets how many nested elements surround the current element in the current input document. Does not count elements from documents surrounding this document. top_level_document_number Returns the number of the top level document in a manifold document. This is 0 for the first top level document, which is always the master document. end_manifold_document This must be called after the last document's end_document is called. It is passed an empty ({}) data structure which is passed on to the next processor's end_document() call. This call also causes the end_element() for the root element to be passed on. set_include_all_roots $h->set_include_all_roots( 1 ); Setting this option causes the merger to include all root element nodes, not just the first document's. This means that later documents are treated as subdocuments of the output document, rather than as envelopes carrying subdocuments. Given two documents received are: Doc1: <root1><foo></root1> Doc1: <root2><bar></root2> Doc3: <root3><baz></root3> then with this option cleared (the default), the result looks like: <root1><foo><bar><baz></root1> . This is useful when processing document oriented XML and each upstream filter channel gets a complete copy of the document. This is the case with the machine XML::SAX::Manifold and the splitting filter XML::Filter::Distributor. With this option set, the result looks like: <root1><foo><root2><bar></root2><root3><baz></root3></root1> This is useful when processing record oriented XML, where the first document only contains the preamble and postamble for the records and not all of the records. This is the case with the machine XML::SAX::ByRecord and the splitting filter XML::Filter::DocSplitter. The two splitter filters mentioned set this feature appropriately. LIMITATIONS
The events before and after a secondary document's root element events are discarded. It is conceivable that characters, PIs and commentary outside the root element might need to be kept. This may be added as an option. The DocumentLocators are not properly managed: they should be saved and restored around each each secondary document. Does not yet buffer all events after the first document's root end_element event. If these bite you, contact me. AUTHOR
Barrie Slaymaker <barries@slaysys.com> COPYRIGHT
Copyright 2002, Barrie Slaymaker, All Rights Reserved. You may use this module under the terms of the Artistic, GNU Public, or BSD licenses, you choice. perl v5.10.0 2009-09-02 XML::Filter::Merger(3pm)
All times are GMT -4. The time now is 05:18 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy