Skip to Content

XML creation with namespace prefix in dom with java.

Assigned Tags

Related questions

2 Answers

  • Best Answer
    Posted on Dec 09, 2015 at 06:24 AM

    Hi Vijay,

    Are you using external definitions?Setting elementFormDefault to "qualified" should do the trick. Same is the case for data types in 7.4.

    Here's a sample:

    Regards,

    Mark


    test.png (12.0 kB)
    test.png (30.7 kB)
    test.png (7.7 kB)
    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Dec 09, 2015 at 06:18 AM

    Hi Vijay

    Did you try using the createElementNS() method of the Document class instead of createElement()?

    Document (Java Platform SE 6)

    You might want to share your code if you require further help.

    Rgds

    Eng Swee

    Add a comment
    10|10000 characters needed characters exceeded

    • Eng Swee Yeoh Vijay Kapuganti Kumar

      I think the usage of the method is incorrect.

      It should be like that

      Element updateMru = doc.createElementNS("urn:enterprise.soap.sforce.com","urn:updateMru");
      

      The first argument is the namespace, the second is the name of the element with a prefix.

      Also try to comment out the setAttribute() calls.

      Try this out and see how your output looks like.

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.