Skip to content
Advertisement

using simple XML (php to change one attribute)

I have an xml input in the form of a string and I want to look at it and find a particular element and modify it.

The part of the xml input I’m interested in looks like this and is part of the hierarchy of the in the string

JavaScript

the ED element varies so im only interested in identifying all of the com:Cd children where it has a Number Attribute and then changing all but the last three digits of the number attribute to another string.

The project uses Symfony and simple XML php but I’m not sure how to do this as other parts of the xml use the Number key for other data.

Tried the following

JavaScript

Advertisement

Answer

Can you try this:

JavaScript

Result:

JavaScript

Although it seems the <uv:HCRReq xml start tag is missing the> but that might have been a copy paste issue.

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement