Sponsored Content
Top Forums Programming Extract xml data and create word document using perl. Post 302565612 by veerubiji on Tuesday 18th of October 2011 11:06:31 AM
Old 10-18-2011
Hi,
I extracted some information from my xml data, I stored in a hash. i am printing my hash my output look like this
Code:
$var1={
        'stud.xml'={ 
                   '24'=>'<address>
                           <streetname="xxxx"/>
                            <housenum="138"/">
                           </address>'
                     '20'=>'<address>
                           <streetname="xxxx"/>
                            <housenum="110"/">
                           </address>'
                         }
         'pav.xml'={ 
                   '26'=>'<address>
                           <streetname="xxxx"/>
                            <housenum="138"/">
                           </address>'
                     '27'=>'<address>
                           <streetname="xxxx"/>
                            <housenum="110"/">
                           </address>'
                         }
                         .
                         .
                         .
                 }

because I have xml files in different folders so I searched and extracted some information from all xml files and stored in hash. now I need to convert this data into pdf. I decided to convert into pdf by using latex. so first I need to convert from xml to latex template by using perl and I will run it on latex compiler.how to convert my resultant xml to template.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Perl script for extract data from xml files

Hi All, Prepare a perl script for extracting data from xml file. The xml data look like as AC StartTime="1227858839" ID="88" ETime="1227858837" DSTFlag="false" Type="2" Duration="303" /> <AS StartTime="1227858849" SigPairs="119 40 98 15 100 32 128 18 131 23 70 39 123 20 120 27 100 17 136 12... (3 Replies)
Discussion started by: allways4u21
3 Replies

2. Shell Programming and Scripting

Extract xml data

Hi all, I have the following xml file : <xmlhead><xmlelement1>element1value</xmlelement1>\0a<xmlelement2>jjasd</xmlelement2>...</xmlhead> As you can see there are no lines or spaces seperating the elements, just the character \0a. How can i find and print the values of a specific element?... (1 Reply)
Discussion started by: nthed
1 Replies

3. Shell Programming and Scripting

XML data extract

Hi all, I have the following xml document : <HEADER><El1>asdf</El1> <El2>3</El2> <El3>asad</El3> <El4>asasdf</El4> <El5>asdf</El5> <El6>asdf</El6> <El7>asdf</El7> <El8>A</El8> <El9>0</El9> <El10>75291028141917</El10> <El11>asdf</El11> <El12>sdf</El12> <El13>er</El13> <El14><El15>asdf... (1 Reply)
Discussion started by: nthed
1 Replies

4. Shell Programming and Scripting

Data Extract from XML Log File

Please help me out to extract the Data from the XML Log files. So here is the data ERROR|2010-08-26 00:05:52,958|SERIAL_ID=128279996|ST=2010-08-2600:05:52|DEVICE=113.2.21.12:601|TYPE=TransactionLog... (9 Replies)
Discussion started by: raghunsi
9 Replies

5. Shell Programming and Scripting

extract whole thing in word, leaving behind last word. - perl

Hi, i've a string /u/user/DTE/T_LOGS/20110622_011532_TEST_11_HD_120/HD/TESi T_11_HD_120/hd-12 i need to get string, like /u/user/DTE/T_LOGS/20110622_011532_TEST_11_HD_120/HD the words from HD should get deleted, i need only a string till HD, i dont want to use any built in... (4 Replies)
Discussion started by: asak
4 Replies

6. Programming

extract xml data and create word document using perl.

hi, i have large xml file which contains students information, i need to extract student number and some address tags and create a word document for the extracted data. my data looking llike this <student> <number>24</number> <education>bachelors</education> ... (1 Reply)
Discussion started by: veerubiji
1 Replies

7. Shell Programming and Scripting

Extract part of word from XML

Hi All, Can Someone help me in capturing a word from xml Using sed or awk or any other way in unix. i have file abc.xml like this <?xml version="1.0" encoding="ISO-8859-1" standalone="no" ?> - <NREC xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - <HEADER> <SOURCE>MAIL</SOURCE>... (5 Replies)
Discussion started by: naveenkumarc
5 Replies

