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

create a new variable #68

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

create a new variable #68

wants to merge 2 commits into from

Commits on May 15, 2018

  1. I just use a new variable arrAttrNode,

    when a node is included in arrAttrNode,
    it will display as attribute,not as a node.
    e.x.
    	var x2js = new X2JS();
    	var jsonObj = {
    		div : {
    			id: 'side-nav',
    			ul:{ id: 'nav'},
    		  }
    	};
    
    	x2js.arrAttrNode.push("id");
    	var xmlAsStr = x2js.json2xml_str( jsonObj );
    	console.log(xmlAsStr);
     out:
    <div id="side-nav" ><ul id="nav" ></ul></div>
    dty717 committed May 15, 2018
    Configuration menu
    Copy the full SHA
    1ad30fb View commit details
    Browse the repository at this point in the history
  2. I just use a new variable arrAttrNode,

    when a node is included in arrAttrNode,
    it will display as attribute,not as a node.
    e.x.
    	var x2js = new X2JS();
    	var jsonObj = {
    		div : {
    			id: 'side-nav',
    			ul:{ id: 'nav'},
    		  }
    	};
    
    	x2js.arrAttrNode.push("id");
    	var xmlAsStr = x2js.json2xml_str( jsonObj );
    	console.log(xmlAsStr);
     out:
    <div id="side-nav" ><ul id="nav" ></ul></div>
    dty717 committed May 15, 2018
    Configuration menu
    Copy the full SHA
    80d7698 View commit details
    Browse the repository at this point in the history