Re: reading a newline from a properties file [message #178151] |
Tue, 15 May 2012 11:49 |
Jerry Stuckle
Messages: 2598 Registered: September 2010
Karma: 0
|
Senior Member |
|
|
On 5/10/2012 1:56 AM, taltene(at)gmail(dot)com wrote:
> בתאריך יום רביעי, 9 במאי 2012 17:33:43 UTC+3, מאת Jerry Stuckle:
>> On 5/9/2012 7:21 AM, taltene wrote:
>>> Thanks!
>>> I tried to use your code.
>>> But it still no good for me.
>>> This is the input:
>>>
>>> ------------------------------------------------------------
>>>
>>> _resp_chargingIdx=<?xml version="1.0" encoding="UTF-8"?>
>>> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:al="http://www.alcatel-lucent.com/soap_cm" xmlns:gd=" http://www.3gpp.org/ftp/Specs/archive/32_series/32317/schema/32317-700/Gene ricIRPData" xmlns:bs=" http://www.3gpp.org/ftp/Specs/archive/32_series/32607/schema/32607-700/Basi cCMIRPSystem" xmlns:bd=" http://www.3gpp.org/ftp/Specs/archive/32_series/32607/schema/32607-700/Basi cCMIRPData">
>>> .<SOAP-ENV:Body>
>>> ..<bd:createMOResponse>
>>> ...<mO>
>>> ....<moiLocation> imsServiceProfileId=1,suMSubscriptionProfileId=1,suMSubscriberProfileId=+14 716000005_at,subscriptionFunctionId=1,managedElementId=HSS1 </moiLocation>
>>> ...</mO>
>>> ..</bd:createMOResponse>
>>> .</SOAP-ENV:Body>
>>> </SOAP-ENV:Envelope>
>>>
>>> ------------------------------------------------------------
>>> and this is what print_r($pros) retruns:
>>> ------------------------------------------------------------
>>>
>>> [_resp_chargingIdx] => <?xml version=\"1.0\" encoding=\"UTF-8\"?>
>>> [<SOAP-ENV:Envelope xmlns:SOAP-ENV] => \"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:SOAP-ENC=\"http://schemas.xmlsoap.org/soap/encoding/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:al=\"http://www.alcatel-lucent.com/soap_cm\" xmlns:gd=\" http://www.3gpp.org/ftp/Specs/archive/32_series/32317/schema/32317-700/Gene ricIRPData\" xmlns:bs=\" http://www.3gpp.org/ftp/Specs/archive/32_series/32607/schema/32607-700/Basi cCMIRPSystem\" xmlns:bd=\" http://www.3gpp.org/ftp/Specs/archive/32_series/32607/schema/32607-700/Basi cCMIRPData\">
>>> [....<moiLocation>imsServiceProfileId] => 1,suMSubscriptionProfileId=1,suMSubscriberProfileId=+14716000005_at,subscri ptionFunctionId=1,managedElementId=HSS1 </moiLocation>
>>> -------------------------------------
>>>
>>> and of course the only key is _resp_chargingIdx...
>>>
>>> any help will be appreciated.
>>> Thanks!!!
>>>
>>
>> There are a number of problems with your code. For instance, if the key
>> you are looking for is "abc=", it will also match on "xyzabc=". Also it
>> could match a value such as "The expression abc=def is bad".
>>
>> I'm still not sure what you're looking for. I tested your function with
>> the input you listed:
>>
>> print_r(ReadValueByKey('properties.txt', '_resp_chargingIdx'));
>>
>> The results:
>>
>> ReadValueByKey
>> <?xml version="1.0" encoding="UTF-8"?>
>>
>> which is what I would expect from the given code.
>>
>
> Tannk you Jerry.
> The problem is that the property value is not only
> <?xml version="1.0" encoding="UTF-8"?>
> but it is a multiple line value, and this is what I need to get in return for this function.
Sorry for the late reply; your response just showed up on my news server.
OK, my next question would be then, how is the system supposed to know
where one property stops and the next one starts? I know you only have
one in this file, but what if you had two or three (or more)?
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
|
|
|