8. Shell Programming and Scripting

Extract data from XML file

Hi , I have input file as XML. following are input data #complex.xml <?xml version="1.0" encoding="UTF-8"?> <TEST_doc xmlns="http://www.w3.org/2001/XMLSchema-instance"> <ENTRY uid="123456"> <protein> <name>PROT001</name> <organism>Human</organism> ... (1 Reply)
Discussion started by: mohan sharma
1 Replies

9. Shell Programming and Scripting

Extract Data from XML file.

Hi Guys, I am in a need to extract data from a xml file. The XML file format is as below. <data jsxnamespace="propsbundle" locales=""> <locale> <!--Error messages starts--> <record jsxid="CHARPAIR001" jsxtext=" must be selected"></record> <record... (1 Reply)
Discussion started by: Showdown
1 Replies

10. Shell Programming and Scripting

Extract strings from XML files and create a new XML

Hello everybody, I have a double mission with some XML files, which is pretty challenging for my actual beginner UNIX knowledge. I need to extract some strings from multiple XML files and create a new XML file with the searched strings.. The original XML files contain the source code for... (12 Replies)
Discussion started by: milano.churchil
12 Replies
Xacobeo::Document(3pm)					User Contributed Perl Documentation				    Xacobeo::Document(3pm)

NAME
Xacobeo::Document - An XML document and its related information. SYNOPSIS
use Xacobeo::Document; my $document = Xacobeo::Document->new_from_file('file.xml', 'xml'); my $namespaces = $document->get_namespaces(); # Hashref while (my ($uri, $prefix) = each %{ $namespaces }) { printf "%-5s: %s ", $prefix, $uri; } my $nodes = $document->find('/x:html//x:a[@href]'); foreach my $node ($nodes->get_nodelist) { print "Got node ", $node->name, " "; } $document->validate('/x:html//x:a[@href]') or die "Invalid XPath expression"; DESCRIPTION
This class wraps an XML document with its corresponding meta information (namespaces, XPath context, document node, etc). It inherits from Glib::Object. PROPERTIES
The following properties are defined: source The source of the document. In most cases this will be a path or an URI pointing to the document. type The type of document 'xml' or 'html'. documentNode The document's main node (an instance of XML::LibXML::Node). xpath The XPath conext to be used with the document. namespaces An hashref with the namespaces registered in the document. METHODS
The package defines the following methods: new_from_file Creates a new instance from a file (an URI should also be valid). Parameters: $source: the source of the document, this can be a filename or an URI. $type: the type of document: C<xml> or C<html>. new_from_string Creates a new instance from a string. Parameters: $content: the contents of the document. $type: the type of document: C<xml> or C<html>. empty Returns an empty document. source The source of the document: most likely a file path or an URI. type The type of document: xml or html. namespaces Returns the namespaces declared in the document. The namespaces are returned in a hashref where the URIs are used as a key and the prefix as a value. documentNode Returns the document's node (an instance of XML::LibXML::Document). xpath Returns the XPath context (an instance of XML::LibXML::XPathContext) that includes the namespaces declared in the document. This is the context used to execute all XPath queries. find Runs the given XPath query on the document and returns the results. The results could be a node list or a single value like a boolean, a number or a scalar if an expression is passed. This method always return its values in scalar context. This method croaks if the expression can't be evaluated. Parameters: $xpath: the XPath expression to execute. validate Validates the syntax of the given XPath query. The syntax is validated within a context that has the same namespaces as the ones defined in the current XML document. NOTE: This method can't validate if undefined functions or variables are used. Parameters: $xpath: the XPath expression to validate. get_prefixed_name Returns the node name by prefixing it with our prefixes in the case where namespaces are used. AUTHORS
Emmanuel Rodriguez <potyl@cpan.org>. COPYRIGHT AND LICENSE
Copyright (C) 2008,2009 by Emmanuel Rodriguez. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available. perl v5.14.2 2011-11-16 Xacobeo::Document(3pm)
All times are GMT -4. The time now is 06:54 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy