Hello. I'm new to *ix and am trying to pull a variable or two from an xml document. The document is in the format:
What I need to do is take the value or values from inside the <playlist> tags and assign them to variables. So, for this example, I'd like to be able to set $playlist1 to "Selects Day 5" and $playlist2 to "Dailies Day 5." The values in that xml tag will always be comma separated and there can be any number of them. I used grep to find the playlist lines, but don't know what to do next.
There are many more lines for each item described in the xml and there will be other instances of the <playlist> tag. I'll need to ignore instances of any value already set so, for example, once I've got the values "Selects Day 5" and "Dailies Day 5" from the above example I will need to ignore any further instances of those values until the script is executed again.
Hi Frnds
I Want to pull xml's from logs based on the below condition.In each log having so many xml's it's taking so much of time to search all logs manually...can u please provide solution
USER:ECMINT CONV:GETARPLNICHUBTST
<CardNbr>376703134104004</CardNbr>
</Envelope>
Response XML:... (3 Replies)
Hi I have certain environmenet variables defined in .profile:
export DBNAME="mydb"
export DBHOST="devbox.us.abc.com"
export DBPORT="1111"
export PASSWORD="mypwd"
export MMUSER="myid"
I also have an xml file defined like:
<CONFIG>
<DEFAULTS operator="oraread">
<PROPERTY... (2 Replies)
I'm new to shell scripting and am trying to write a small script that pulls a substring out of a file that has a few lines of text in it. The file will eventually have a lot of text, I just put a few lines in it for testing purposes.
Anyway, this is what I have so far...
#!/bin/ksh
... (4 Replies)
Hi All,
I need to pull the data from a file from 2 set of directories & should be mailed.
I have a code , it is failing for some reason. Do somebody correct me where my script is going wrong.
Directories:
1st Set of Directory /176_PS/Transactions/**/syslog.log
** : prd1
prd2... (2 Replies)
Created a korn shell script, everything is is working except this section, the variable $SYSINFO is being set, but the NASIP & NASDEV are failing, it appears to be treating the config.xml file config directory and xml as the file. Need a second set of eyes to tell me where I am messing up.
#... (3 Replies)
greetings,
i have an executable that reads its config from an xml file. this executable needs to be started as the current user. there is a line in the xml file that contains the following:
<option name="USER_ID" value="myuserid"/>the current value is an actual user id (mine) as it was... (3 Replies)
In the wake of the post: how-parse-following-xml-file
Thank you for the very useful chakrapani response 302355585-post4 !
A close question.
How to pass a file to xmllint in variable?
For example, let it be:
NEARLY_FILE='<?xml version="1.0" encoding="iso-8859-1"?><html><set label="09/07/29"... (0 Replies)
HI All,
I have to split a xml file into multiple xml files and append it in another .xml file. for example below is a sample xml and using shell script i have to split it into three xml files and append all the three xmls in a .xml file. Can some one help plz.
eg:
<?xml version="1.0"?>... (4 Replies)
Hello,
I have the following variables set in my env
echo $MY_XSD_FILE
/home/jak/sample.xsd
echo $MY_INTERVAL_VALUE
4
I want to insert them between the xml tags in my xml file
cat sample.xml
:::::::::::::::
:::::::::::::::
<property name="FILE"></property>
:::::::::::::::::::::::... (2 Replies)
I'm searching for the names of a TV show in the XML file I've attached at the end of this post. What I'm trying to do now is pull out/list the data from each of the <SeriesName> tags throughout the document. Currently, I'm only able to get data the first instance of that XML field using the... (9 Replies)
Discussion started by: hungryd
9 Replies
LEARN ABOUT DEBIAN
xacobeo::document
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)