vendredi 17 juillet 2015

Trying to create testNG.xml using DocumentBuilderFactory

I am trying to create/frame testng.xml file using DocumentBuilderFactory in java. Getting error while creating element namespace, its accepting DOCTYPE only Please someone help me to add below xml element.

header

 DocumentBuilderFactory icFactory = DocumentBuilderFactory.newInstance();
            DocumentBuilder icBuilder;                      
            icBuilder = icFactory.newDocumentBuilder();
            Document doc = icBuilder.newDocument();


            Element mainRootElement = doc.createElementNS("http://ift.tt/19x2mI9", "!DOCTYPE suite SYSTEM");
            doc.appendChild(mainRootElement); 

Error: org.w3c.dom.DOMException: INVALID_CHARACTER_ERR: An invalid or illegal XML character is specified. at org.apache.xerces.dom.CoreDocumentImpl.checkQName(Unknown Source) at org.apache.xerces.dom.ElementNSImpl.setName(Unknown Source) at org.apache.xerces.dom.ElementNSImpl.(Unknown Source) at org.apache.xerces.dom.CoreDocumentImpl.createElementNS(Unknown Source)

Aucun commentaire:

Enregistrer un commentaire