Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

method created: processXmlContent() which just returns the PHP array … #1

Closed
17 tasks
weierophinney opened this issue Dec 31, 2019 · 3 comments
Closed
17 tasks

Comments

@weierophinney
Copy link
Member

…instead of converting it to JSON plain text. Method fromXml() calls processXmlContent() method, fromXml() still returns the result as plain text

Provide a narrative description of what you are trying to accomplish:

  • Are you fixing a bug?

    • Detail how the bug is invoked currently.
    • Detail the original, incorrect behavior.
    • Detail the new, expected behavior.
    • Base your feature on the master branch, and submit against that branch.
    • Add a regression test that demonstrates the bug, and proves the fix.
    • Add a CHANGELOG.md entry for the fix.
  • Are you creating a new feature?

    • Why is the new feature needed? What purpose does it serve?
    • How will users use the new feature?
    • Base your feature on the develop branch, and submit against that branch.
    • Add only one feature per pull request; split multiple features over multiple pull requests
    • Add tests for the new feature.
    • Add documentation for the new feature.
    • Add a CHANGELOG.md entry for the new feature.
  • Is this related to quality assurance?

  • Is this related to documentation?


Originally posted by @mowses at zendframework/zend-xml2json#11

@weierophinney
Copy link
Member Author

@mowses What problem does it solve? Can you elaborate, please?


Originally posted by @michalbundyra at zendframework/zend-xml2json#11 (comment)

@weierophinney
Copy link
Member Author

@mowses What problem does it solve? Can you elaborate, please?

As a library for parsing XML I wanted to use zend-xml2json as a third party library to convert XML to PHP variable (Array/Object), so I realized that there are not any method that could do that.
The original method fromXml() has been returning the encoded JSON (as string). Well, I may call Json:decode() after fromXml to convert the returned value to array/object again, but it would be waste of resource.

To accomplish this, I just cut some part of the fromXml() code and paste it in the static method processXmlContent() which now returns the resulting array I needed.
In place of code I cut, I just call the processXmlContent which returns the resulting array, then is encoded by Json::encode, returning the same value and having the exact same behavior as before.

Now anyone can use zend-xml2json with the option to retrieve the XML as PHP variable, instead of only as JSON (string).
To use it just call processXmlContent passing the same parameters as you would for fromXml.

Note: I did not removed nor changed any script behavior. The return from fromXml is still the same as before, so I made sure I did not broke applications who are using this method.


Originally posted by @mowses at zendframework/zend-xml2json#11 (comment)

@weierophinney
Copy link
Member Author

This package is considered feature-complete, and is now in security-only maintenance mode, following a decision by the Technical Steering Committee.
If you have a security issue, please follow our security reporting guidelines.
If you wish to take on the role of maintainer, please nominate yourself

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant