472,988 Members | 2,639 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,988 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 16201
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: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
4
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...
3
SueHopson
by: SueHopson | last post by:
Hi All, I'm trying to create a single code (run off a button that calls the Private Sub) for our parts list report that will allow the user to filter by either/both PartVendor and PartType. On...

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.