Title: How to create a default namespace (without a prefix)?

I am creating following  XML:

<?xml version="1.0" encoding="UTF-8"?>
<GetPurchaseOrder xmlns="http://schemas.gecp.com/app1/v1_0"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://schemas.gecp.com/app1/v1_0  http://devserver.com/app1/XMLSchema/v1_0/GetPurchaseOrder.xsd">

        <POHeaderId>123456</POHeaderId>
        <POLineId>12345453</POLineId>
        <PORevNumber>12345</PORevNumber>
</GetPurchaseOrder>


Could you please let me know how to add default namespace (xmlns="http://schemas.gecp.com/app1/v1_0" ).


I  added other namespace and attribute as follows:

Namespace ns_xsi = DocumentHelper.createNamespace("xsi", "http://www.w3.org/2001/XMLSchema-instance" ) ;

getPOElem.add (ns_xsi) ;
              
QName schemaLocQName= new QName("schemaLocation", ns_xsi) ;
               
getPOElem.addAttribute(schemaLocQName, url_1 + " " + url_2 ) ;


Thanks
Ritesh




Reply via email to