Hi
can any body pls help me :
I have a file Which Content is like following:
p3:s1234:powerfail:/usr/sbin/shutdown -y -i5 -g0 >/dev/msglog 2<>/dev/msglog
ca:3:respawn:/opt/GoldWing/currentPM/local/critagt > /dev/msglog 2<>/dev/msglog
ca:3:respawn:/opt/GoldWing/currentPM/local/startcia.sh... (2 Replies)
Hi,
I need to comment the below lines in a file using sed.These are the few lines of the jsp file that need to be commented.
if(top.location != location){
top.location.href = location.href;
}
Using the below command two lines can be commented:
if(top.location != location){
... (9 Replies)
Hi All,
I am struggling to get my head around the following issue.
I am having to comment out lines between two delimiters by placing an asterix in position 7 but retain all lines in the file and in the same order.
so for example a file containing:
...
...
DELIM1
...
...
DELIM2... (2 Replies)
Hi All,
I know we can comment by using "#" .... I want to know... is there any way to comment a whole big script easily....
In a file i need to comment more than 15 lines ........ and check the script and un comment back.
I am learning VI now so its taking lot of time to comment and un... (4 Replies)
Hi
I'm trying to comment out specific lines from /etc/fstab file, for simplicity I'm trying to use perl one liner but it errors out,
Below is the Perl oneliner I'm using,
perl -wlp -i -e 'BEGIN{$flag=0}if (!/root/) && (!/boot/) && (!/tmpfs/) ) {$flag =1;} elsif (/^$/) {$flag=0} if ($flag)... (2 Replies)
Hi All,
I'm stuck with adding multiple lines(irrespective of line number) to a file before a particular xml tag. Please help me.
<A>testing_Location</A>
<value>LA</value>
<zone>US</zone>
<B>Region</B>
<value>Russia</value>
<zone>Washington</zone>
<C>Country</C>... (0 Replies)
I have an xml file which has following code :
<abc-ref>
<abc-name>abc.efg.hij.klm</abc-name>
</abc-ref>
I want to comment this whole section out and I have written the following script : (where "hij" is unique string in the file)
TEMPFILE=replaceYY.tmp
file=hello.xml
sed -n... (6 Replies)
I want to comment a block of code in xml. Note that the tags will be similar. In the below xml code, I want to block the listener block for com.pkg1.class2. How do i do it ?
Thanks in Advance
<listener>
<listener-class>com.pkg1.class1</listener-class>
</listener>
.........
<listener>... (4 Replies)
Discussion started by: Lakshmikumari
4 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)