Giter VIP home page Giter VIP logo

jsxml's Issues

Delete child

Hi, how I can delete or remove a child node from xml?

Remove function is not removing index of attribute

remove: function() {
  if (!this._parent) {
    return;
  }
  var nk = this._nodeKind;
  var list;
  if (nk === NodeKind.ATTRIBUTE) {
    list = this._parent._attributes;
  } else {
    list = this._parent._children;
  }
  var index = list.indexOf(this);
  if (index !== -1) {
    list.splice(i, 1)
  }
}

Function is calling list.splice(i,1), rather than list.splice(index,1) - causing the incorrect attribute to be removed in some cases.

Fix in PR #9

ignoreWhitespace might duplicate line breaks

I think this setting creates xml content with additionnal line break.

Given :

<root>
  <property>value</property>
</root>

when i ask for toString, then the content is :

<root>

  <property>value</property>

</root>

instead of the same string.

Here is the spec:

var expect = require('chai').expect;
var XML = require('node-jsxml').XML;

describe('jsxml', function () {

    it('can display original content', function () {
        var originalContent =
            '<root>\n' +
            '  <property>value</property>\n' +
            '</root>';
        XML.setSettings({ignoreWhitespace: false});
        var xml = new XML(originalContent);

        var content = xml.toString();

        expect(content).to.be.equal(originalContent);
    });
});

possibility to add prefix to all nodes?

given the xml:

<definitions id="definitions_9d5c24a2-a605-4b78-85cd-c14c44a0cc69">
  <process id="pid-c236ca2f-e724-458c-b377-ed0f020268ef">
    <startEvent id="startevent1" name="message incoming">
      <outgoing>startevent1-gateway1</outgoing>
    </startEvent>
 </process>
</definitions>

Is there any possibility to add a prefix, e.g. "bpmn", to all nodes so that looks like this?:

<bpmn:definitions id="definitions_9d5c24a2-a605-4b78-85cd-c14c44a0cc69">
  <bpmn:process id="pid-c236ca2f-e724-458c-b377-ed0f020268ef">
    <bpmn:startEvent id="startevent1" name="message incoming">
      <bpmn:outgoing>startevent1-gateway1</bpmn:outgoing>
    </bpmn:startEvent>
 </bpmn:process>
</bpmn:definitions>

Tag with letter with accent is invalid

Hello,
When I try to parse this xml, I have an 'the start tag is invalid' error:

<DataFeed xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><Row TrancheHoraire="0:0" EPEnvoyésCumulés="1"/></DataFeed>

When I remove the 'é', I have no error:

Could you change the regexp startTag to include the letters with accent please?

Thank you so much,
Anne-Laure

start tag with '.' is invalid

Hi,
When I try to parse this xml, I have an 'the start tag is invalid' error:

<DataFeed xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><Row Weekday_vs._weekend="Monday" /></DataFeed>

When I remove the '.', I have no error:

<DataFeed xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><Row Weekday_vs_weekend="Monday" /></DataFeed>

Could you change the regexp startTag to include the '.' please?
Thank you so much,
Anne-Laure

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.