Question

I have an XML string that validators are saying is invalid. The error occurs on line 2 character 1. The string is all at the same tier. It is about a hundred occurences of <map> and map has various attributes.

<map attribute_1="thomas"></map>
<map attribute_1="thomas again"></map>

That's the entire string. But I'm being told that

Line 1: Can not find declaration of element 'map'.
Line 2: The markup in the document following the root element must be well-formed.

Based on what I read in this answer, I thought that perhaps <map> needs a parent element which shares a name attribute with a child. I copy pasted the structure so I ended up with something like

<element name="details">
    <complexType>
        <sequence>
            <map name="details">
            </map>
        </sequence>
    </complexType>
</element>

It was just a shot in the dark, as my experience with XML is nil. In any case, it didn't work. What's wrong with my markup?

Was it helpful?

Solution

Your XML should be like

<?xml version="1.0" encoding="UTF-8"?>
<maps>
<map attribute_1="thomas"></map>
<map attribute_1="thomas again"></map>
</maps>

try this

OTHER TIPS

It's not clear how you are processing the document at the point you get the error, but you need to make a choice:

(a) if you want to validate the document against a schema, you need to supply a schema.

(b) if you don't want to validate the document against a schema, you need to change the way you are processing it so validation isn't attempted.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top