ElGato 0 Posted January 16, 2016 Report Share Posted January 16, 2016 How to edit only opening tag or closing tag of an xml file? Or how to create a valid one.. since java is creating automatic closing tags with the same name and i have <img id="2" src="item1.jpg"> what i get is <img id="2" src="item1.jpg"> bla bla </img id="2" src="item1.jpg"> and the browser expect for a ">" after "<img" doc.createElement("img id=\"2\" src=\"item1.jpg\"" ); Any suggestions will be apreciated Quote Link to post Share on other sites
Ingolme 1,019 Posted January 16, 2016 Report Share Posted January 16, 2016 What you need to do is create the element first, then add attributes. img = doc.createElement("img"); img.setAttribute("id". "2"); img.setAttribute("src", "item1.jpg"); I'm not sure if this is Java or Javascript you're talking about. Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.