0

I am getting below error pls help "parse error:

Error on line 1 of document  : 
The markup in the document preceding the root element must be well-formed. 
Nested exception: The markup in the document preceding the root element must be well-formed.

XML is below

<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<'env:Envelope' xmlns>:env=\"http://www.w3.org/2003/05/soap-envelope\" xmlns:ns1=\"urn:zimbraAdmin\">    
xmlns:ns2=\"urn:zimbraAdmin\"><env:Header><ns2:context/></env:Header><env:Body>    
<ModifyAccountRequest xmlns=\"urn:zimbraAdmin\"><id>4d41ec71-d898-42b8-b522-3c3cdc5583a0</id>
<a n=\"zimbraIsAdminAccount\">TRUE</a>
</ModifyAccountRequest></env:Body></env:Envelope>
Darshan Lila
  • 5,772
  • 2
  • 24
  • 34
  • That doesn't look even slightly valid to me. Why are there backslashes in it? Why is the element name quoted? If you try to parse XML which isn't valid, you should expect it not to parse correctly... – Jon Skeet Aug 02 '14 at 11:37
  • ya still getting the same error – user3901955 Aug 02 '14 at 11:39
  • i am new to xml ..could you pls edit and send the xml – user3901955 Aug 02 '14 at 11:39
  • No - you should read up on XML. If I just add the corrected XML, that will give very little benefit. Where did this XML come from? Did you copy and paste it from somewhere? – Jon Skeet Aug 02 '14 at 11:42
  • :D this is one time testing in VM machine..ya i copied from some source – user3901955 Aug 02 '14 at 11:43
  • anyone pls help me to correct that xml..?? – user3901955 Aug 02 '14 at 11:48
  • 2
    Well it looks to me like you copied it from a debug window which was showing escaped output. Don't do that. Please put more details into your question, and we can help you obtain the correct XML. Again, just correcting it ourselves won't help you in the long run. – Jon Skeet Aug 02 '14 at 11:50

1 Answers1

1

That was terribly malformed. Issues are highlighted below:

1. Every instance of \" should be replaced with a simple " as the slash indicates a literal character to Java and is not needed in normal XML.

2. There should be no single quotes around <'env:Envelope' and I honestly have no idea where they came from.

3. The closing carat at xmlns>:env= should be removed, as should the one at the end of the physical line xmlns:ns1=\"urn:zimbraAdmin\">. Removing that carat brings the next namespace statement (which seems unnecessarily identical to ns1) into the envelope tag.

I have no idea what caused the envelope to become so malformed, but you should read up on the purpose of the values and variables you were setting with the xmlns and namespace references so next time you at least uderstand what all the parts of the XML request do. This will help you troubleshoot your own documents in the future.

In the meantime, since you seem to be at a total loss, here is the XML with the errors above corrected.

<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:ns1="urn:zimbraAdmin" xmlns:ns2="urn:zimbraAdmin">
<env:Header>
    <ns2:context/>
</env:Header>
<env:Body>
    <ModifyAccountRequest xmlns="urn:zimbraAdmin">
        <id>4d41ec71-d898-42b8-b522-3c3cdc5583a0</id>
        <a n="zimbraIsAdminAccount">TRUE</a>
    </ModifyAccountRequest>
</env:Body>
</env:Envelope>
roflplanes
  • 73
  • 6