473,399 Members | 3,832 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

Encountering Error: This is an unexpected token. The expected token is 'NAME'.


I have a class that defines a Key/Name value collection that i
generated by and XML Element with multiple attributes. The attribute
are used to create the collection of 'Binate' objects. This is writte
in VB.NET 1.1.

I have this class in a Win32 test application and it works fine. Whe
I put the class in a Web app I get the following error. The assembl
it is in is not directory in the ASP.NET application but in one tha
the ASP.NET application references.

Here is an example of the code that accepts an XML Text Stream t
create the collection of Binate objects.

Public Sub New(ByVal XMLString As String, _
Optional ByVal XMLElement As String = "data")
Dim _xmlDoc As New XmlDocument
Dim _xmlNode As XmlNode
Dim _xmlAttr As XmlAttribute
Dim lp As Integer

Binates = New Collection

If (XMLString Is Nothing) Then
Throw New Exception("XML Stream is not defined")
End If
XMLString = XMLString.Trim()

If (XMLString.Length = 0) Then
Throw New Exception("XML String must contain a vali
XML string")
End If

***************************
*** Error is thrown here
_xmlDoc.InnerXml = XMLString
***************************
_xmlNode = _xmlDoc.SelectSingleNode(XMLElement)

For lp = 0 To _xmlNode.Attributes.Count - 1
_xmlAttr = _xmlNode.Attributes(lp)
Dim _binate As New Binate
_binate.Key = _xmlAttr.Name
_binate.Value = _xmlAttr.Value
Binates.Add(_binate)
_binate = Nothing
Next

End Sub

Where noted the following exception is thrown:
This is an unexpected token. The expected token is 'NAME'. Line 1
position 40.

I only get this when in the Web application and I have moved this clas
to the web assembly, the business assembly and into two seperate tes
programs. It works in the Win32 but not in the Web.

Any ieas

--
SaCompGee

I have been a computer geek for over 20 years. Currently using .NE
Usinging C# and VB and SQLServ
-----------------------------------------------------------------------
SaCompGeek's Profile: http://www.msusenet.com/member.php?userid=292
View this thread: http://www.msusenet.com/t-187089491

Nov 12 '05 #1
2 16256
SaCompGeek wrote:
Where noted the following exception is thrown:
This is an unexpected token. The expected token is 'NAME'. Line 1,
position 40.


Looks like your XML is malformed. Why don't you see what is at position
40 in line 1?

--
Oleg Tkachenko [XML MVP, MCAD]
http://www.xmllab.net
http://blog.tkachenko.com
Nov 12 '05 #2

Oleg, thanks for the reply.

You are correct in that it was malformed but there is no line 40 whic
threw me off. Here is the XML that I thought I was testing:

<?xml version="1.0" encoding="us-ascii"?>
<data isAGoodDay="Yes" badDayTomorrow="Yes" chanceOfRain="70
suggestions="" />

but here is what was really being used:

<?xml version="1.0" encoding="us-ascii"?>
<dat
isAGoodDay="Yes"badDayTomorrow="Yes"chanceOfRain=" 70"suggestions="" />

No spaces betweem the attributes made it barf.
Thanks again, Shaw

--
SaCompGee

I have been a computer geek for over 20 years. Currently using .NE
Usinging C# and VB and SQLServ
-----------------------------------------------------------------------
SaCompGeek's Profile: http://www.msusenet.com/member.php?userid=292
View this thread: http://www.msusenet.com/t-187089491

Nov 12 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Brian Cobb | last post by:
Greetings; I have an application where I am receiving HTML fragments containing snippets (sub-fragments?) of XML. I wish to extract the XML bits for further processing. In the process of...
12
by: Bob Stearns | last post by:
I am trying to create a duplicate prevention trigger: CREATE TRIGGER is3.ard_u_unique BEFORE UPDATE OF act_recov_date ON is3.flushes REFERENCING NEW AS N FOR EACH ROW MODE DB2SQL WHEN...
5
by: cranium.2003 | last post by:
hi, Here is my code #include <iostream.h> int main() { cout <<"HI"; return 0; } and using following command to compile a C++ program g++ ex1.cpp -o ex1
2
by: P | last post by:
Hi all, I'm trying to run the following code taken from http://blogs.ittoolbox.com/database/technology/archives/006045.asp# select substr(tablespace_name,1,30) as "Tablespace Name", case...
8
by: Brian Tkatch | last post by:
Server: DB2/SUN 8.1.6 Client: DB2 Connect Personal Edition (No 11) <URL:ftp://ftp.software.ibm.com/ps/products/db2/fixes2/english-us/db2winIA32v8/fixpak/FP11_WR21365/FP11_WR21365_CONPE.exe> ...
4
by: lisa | last post by:
I have an XML file that starts like this: <?xml version="1.0" encoding="ISO-8859-1" xmlns:fn="http://www.w3.org/2005/xpath-functions"?> <Authors> <Author> <ID>2</ID>...
0
by: Bob Stearns | last post by:
Apparently db2 provides two forms of an error message, one more readable then the other. The readable one is apparently parsed from the other one. When db2 parses the error message shown below, it...
2
by: ddddd | last post by:
CREATE PROCEDURE PART6(IN a FLOAT, IN b FLOAT, OUT retval FLOAT) BEGIN retval = a * b END The above procedure creation statement throws error saying DB21034E The command was processed as...
2
by: kya2 | last post by:
I am not able to create following store procedure. CREATE PROCEDURE DBSAMBA.InsertDeleteBatch(OUT norows INT ) RESULT SETS 1 LANGUAGE SQL BEGIN part1 DECLARE TOTAL_LEFT INT DEFAULT 0; ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.