Hi All,
My requirement is create an unix script to parse the xml file and display the values of the Elements/value between the tags on console. Like say, I would like to fetch the value of errorCode from the below xml which is 'U007' and display it. Can we use SED command for this? I have tried... (10 Replies)
i just wanted to know whether is it possible to open a website link and get a response in the form of xml or html format...
the website is of local network...
for example something like this
wget http://blahblah.samplesite.com/blachblahcblach/User/jsp/ShowPerson.jsp?empid=123456
... (2 Replies)
Hi unix Gurus,
I am really new to Unix Scripting. Please help me to create a shell script which reads the xml file and from that i need to fetch a particular information.
For example
<SOURCE BUSINESSNAME ="" DATABASETYPE ="Teradata" DBDNAME ="DWPROD3" DESCRIPTION ="" NAME... (5 Replies)
Hi Team,
Could you please help me on below query:
I want to retrieve XML elements from one .xml file. This .xml file has commented tags as well. so i am planning to write Unix command/script which 1.will chekc for this .xml file
2. it will ignore the commented XML lines. i.e. XML tags between... (3 Replies)
Hi,
I have an XML file like the following...
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ONDEMAND_JOB VERSION="5.1" LOCALE="en_US">
<IMPORT_JOBSET TC_CONNECTION_NAME="default" ENVIRONMENT="PRD" USERNAME="Administrator" PASSWORD="AdminPassword" CALENDAR="Main Monthly Calendar"... (2 Replies)
Hi All,
I have one query, I managed to run script with user inputs through command line or with 1 file.
But I need to read a txt file/xml file in which user can mention multiple sets of answers and script should run for each set till it reach the EOF.
Thanks in advance
for example, the file... (3 Replies)
Hello All,
I am new to unix scripting. I need to read FROMINSTANCE, FROMFIELD from below XML code and need to write a script for
insert into SQ_EPIC values( "DID", "PROJECT_NAME")
Select DID, PROJECT_NAME from EPIC<CONNECTOR TOINSTANCETYPE="Source Qualifier" TOINSTANCE="SQ_EPIC" TOFIELD="DID"... (7 Replies)
Discussion started by: sekhar.lsb
7 Replies
LEARN ABOUT PHP
simplexml_load_file
SIMPLEXML_LOAD_FILE(3) 1 SIMPLEXML_LOAD_FILE(3)simplexml_load_file - Interprets an XML file into an objectSYNOPSIS
SimpleXMLElement simplexml_load_file (string $filename, [string $class_name = "SimpleXMLElement"], [int $options], [string $ns = ""],
[bool $is_prefix = false])
DESCRIPTION
Convert the well-formed XML document in the given file to an object.
PARAMETERS
o $filename
- Path to the XML file
Note
Libxml 2 unescapes the URI, so if you want to pass e.g. b&c as the URI parameter a, you have to call sim-
plexml_load_file(rawurlencode('http://example.com/?a=' . urlencode('b&c'))). Since PHP 5.1.0 you don't need to do this
because PHP will do it for you.
o $class_name
- You may use this optional parameter so that simplexml_load_file(3) will return an object of the specified class. That class
should extend the SimpleXMLElement class.
o $options
- Since PHP 5.1.0 and Libxml 2.6.0, you may also use the $options parameter to specify additional Libxml parameters.
o $ns
- Namespace prefix or URI.
o $is_prefix
- TRUE if $ns is a prefix, FALSE if it's a URI; defaults to FALSE.
RETURN VALUES
Returns an object of class SimpleXMLElement with properties containing the data held within the XML document, or FALSE on failure.
ERRORS /EXCEPTIONS
Produces an E_WARNING error message for each error found in the XML data.
Tip
Use libxml_use_internal_errors(3) to suppress all XML errors, and libxml_get_errors(3) to iterate over them afterwards.
EXAMPLES
Example #1
Interpret an XML document
<?php
// The file test.xml contains an XML document with a root element
// and at least an element /[root]/title.
if (file_exists('test.xml')) {
$xml = simplexml_load_file('test.xml');
print_r($xml);
} else {
exit('Failed to open test.xml.');
}
?>
This script will display, on success:
SimpleXMLElement Object
(
[title] => Example Title
...
)
At this point, you can go about using $xml->title and any other elements.
SEE ALSO simplexml_load_string(3), SimpleXMLElement::__construct, "Dealing with XML errors", libxml_use_internal_errors(3), "Basic SimpleXML usage".
PHP Documentation Group SIMPLEXML_LOAD_FILE(3)