Page 1 of 1

problem with jsp page

Posted: Wed Nov 10, 2004 4:35 pm
by bmatichuk
http://209.82.100.37:8080/voicestockagent/lesson5.jsp



when I try to validate this I get an error



VoiceXML Validator:

File: http://209.82.100.37:8080/voicestockagent/lesson5.jsp


Validation Results:

Fatal Error at line 1, char 7
Message: The XML or Text declaration must start at line/column 1/1
scanFirst() failed



I have tried this page on several sites and I know it works.

The full file is included below:

<%@ page language="java" %>
<?xml version="1.0"?>
<vxml version="2.0">
<meta name="maintainer" content="bmatichuk@celcorp.com"/>
<property name="LOGLEVEL" value="2"/>

<form id="actions">
<field name="choice">
<prompt>
Please choose from the following:
To buy stocks, please say buy.
To sell stocks, please say sell.
To check pending transactions, please say pending.
To check holding stocks, please say holding.
To check transaction history, please say history.
To find a stock quote, please say quote.
To check your status, please say status.

</prompt>
<grammar>
buy | sell | pending | holding | history | quote | status
</grammar>
<noinput>
I didn't hear you.
<reprompt/>
</noinput>
<nomatch>
I didn't quite understand you.
<reprompt/>
</nomatch>
<filled>
<if cond="choice=='buy'">
OK let's buy stock.
<elseif cond="choice=='sell'"/>
OK let's sell stock.
<elseif cond="choice=='pending'"/>
OK let's check your pending transactions.
<elseif cond="choice=='holding'"/>
OK let's check your holdings.
<elseif cond="choice=='history'"/>
OK let's check your transaction history.
<elseif cond="choice=='quote'"/>
OK let's find a stock quote.
<goto next="#quote"/>
<elseif cond="choice=='status'"/>
OK let's check your status.
</if>
</filled>
</field>
</form>

<form id = "quote">
<field name = "symbol">
<prompt>
Please spell the stock's symbol, letter by letter.
</prompt>
<grammar src="http://209.82.100.37:8080/voicestockage ... osr3.grxml"/>
<noinput>
I didn't hear you.
<reprompt/>
</noinput>
<nomatch>
I didn't quite understand you.
<reprompt/>
</nomatch>
<filled>
You want to know the quote for <value expr="symbol"/>.
<submit next="http://209.82.100.37:8080/voicestockage ... ucceed.jsp" namelist ="symbol"/>
</filled>
</field>
</form>

</vxml>

IVR error due to newline at beginning of document

Posted: Wed Nov 10, 2004 5:15 pm
by support
The IVR error message indicates that there is a newline at the beginning of the document. I have confirmed this using both a command-line tool (wget) as well as my web browser (Mozilla Firefox). You can not have any whitespace prior to:

Code: Select all

<?xml version="1.0"?>
The white space is appearing in the returned VoiceXML document after it has been preprocessed by your JSP engine.


Hope The Helps!

The Plum Support Staff

Posted: Wed Nov 10, 2004 5:25 pm
by bmatichuk
Thanks for the help. I figured out the problem. I had to change the first line

This is what I had:

<%@ page language="java" %>
<?xml version="1.0"?>


This is what I changed it to:

<%@ page language="java" %><?xml version="1.0"?>


I think your XML parser should strip white space. Most pre-processors handle this as far as I can tell.