cancel
Showing results for 
Search instead for 
Did you mean: 

Through DOM how to frame namespace of any element

Former Member
0 Kudos

Hi

I am using javamapping and tried to create target document by using Document class method "createElementNS". However, I failed to create the same. Can any one assist me in creation of Namespace for a xml. it's gr8 in case u provide any reference/link .

Thanks

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi yadgiri

you may follow these links

This contain a good example of how t ocreate namespace

http://www.xml.com/pub/a/2003/03/10/python.html

http://www.w3.org/TR/2002/WD-DOM-Level-3-Core-20020409/core.html#Namespaces-Considerations

hope this may help you

Regards

Sandeep Sharma

PS: reward points if helpful

Former Member
0 Kudos

Hello,

Check this link ...But this is using XSLT Concepts

http://www.w3schools.com/dom/met_document_createelementns.asp

GabrielSagaya
Active Contributor
0 Kudos

DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();

DocumentBuilder db = dbf.newDocumentBuilder();

Document soapDoc = db.newDocument();

Element soapEnv = soapDoc.createElementNS("http://www.w3.org/2001/12/soap-envelope","Envelope");

Element soapHeader = soapDoc.createElementNS("http://www.w3.org/2001/12/soap-envelope","Header");

soapEnv.appendChild(soapHeader);

Element soapBody = soapDoc.createElementNS("http://www.w3.org/2001/12/soap-envelope","Body");

soapEnv.appendChild(soapBody);

Element hotelBookingResponse = soapDoc.createElementNS(

"http://www.MyHotel.com/partnerservice/",

"GetSpecialDiscountedBookingForPartnersResponse");

hotelBookingResponse.appendChild(

soapDoc.createElementNS(

"http://www.MyHotel.com/partnerservice/",

"BookingDetails"));

soapBody.appendChild(hotelBookingResponse);

soapDoc.appendChild(soapEnv);

http://webservices.xml.com/2003/11/25/examples/Listing1.html