04-09-2011
replace %20 in xml file
Hi,
I'd like to use sed in order to replace %20 and other "special" characters that are represented with % and some number combination in xml file. Typical line looks like this:
/Users/imac1/Music/iTunes/iTunes 20Media/Music/The%20Rolling%20Stones/Forty%20Licks%20%5BDisc%202%5D/2-13%20Keys%20To%20Your%20Love.mp3
Thank you.
Andrej
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
hi every one ,
here is my problem !!
i have to run my script from an account and update the result in a xml file located on a different account. i use existing ssh keys to do it remotely
for example the tags looks like this
<PropertyValueList... (1 Reply)
Discussion started by: kiranreddy1215
1 Replies
2. Shell Programming and Scripting
Hi all,
I have application.xml file with following content
<dependency>
<groupId>fr.orange.portail.ear</groupId>
<artifactId>_AdminServicesEAR</artifactId>
<version>1.0.0-20080521.085352-1</version>
<type>ear</type>
</dependency>
<dependency>
... (4 Replies)
Discussion started by: subin_bala
4 Replies
3. Shell Programming and Scripting
Hello Unix Users,
I am very new to Unix so I am not sure how do I do the following.
I need a script such that when I type the following in the command prompt
> . scriptName.sh wordToBeReplaced DirectoryLocation
will find the word someword located in a somefile.xml in DirectoryLocation... (8 Replies)
Discussion started by: 5211171
8 Replies
4. Shell Programming and Scripting
Hi All,
I have xml file,i am tring to use awk to search pattern as: <Password>x</Password>
and Replace with:
<Password>y</Password>
please any one can help to solve this using awk and awk only. (4 Replies)
Discussion started by: islam2666
4 Replies
5. Shell Programming and Scripting
Hello Unix gurus!
I'm a unix newbie. Can I use sed to replace a keyword in an xml file and convert this keyword with an output of a unix cat command?
for example: <test>keyword</test>
and temp.txt = hello!
I would like to replace "keyword" with the output of "cat temp.txt".
I think... (6 Replies)
Discussion started by: 4dirk1
6 Replies
6. Shell Programming and Scripting
I am not sure how to approach this find/replace using a shell script. Any help or guidance appreciated.
I want to find this:
<objects/>
<thumb>thumb_0001.jpg</thumb>
<preview>preview_0001.jpg</preview>
And replace with something like this:
<objects>... (1 Reply)
Discussion started by: jimraynor
1 Replies
7. Shell Programming and Scripting
Hi,
My requirement is to find a text and replace it with another in a XML file.
I am new to Unix,Please provide some suggestion to achieve.
Find:
<Style ss:ID="ColumnHeader1">
Replace with:
<Style ss:ID="ColumnHeader1">
<Borders>
<Border ss:Position="Bottom"... (4 Replies)
Discussion started by: cnraja
4 Replies
8. Shell Programming and Scripting
Hi i am having XML file with many number of lines,I need to replace between two strings with .txt file using awk.
For ex
<PersonInfoShipTo ------------------------------ />
My requirement is to replace the content between
<PersonInfoShipTo ------------------------------ />
help me.
Thanks... (9 Replies)
Discussion started by: Padmanabhan
9 Replies
9. Red Hat
I have one .xml file. which contains the following line.
<ParamString StringId="PortAddress" StringValue="172.27.166.170" />
<ParamString StringId="PortAddress" StringValue="172.27.166.171" />
<ParamString StringId="PortAddress" StringValue="172.27.166.202" />
<ParamString... (9 Replies)
Discussion started by: Anjan Ganguly
9 Replies
10. Shell Programming and Scripting
Hello,
I have below xml file, I want to find line default-value and replace the string within quotes followed by default-value "moni/Websphere/". Replace moni/Websphere/ with monitor/AMQ/
<monitor>
<name>WebsphereMqMonitor</name>
<type>managed</type>
<argument... (4 Replies)
Discussion started by: prince1987
4 Replies
LEARN ABOUT PHP
simplexml_load_string
SIMPLEXML_LOAD_STRING(3) 1 SIMPLEXML_LOAD_STRING(3)
simplexml_load_string - Interprets a string of XML into an object
SYNOPSIS
SimpleXMLElement simplexml_load_string (string $data, [string $class_name = "SimpleXMLElement"], [int $options], [string $ns = ""],
[bool $is_prefix = false])
DESCRIPTION
Takes a well-formed XML string and returns it as an object.
PARAMETERS
o $data
- A well-formed XML string
o $class_name
- You may use this optional parameter so that simplexml_load_string(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.
Warning
This function may return Boolean FALSE, but may also return a non-Boolean value which evaluates to FALSE. Please read the section on
Booleans for more information. Use the === operator for testing the return value of this function.
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 string
<?php
$string = <<<XML
<?xml version='1.0'?>
<document>
<title>Forty What?</title>
<from>Joe</from>
<to>Jane</to>
<body>
I know that's the answer -- but what's the question?
</body>
</document>
XML;
$xml = simplexml_load_string($string);
print_r($xml);
?>
The above example will output:
SimpleXMLElement Object
(
[title] => Forty What?
[from] => Joe
[to] => Jane
[body] =>
I know that's the answer -- but what's the question?
)
At this point, you can go about using $xml->body and such.
SEE ALSO
simplexml_load_file(3), SimpleXMLElement::__construct, "Dealing with XML errors", libxml_use_internal_errors(3), "Basic SimpleXML usage".
PHP Documentation Group SIMPLEXML_LOAD_STRING(3)