2

I'm trying to validate the following XML but I'm unable to, can you please spot the error?

<!-- menu: its a menu -->
<menu id="Welcome">
    <!--audio: file to play -->
    <audio src="D:\Telephony\VOXs\Welcome.vox" />
</menu>

<!-- form: its a menu -->
<menu id="LanguageSelection">
    <audio src="D:\Telephony\VOXs\LanguageSelection.vox" />

    <input timeout="5" max_timeout="2" max_invalid_input="2" valid_dtmfs="1, 2">

        <!-- noinput: if timeout occurred, execute this -->
        <noinput>
            <audio src="D:\Telephony\VOXs\Timeout.vox" />
        </noinput>

        <!-- nomatch: if wrong dtmf given, following will execute -->
        <nomatch>
            <audio src="D:\Telephony\VOXs\InvalidInput.vox" />
        </nomatch>

        <switch>
            <dtmf-1>
                <audio src="D:\Telephony\VOXs\EnglishSelected.vox" />
            </dtmf-1>

            <dtmf-2>
                <audio src="D:\Telephony\VOXs\UrduSelected.vox" />
            </dtmf-2>
        </switch>
    </input>
</menu>

<menu id="MainMenu">
    <audio src="D:\Telephony\VOXs\MainMenu.vox" />

    <input timeout="5" max_timeout="2" max_invalid_input="2" valid_dtmfs="1, 2">

        <!-- noinput: if timeout occurred, execute this -->
        <noinput>
            <audio src="D:\Telephony\VOXs\Timeout.vox" />
        </noinput>

        <!-- nomatch: if wrong dtmf given, following will execute -->
        <nomatch>
            <audio src="D:\Telephony\VOXs\InvalidInput.vox"/>
        </nomatch>

        <switch>
            <dtmf-1>
                <goto menu="InformationMenu" />
            </dtmf-1>

            <dtmf-2>
                <goto menu="SupportMenu" />
            </dtmf-2>
        </switch>
    </input>
</menu>

I get the following error while validating with Validome.org.

Error: The markup in the document following the root element must be well-formed.

Error Position: <menu id="LanguageSelection">

4 Answers 4

2

You have more than one top level element <menu>.

Try the following. I have added <MenuItems> as a top level element and closed it at the end.

<MenuItems>
<!-- menu: its a menu -->
<menu id="Welcome">
    <!--audio: file to play -->
    <audio src="D:\Telephony\VOXs\Welcome.vox" />
</menu>

<!-- form: its a menu -->
<menu id="LanguageSelection">
    <audio src="D:\Telephony\VOXs\LanguageSelection.vox" />

    <input timeout="5" max_timeout="2" max_invalid_input="2" valid_dtmfs="1, 2">

        <!-- noinput: if timeout occurred, execute this -->
        <noinput>
                <audio src="D:\Telephony\VOXs\Timeout.vox" />
        </noinput>

        <!-- nomatch: if wrong dtmf given, following will execute -->
        <nomatch>
                <audio src="D:\Telephony\VOXs\InvalidInput.vox" />
        </nomatch>

        <switch>
                <dtmf-1>
                        <audio src="D:\Telephony\VOXs\EnglishSelected.vox" />
                </dtmf-1>

                <dtmf-2>
                        <audio src="D:\Telephony\VOXs\UrduSelected.vox" />
                </dtmf-2>
        </switch>
    </input>
</menu>

<menu id="MainMenu">
    <audio src="D:\Telephony\VOXs\MainMenu.vox" />

    <input timeout="5" max_timeout="2" max_invalid_input="2" valid_dtmfs="1, 2">

        <!-- noinput: if timeout occurred, execute this -->
        <noinput>
                <audio src="D:\Telephony\VOXs\Timeout.vox" />
        </noinput>

        <!-- nomatch: if wrong dtmf given, following will execute -->
        <nomatch>
                <audio src="D:\Telephony\VOXs\InvalidInput.vox"/>
        </nomatch>

        <switch>
                <dtmf-1>
                        <goto menu="InformationMenu" />
                </dtmf-1>

                <dtmf-2>
                        <goto menu="SupportMenu" />
                </dtmf-2>
        </switch>
    </input>
</menu>
</MenuItems>

You can check ur xml quickly by opening it in ie. When I opened your xml this is what I got.

Only one top level element is allowed in an XML document. Error processing resource 'file://Users/shoban/...

<menu id="LanguageSelection">
-^
Sign up to request clarification or add additional context in comments.

Comments

2

You need a root level element. For example, wrap the menu elements inside of a <menus> tag.

<menus>
    <menu>
    </menu>
    <menu>
    </menu>
</menus>

Comments

1

Well-formedness

SUMMARY:

The XML specification defines an XML document as a text which is well-formed, i.e., it satisfies a list of syntax rules provided in the specification. The list is fairly lengthy; some key points are:

  1. It contains only properly-encoded legal Unicode characters.
  2. None of the special syntax characters such as "<" and "&" appear except when performing their markup-delineation roles.
  3. The begin, end, and empty-element tags which delimit the elements are correctly nested, with none missing and none overlapping.
  4. The element tags are case-sensitive; the beginning and end tags must match exactly.
  5. There is a single "root" element which contains all the other elements.

Comments

1

The root cause of your issue is that your xml document has more than one root element per file.

In your particular case the basic structure of your document was:

<menu></menu>
<menu></menu>
<menu></menu>

That is defining 3 root elements in your document.

In order to define a single element you need to surround the three elements with a single root element as follows:

<menus>
   <menu></menu>
   <menu></menu>
   <menu></menu>
</menus>

You can find out more at this simple tutorial I found.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.