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

Finish initial development of VBA-XML project. #3

Open
wants to merge 13 commits into
base: master
Choose a base branch
from

Conversation

AndrewPullon
Copy link

@AndrewPullon AndrewPullon commented Jul 31, 2021

Hi Tim,

Long time user of VBA-Web and wanted to give back to the project. Here is my implementation of VBA-XML as inspired by your design.md and the coding style used in the VBA_JSON project. I have integrated this version of VBA-XML into VBA-Web (i.e., into the WebHelpers module) and will make a pull request on that project when I have the time.

Notes on this pull request:

  • Inspiration is drawn heavily from VBA-JSON project coding style.
  • I note that this project suffers from speed issues when dealing with XML strings larger than 1,000,000 characters (whereas VBA-JSON handles strings of this size without issue). I've not been able to improve on this performance issue (maybe someone else can?).
  • To try and mitigate some of the speed issues I made two design decisions:
    1. Included support for 'DOMDocument' on Windows machines, as it is significantly faster. Included in this decision is a setting 'XmlOptions.ForceVbaXml' which, if set to 'True' will disable the use of 'DOMDocument' on windows machines.
    1. Included the setting 'XmlOptions.IncludeNodeMapping' that by default excludes the node mapping (i.e. parentNode, firstChild, lastChild) usually included in XMLNodes. These can be re-introduced to the data structure by setting this option to 'True'.
  • I've taken the liberty of a design decision to have the 'nodeValue' for each XML node to be converted to the appropriate variable type. Looking at documentation for DOMDocument, 'nodeValue' is usually 'null' or simply the same as the 'text' property. I thought having the text value parsed to a double, boolean, date etc. would be more useful, so did this in the 'xml_ParseValue' method.
  • I didn't implement support for comments in the XML string passed to the 'ParseXml' method. This should probably be done at some point.

…eavily from VBA-JSON project coding style. I note that this project suffers from speed issues when dealing with XML strings greater than 1,000,000 characters (whereas VBA-JSON handles them fine). I've not been able to improve on this performance issue (maybe someone else can?).
…ibute value. Attribute value containing '=' will now be correctly parsed. (NOTE: Additional updates required to handle encoded/escaped XML chars within attribute value).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants