I have an XML file with below sample (just one data record is given below), I am getting LF characters as mentioned in below specific lines. I need to remove those. When I tried, it is removing from complete file instead of those two specific lines.
And to add one LF after one line for each xml record.
I am having xml document as below.
<transactionid>
00
</transactionid>
<tracknumber>
0
</tracknumber>
<key>
N/A
</key>
But the data contains leading and trailing spaces between the tags. Please let me know how can i remove these leading and trailing spaces between the tags.... (2 Replies)
hey guys, i have an XML like this:
<documents>
<document>
<Object ID>100114699999</Object ID>
<Object Create Date Time>2008-04-07T00:00:00</Object Create Date Time>
</document>
<documents>
I need all my tags within the XML to not include any spaces. i.e. everything between <t a g> in... (8 Replies)
Hi
I have a .conf file having many location tags like
<Location /main>
AuthName main
AuthUserFile /ppt/gaea/passwd_main
Require user admin
</Location>
......
...
<Location /wonder>
AuthName gaea
AuthUserFile /ppt/gaea/passwd_gaea
Require... (3 Replies)
Hi,
I have a input xml file like this
<postalAddress:>379 PROSPECT ST </postalAddress:>
<street:>STE B </street:>
<l:>TORRINGTON </l:>
<st:>CT</st:>
<postalCode:>067905238</postalCode:>... (5 Replies)
Hi,
I have file with lines key=val.
For ex(conf.file):-
c=3
ef=78
b=40
ca=40
I want to remove the line with c=3, when I execute the below command it's removing both lines i.e c=3 and ca=40. Could you please correct my command.
/usr/xpg4/bin/awk -v key=c 'match($0,key)... (3 Replies)
Say the input was as follows:
Brat 20 x 1000 32rf
Pour 15 p 1621 05pr
Dart 10 z 1111 22xx
My program prompts for an input, what I want is to use the input to locate a specific field. Like if I type in, "Pou" then it would return "Pour" and just "Pour"
I currently have this line but it is... (6 Replies)
I have a XML file given as below:
"<ProductUOMAlternativeDetails>
<removetag>
<UOMCode>EA</UOMCode>
<numeratorForConversionToBaseUOM>1</numeratorForConversionToBaseUOM>
<denominatorForConversionToBaseUOM>1</denominatorForConversionToBaseUOM>
<length>0.59</length>
<width>0.96</width> ... (3 Replies)
Hello guys,
I would need to remove the last character ")" of a specific line. This can be from any line. Your help is appreciated. Below is the line.
HOSTNAME=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP))
Please help. (6 Replies)
I have an xml file dumped from rrd file, that I want to "patch" so the xml file doesn't contain any blank hole in the resulting graph of the rrd file.
Here is the file.
<!-- 2015-10-12 14:00:00 WIB / 1444633200 --> <row><v> 4.0419731265e+07 </v><v> 4.5045912770e+06... (2 Replies)
Hi Forum.
I have an XML file with the following requirement to move the <AdditionalAccountHolders> tag and its content right after the <accountHolderName> tag within the same file but I'm not sure how to accomplish this through a Unix script.
Any feedback will be greatly appreciated.
... (19 Replies)
Discussion started by: pchang
19 Replies
LEARN ABOUT DEBIAN
xml::sax::byrecord
XML::SAX::ByRecord(3pm) User Contributed Perl Documentation XML::SAX::ByRecord(3pm)NAME
XML::SAX::ByRecord - Record oriented processing of (data) documents
SYNOPSIS
use XML::SAX::Machines qw( ByRecord ) ;
my $m = ByRecord(
"My::RecordFilter1",
"My::RecordFilter2",
...
{
Handler => $h, ## optional
}
);
$m->parse_uri( "foo.xml" );
DESCRIPTION
XML::SAX::ByRecord is a SAX machine that treats a document as a series of records. Everything before and after the records is emitted as-
is while the records are excerpted in to little mini-documents and run one at a time through the filter pipeline contained in ByRecord.
The output is a document that has the same exact things before, after, and between the records that the input document did, but which has
run each record through a filter. So if a document has 10 records in it, the per-record filter pipeline will see 10 sets of (
start_document, body of record, end_document ) events. An example is below.
This has several use cases:
o Big, record oriented documents
Big documents can be treated a record at a time with various DOM oriented processors like XML::Filter::XSLT.
o Streaming XML
Small sections of an XML stream can be run through a document processor without holding up the stream.
o Record oriented style sheets / processors
Sometimes it's just plain easier to write a style sheet or SAX filter that applies to a single record at at time, rather than having to
run through a series of records.
Topology
Here's how the innards look:
+-----------------------------------------------------------+
| An XML:SAX::ByRecord |
| Intake |
| +----------+ +---------+ +--------+ Exhaust |
--+-->| Splitter |--->| Stage_1 |-->...-->| Merger |----------+----->
| +----------+ +---------+ +--------+ |
| ^ |
| | |
| +---------->---------------+ |
| Events not in any records |
| |
+-----------------------------------------------------------+
The "Splitter" is an XML::Filter::DocSplitter by default, and the "Merger" is an XML::Filter::Merger by default. The line that bypasses
the "Stage_1 ..." filter pipeline is used for all events that do not occur in a record. All events that occur in a record pass through the
filter pipeline.
Example
Here's a quick little filter to uppercase text content:
package My::Filter::Uc;
use vars qw( @ISA );
@ISA = qw( XML::SAX::Base );
use XML::SAX::Base;
sub characters {
my $self = shift;
my ( $data ) = @_;
$data->{Data} = uc $data->{Data};
$self->SUPER::characters( @_ );
}
And here's a little machine that uses it:
$m = Pipeline(
ByRecord( "My::Filter::Uc" ),
$out,
);
When fed a document like:
<root> a
<rec>b</rec> c
<rec>d</rec> e
<rec>f</rec> g
</root>
the output looks like:
<root> a
<rec>B</rec> c
<rec>C</rec> e
<rec>D</rec> g
</root>
and the My::Filter::Uc got three sets of events like:
start_document
start_element: <rec>
characters: 'b'
end_element: </rec>
end_document
start_document
start_element: <rec>
characters: 'd'
end_element: </rec>
end_document
start_document
start_element: <rec>
characters: 'f'
end_element: </rec>
end_document
METHODS
new
my $d = XML::SAX::ByRecord->new( @channels, \%options );
Longhand for calling the ByRecord function exported by XML::SAX::Machines.
CREDIT
Proposed by Matt Sergeant, with advise by Kip Hampton and Robin Berjon.
Writing an aggregator.
To be written. Pretty much just that "start_manifold_processing" and "end_manifold_processing" need to be provided. See
XML::Filter::Merger and it's source code for a starter.
perl v5.10.0 2009-06-11 XML::SAX::ByRecord(3pm)