Git Product home page Git Product logo

vite-plugin-xml-loader's Introduction

vite-plugin-xml-loader

forthebadge forthebadge

Automatically transform all xml files to json buffer

Install

npm i vite-plugin-xml-loader --save

Usage

In your vite.config.js or vite.config.ts file, do

import { defineConfig } from 'vite'
...
import XMLLoader from 'vite-plugin-xml-loader' 

...
export default defineConfig({
  plugins: [
    ...
    XMLLoader(),
  ]
})

and the plugin should be ready to use.

Testing

This plugin is also testable and there's a test script ready. To test it yourself, you can clone this repository and do

npm test

License

MIT License

vite-plugin-xml-loader's People

Contributors

lorenzoc25 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

vite-plugin-xml-loader's Issues

XML attributes don't make it into JSON

Thanks for making this helpful plugin!!

I'm having the following issue. I have this XML:

<s unit="turn">
         <s unit="move" n="1">
            <act>
               <w mode="core" unit="act">
                  <m name="!addressing">
                     <m name="!interjecting">
                        <m name="!introducing">
                           <m name="#predication">
                              <m name="!factuality_confirmation">
                                 <m name="!ideational_inquiry"/>
                              </m>
                              <w ref=""/>
                              <m name="!directive">
                                 <m name="!contemplative"/>
                                 <m name="!internal_orientation"/>
                              </m>
...

I can load it using your plugin (again, thanks!), but notice that all of the attributes are lost in the process:

"s": {
        "s": [
          {
            "act": {
              "w": {
                "m": {
                  "m": {
                    "m": {
                      "m": {
                        "m": [
                          {
                            "m": ""
                          },
                          {
                            "m": [
                              "",
                              ""
                            ]
                          },
                          "",
                          {
                            "m": ""
...

Any ideas why?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.