├── .github ├── FUNDING.yml ├── ISSUE_TEMPLATE │ ├── bug_report.md │ └── feature_request.md ├── PULL_REQUEST_TEMPLATE.md └── workflows │ └── build.yml ├── .gitignore ├── .vscode ├── launch.json └── settings.json ├── CHANGELOG.md ├── CODE_OF_CONDUCT.md ├── LICENSE ├── README.md ├── docs ├── .gitignore ├── .vscode │ └── settings.json ├── 404.md ├── Dockerfile ├── Gemfile ├── Gemfile.lock ├── _config.yml ├── _data │ ├── alerts.yml │ ├── definitions.yml │ ├── glossary.yml │ ├── samplelist.yml │ ├── sidebars │ │ └── api_sidebar.yml │ ├── strings.yml │ ├── tags.yml │ ├── terms.yml │ └── topnav.yml ├── _includes │ ├── archive.html │ ├── callout.html │ ├── commento.html │ ├── custom │ │ ├── getting_started_series.html │ │ ├── getting_started_series_next.html │ │ ├── series_acme.html │ │ ├── series_acme_next.html │ │ ├── usermap.html │ │ └── usermapcomplex.html │ ├── feedback.html │ ├── footer.html │ ├── google_analytics.html │ ├── head.html │ ├── head_print.html │ ├── image.html │ ├── important.html │ ├── initialize_shuffle.html │ ├── inline_image.html │ ├── links.html │ ├── note.html │ ├── sidebar.html │ ├── taglogic.html │ ├── tip.html │ ├── toc.html │ ├── topnav.html │ └── warning.html ├── _layouts │ ├── default.html │ ├── default_print.html │ ├── none.html │ ├── page.html │ ├── page_print.html │ └── post.html ├── css │ ├── bootstrap.min.css │ ├── boxshadowproperties.css │ ├── customstyles.css │ ├── font-awesome.min.css │ ├── fonts │ │ ├── FontAwesome.otf │ │ ├── fontawesome-webfont.eot │ │ ├── fontawesome-webfont.svg │ │ ├── fontawesome-webfont.ttf │ │ ├── fontawesome-webfont.woff │ │ └── fontawesome-webfont.woff2 │ ├── modern-business.css │ ├── printstyles.css │ ├── syntax.css │ ├── theme-blue.css │ └── theme-green.css ├── docker-compose.yml ├── feed.xml ├── fonts │ ├── FontAwesome.otf │ ├── fontawesome-webfont.eot │ ├── fontawesome-webfont.svg │ ├── fontawesome-webfont.ttf │ ├── fontawesome-webfont.woff │ ├── glyphicons-halflings-regular.eot │ ├── glyphicons-halflings-regular.svg │ ├── glyphicons-halflings-regular.ttf │ ├── glyphicons-halflings-regular.woff │ └── glyphicons-halflings-regular.woff2 ├── images │ ├── android-chrome-144x144.png │ ├── apple-touch-icon.png │ ├── browserconfig.xml │ ├── favicon-16x16.png │ ├── favicon-32x32.png │ ├── favicon.ico │ ├── mstile-150x150.png │ ├── safari-pinned-tab.svg │ ├── site.webmanifest │ └── social-media-banner.png ├── index.md ├── js │ ├── customscripts.js │ ├── jekyll-search.js │ ├── jquery.ba-throttle-debounce.min.js │ ├── jquery.navgoco.min.js │ ├── jquery.shuffle.min.js │ └── toc.js ├── licenses │ ├── LICENSE │ └── LICENSE-BSD-NAVGOCO.txt ├── pages │ ├── builder-functions-with-callbacks.md │ ├── builder-functions.md │ ├── collection-functions.md │ ├── conversion-functions.md │ ├── custom-parsers.md │ ├── dom-interfaces.md │ ├── namespaces.md │ ├── node-creation-functions-with-callbacks.md │ ├── node-creation-functions.md │ ├── object-conversion.md │ ├── other-functions.md │ ├── parsing.md │ ├── serialization.md │ ├── traversal-functions.md │ ├── upgrading-from-xmlbuilder.md │ └── using-with-external-libraries.md ├── search.json └── sitemap.xml ├── package-lock.json ├── package.json ├── perf ├── index.ts ├── perf-cb.ts ├── perf.list ├── perf.ts └── prof-serialize.js ├── src ├── builder │ ├── BuilderFunctions.ts │ ├── BuilderFunctionsCB.ts │ ├── XMLBuilderCBImpl.ts │ ├── XMLBuilderImpl.ts │ ├── dom.ts │ └── index.ts ├── constants.ts ├── index.ts ├── interfaces.ts ├── readers │ ├── BaseReader.ts │ ├── JSONReader.ts │ ├── ObjectReader.ts │ ├── XMLReader.ts │ ├── YAMLReader.ts │ └── index.ts └── writers │ ├── BaseCBWriter.ts │ ├── BaseWriter.ts │ ├── JSONCBWriter.ts │ ├── JSONWriter.ts │ ├── MapWriter.ts │ ├── ObjectWriter.ts │ ├── XMLCBWriter.ts │ ├── XMLWriter.ts │ ├── YAMLCBWriter.ts │ ├── YAMLWriter.ts │ └── index.ts ├── test ├── TestHelpers.ts ├── basic │ ├── attribute.test.ts │ ├── builder.test.ts │ ├── cdata.test.ts │ ├── collection.test.ts │ ├── comment.test.ts │ ├── convert.test.ts │ ├── create.test.ts │ ├── declaration.test.ts │ ├── doc.test.ts │ ├── doctype.test.ts │ ├── element.test.ts │ ├── end.test.ts │ ├── fragment.test.ts │ ├── import.test.ts │ ├── instruction.test.ts │ ├── namespace.test.ts │ ├── object.test.ts │ ├── options.test.ts │ ├── parse.test.ts │ ├── readme.test.ts │ ├── remove.test.ts │ ├── sanitize.test.ts │ ├── text.test.ts │ ├── toObject.test.ts │ ├── toString.test.ts │ ├── traversal.test.ts │ └── withOptions.test.ts ├── callback │ ├── JSONCBWriter.test.ts │ ├── YAMLCBWriter.test.ts │ ├── async-basic.test.out │ ├── async-many.test.out │ ├── async.test.ts │ ├── basic.test.ts │ ├── dec.test.ts │ ├── dtd.test.ts │ ├── fragment.test.ts │ ├── namespaces.test.ts │ ├── object.test.ts │ ├── options.test.ts │ ├── parse.test.ts │ └── wellformed.test.ts ├── dom │ └── sanitizeInput.test.ts ├── issues │ ├── issue-001.test.ts │ ├── issue-002.test.ts │ ├── issue-006.test.ts │ ├── issue-008.test.ts │ ├── issue-013.test.ts │ ├── issue-015.test.ts │ ├── issue-016.test.ts │ ├── issue-018.test.ts │ ├── issue-020.test.ts │ ├── issue-021.test.ts │ ├── issue-024.test.ts │ ├── issue-025.test.ts │ ├── issue-029.test.ts │ ├── issue-030.test.ts │ ├── issue-031.test.ts │ ├── issue-037.test.ts │ ├── issue-043.test.ts │ ├── issue-044.test.ts │ ├── issue-045.test.ts │ ├── issue-046.test.ts │ ├── issue-048.test.ts │ ├── issue-051.test.ts │ ├── issue-053.test.ts │ ├── issue-056.test.ts │ ├── issue-060.test.ts │ ├── issue-067.test.ts │ ├── issue-078.test.ts │ ├── issue-081.test.ts │ ├── issue-082.test.ts │ ├── issue-088.test.ts │ ├── issue-090.test.ts │ ├── issue-098.test.ts │ ├── issue-099.test.ts │ └── issue-105.test.ts ├── readers │ ├── JSONReader.custom.test.ts │ ├── ObjectReader.custom.test.ts │ ├── XMLReader.custom.test.ts │ ├── XMLReader.test.ts │ └── YAMLReader.test.ts ├── wiki │ ├── custom-parsers.test.ts │ ├── functions-EventEmitter.test.out │ ├── functions-callback.test.ts │ ├── functions-documentCB.test.out │ ├── functions-fragmentCB.test.out │ ├── functions.test.ts │ ├── home.test.ts │ ├── namespace.test.ts │ ├── parsing.test.ts │ ├── serialization.test.ts │ └── upgrading.test.ts ├── writers │ ├── JSONWriter.test.ts │ ├── MapWriter.test.ts │ ├── ObjectWriter.test.ts │ ├── XMLWriter.test.ts │ ├── XMLWriterNS.test.ts │ └── YAMLWriter.test.ts ├── xpath │ ├── namespace.test.ts │ └── simple.test.ts └── xsd │ └── simple.test.ts ├── tsconfig.json └── webpack.config.js /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | open_collective: oozcitak -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: bug 6 | assignees: oozcitak 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | **To Reproduce** 14 | Steps to reproduce the behavior preferably with some sample code. 15 | 16 | **Expected behavior** 17 | A clear and concise description of what you expected to happen. 18 | 19 | **Version:** 20 | - node.js: [x.x.x] 21 | - xmlbuilder2 [x.x.x] 22 | 23 | **Additional context** 24 | Add any other context about the problem here. 25 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: enhancement 6 | assignees: oozcitak 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context about the feature request here. 21 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | Please include a summary of the change and which issue is fixed. Fixes # (issue number) 2 | 3 | **Type of change**: 4 | 5 | - [ ] Bug fix (non-breaking change which fixes an issue) 6 | - [ ] New feature (non-breaking change which adds functionality) 7 | - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) 8 | - [ ] Documentation update 9 | 10 | **Notes (delete after reading)**: 11 | 12 | * Breaking changes sould rarely be necessary. If this change introduces a breaking change, make sure you have a very good reason for it. 13 | * Please make sure this change is thoroughly tested. Add your tests to the `test` folder in a relevant sub folder. If this pull request is a bug fix, add a test specific to the fixed issue in the `test/issues` sub folder. If this change decreases code coverage you may be asked to add additional tests. 14 | -------------------------------------------------------------------------------- /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | # This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node 2 | # For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions 3 | 4 | name: build 5 | 6 | on: 7 | push: 8 | branches: [ master ] 9 | pull_request: 10 | branches: [ master ] 11 | 12 | jobs: 13 | build: 14 | 15 | runs-on: ${{ matrix.os }} 16 | 17 | strategy: 18 | matrix: 19 | os: [ ubuntu-latest, macos-latest, windows-latest ] 20 | node: [ '12', '14', '16' ] 21 | 22 | steps: 23 | - uses: actions/checkout@v2 24 | - name: Setup Node.js ${{ matrix.node }} 25 | uses: actions/setup-node@v2 26 | with: 27 | node-version: ${{ matrix.node }} 28 | - run: npm install 29 | - run: npm test 30 | env: 31 | CI: true 32 | - name: Upload coverage to Codecov 33 | uses: codecov/codecov-action@v2 34 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | lib/ 2 | umd/ 3 | node_modules/ 4 | coverage/ 5 | .vs/ 6 | .nyc_output/ 7 | *.log 8 | _site/ 9 | dist/ -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // Use IntelliSense to learn about possible attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | "version": "0.2.0", 6 | "configurations": [ 7 | { 8 | "type": "node", 9 | "request": "launch", 10 | "name": "Jest Test Current File", 11 | "program": "${workspaceFolder}/node_modules/jest/bin/jest", 12 | "args": ["--verbose", "-i", "--no-cache", "--testPathPattern", "${fileBasename}"], 13 | "internalConsoleOptions": "openOnSessionStart" 14 | } 15 | ] 16 | } -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "cSpell.words": [ 3 | "ecmascript", 4 | "xlink", 5 | "xmlns" 6 | ] 7 | } -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | In the interest of fostering an open and welcoming environment, we as 6 | contributors and maintainers pledge to making participation in our project and 7 | our community a harassment-free experience for everyone, regardless of age, body 8 | size, disability, ethnicity, sex characteristics, gender identity and expression, 9 | level of experience, education, socio-economic status, nationality, personal 10 | appearance, race, religion, or sexual identity and orientation. 11 | 12 | ## Our Standards 13 | 14 | Examples of behavior that contributes to creating a positive environment 15 | include: 16 | 17 | * Using welcoming and inclusive language 18 | * Being respectful of differing viewpoints and experiences 19 | * Gracefully accepting constructive criticism 20 | * Focusing on what is best for the community 21 | * Showing empathy towards other community members 22 | 23 | Examples of unacceptable behavior by participants include: 24 | 25 | * The use of sexualized language or imagery and unwelcome sexual attention or 26 | advances 27 | * Trolling, insulting/derogatory comments, and personal or political attacks 28 | * Public or private harassment 29 | * Publishing others' private information, such as a physical or electronic 30 | address, without explicit permission 31 | * Other conduct which could reasonably be considered inappropriate in a 32 | professional setting 33 | 34 | ## Our Responsibilities 35 | 36 | Project maintainers are responsible for clarifying the standards of acceptable 37 | behavior and are expected to take appropriate and fair corrective action in 38 | response to any instances of unacceptable behavior. 39 | 40 | Project maintainers have the right and responsibility to remove, edit, or 41 | reject comments, commits, code, wiki edits, issues, and other contributions 42 | that are not aligned to this Code of Conduct, or to ban temporarily or 43 | permanently any contributor for other behaviors that they deem inappropriate, 44 | threatening, offensive, or harmful. 45 | 46 | ## Scope 47 | 48 | This Code of Conduct applies both within project spaces and in public spaces 49 | when an individual is representing the project or its community. Examples of 50 | representing a project or community include using an official project e-mail 51 | address, posting via an official social media account, or acting as an appointed 52 | representative at an online or offline event. Representation of a project may be 53 | further defined and clarified by project maintainers. 54 | 55 | ## Enforcement 56 | 57 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 58 | reported by contacting the project team at ozcitak@yahoo.com. All 59 | complaints will be reviewed and investigated and will result in a response that 60 | is deemed necessary and appropriate to the circumstances. The project team is 61 | obligated to maintain confidentiality with regard to the reporter of an incident. 62 | Further details of specific enforcement policies may be posted separately. 63 | 64 | Project maintainers who do not follow or enforce the Code of Conduct in good 65 | faith may face temporary or permanent repercussions as determined by other 66 | members of the project's leadership. 67 | 68 | ## Attribution 69 | 70 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, 71 | available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html 72 | 73 | [homepage]: https://www.contributor-covenant.org 74 | 75 | For answers to common questions about this code of conduct, see 76 | https://www.contributor-covenant.org/faq 77 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Ozgur Ozcitak 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /docs/.gitignore: -------------------------------------------------------------------------------- 1 | _site/ 2 | .sass-cache/ 3 | .jekyll-metadata 4 | _pdf 5 | .DS_Store 6 | .idea 7 | vendor/ 8 | .bundle/ 9 | -------------------------------------------------------------------------------- /docs/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | // Place your settings in this file to overwrite default and user settings. 2 | { 3 | "files.associations": { 4 | "*.html": "liquid" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /docs/404.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Page Not Found" 3 | search: exclude 4 | toc: false 5 | comments: false 6 | --- 7 | 8 | Sorry, but the page you were trying to view does not exist. Try searching for it or looking at the URL to see if it looks correct. 9 | -------------------------------------------------------------------------------- /docs/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM jekyll/builder 2 | 3 | WORKDIR /tmp 4 | ADD Gemfile /tmp/ 5 | ADD Gemfile.lock /tmp/ 6 | RUN bundle install 7 | 8 | FROM jekyll/jekyll 9 | 10 | VOLUME /src 11 | EXPOSE 4000 12 | 13 | WORKDIR /src 14 | ENTRYPOINT ["jekyll", "serve", "--livereload", "-H", "0.0.0.0"] 15 | -------------------------------------------------------------------------------- /docs/Gemfile: -------------------------------------------------------------------------------- 1 | source "https://rubygems.org" 2 | 3 | # to publish on github page 4 | gem 'github-pages', group: :jekyll_plugins 5 | 6 | gem 'wdm', '>= 0.1.0' if Gem.win_platform? -------------------------------------------------------------------------------- /docs/_config.yml: -------------------------------------------------------------------------------- 1 | repository: oozcitak/xmlbuilder2 2 | 3 | output: web 4 | # this property is useful for conditional filtering of content that is separate from the PDF. 5 | 6 | topnav_title: xmlbuilder2 7 | # this appears on the top navigation bar next to the home button 8 | 9 | site_title: xmlbuilder2 10 | # this appears in the html browser tab for the site title (seen mostly by search engines, not users) 11 | 12 | company_name: Your company 13 | # this appears in the footer 14 | 15 | github_editme_path: oozcitak/xmlbuilder2/blob/master/docs/ 16 | # if you're using Github, provide the basepath to the branch you've created for reviews, following the sample here. if not, leave this value blank. 17 | 18 | google_analytics: UA-171882941-1 19 | # if you have google-analytics ID, put it in. if not, edit this value to blank. 20 | 21 | host: 127.0.0.1 22 | # the preview server used. Leave as is. 23 | 24 | port: 4000 25 | # the port where the preview is rendered. You can leave this as is unless you have other Jekyll builds using this same port that might cause conflicts. in that case, use another port such as 4006. 26 | 27 | exclude: 28 | - .idea/ 29 | - .gitignore 30 | - vendor 31 | # these are the files and directories that jekyll will exclude from the build 32 | 33 | # feedback_subject_line: Jekyll documentation theme 34 | 35 | # feedback_email: tomjoht@gmail.com 36 | # used as a contact email for the Feedback link in the top navigation bar 37 | 38 | feedback_disable: true 39 | # if you uncomment the previous line, the Feedback link gets removed 40 | 41 | # feedback_text: "Need help?" 42 | # if you uncomment the previous line, it changes the Feedback text 43 | 44 | # feedback_link: "http://helpy.io/" 45 | # if you uncomment the previous line, it changes where the feedback link points to 46 | 47 | highlighter: rouge 48 | # library used for syntax highlighting 49 | 50 | markdown: kramdown 51 | kramdown: 52 | input: GFM 53 | auto_ids: true 54 | hard_wrap: false 55 | syntax_highlighter: rouge 56 | 57 | # filter used to process markdown. note that kramdown differs from github-flavored markdown in some subtle ways 58 | 59 | collections: 60 | tooltips: 61 | output: false 62 | # collections are declared here. this renders the content in _tooltips and processes it, but doesn't output it as actual files in the output unless you change output to true 63 | 64 | defaults: 65 | - 66 | scope: 67 | path: "" 68 | type: "pages" 69 | values: 70 | layout: "page" 71 | comments: true 72 | # if you don't want to use Commento.io and just hide comments, change true to false wherever you see the comments property 73 | search: true 74 | sidebar: home_sidebar 75 | topnav: topnav 76 | - 77 | scope: 78 | path: "" 79 | type: "tooltips" 80 | values: 81 | layout: "page" 82 | search: true 83 | tooltip: true 84 | 85 | - 86 | scope: 87 | path: "" 88 | type: "posts" 89 | values: 90 | layout: "post" 91 | comments: true 92 | # if you don't want to use Commento.io and just hide comments, change true to false wherever you see the comments property 93 | search: true 94 | sidebar: home_sidebar 95 | topnav: topnav 96 | 97 | # these are defaults used for the frontmatter for these file types 98 | 99 | sidebars: 100 | - api_sidebar 101 | 102 | description: "An XML builder for node.js" 103 | # the description is used in the feed.xml file 104 | 105 | # needed for sitemap.xml file only 106 | # url: http://idratherbewriting.com 107 | # baseurl: /documentation-theme-jekyll 108 | 109 | 110 | github: [metadata] 111 | -------------------------------------------------------------------------------- /docs/_data/alerts.yml: -------------------------------------------------------------------------------- 1 | tip: '