The script following in this thread allows XML data to be located and extracted in a variety of forms from an XML data stream. Using this utility, it is possible to extract all manner of XML subsets and allow data to be post inserted into the "original" XML at any logical point.
The pipe is... (2 Replies)
Hi, I want to get data from Xml file by using sed or awk command. I want to get the following result :
mon titre 1;Createur1;Dossier1
mon titre 1;Createur1;Dossier1
and save it in cvs file (fichier.cvs).
FROM this Xml file (test.xml):
<playlist version="1">
<trackList>
<track>... (1 Reply)
Hello everyone,
Firstly i do not require alot of help.. i am right at the end of finishing my scipt but cannot find a solution to the last part.
What i need to do is, prompt the user for a file to work with, which i have done.
promt the user for an output file - which is done.
#!/bin/bash... (14 Replies)
I have an xml file that generally looks like this:
"<row><dnorpattern>02788920</dnorpattern><description/></row><row><dnorpattern>\+
44146322XXXX</dnorpattern><description/></row><row><dnorpattern>40XXX</dnorpattern><description/></row><row><dnorpattern>11</dn... (4 Replies)
I have below attached xml file , how can I have my desired output as below.
i/p file
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><ns2:executeMDXResponse... (4 Replies)
hi,
please help, i have an xml file, e.g:
...
<tag> test text
asdas="${abc}"
xvxvbs:asdas${222}sdad
asasa="${aa_bb_22}"
</tag>
...
i want to extract all "${...}", e.g:
${abc}
${222}
${aa_bb_22}
thank you. (2 Replies)
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)
I have this XML file format and all in one line:
Fri Dec 23 00:14:52 2016 Logged Message:689|<?xml version="1.0" encoding="UTF-8"?><PORT_RESPONSE><HEADER><ORIGINATOR>XMG</ORIGINATOR><DESTINAT... (16 Replies)
Discussion started by: mrn6430
16 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 objectSYNOPSIS
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)