473,402 Members | 2,061 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,402 software developers and data experts.

LoadXml failing because field too long????

Hello,

I'm reusing a method here which sends a query to the database and
returns the results formatted as XML.

In the codebehind, I call the method we reuse here (and have
successfully many times before) and then shove the results in LoadXml:

Dim d As New XmlDocument
d.LoadXml(qXML)

Each column in the DB essentially becomes a field in the XML... like
so (this sample is taken directly from the output of MsgBox(qXML)):

<?xml version="1.0" encoding ="UTF-8">
<RESPONSE>
<FEATURES>
<FEATURE>
<ENVELOPE minx="3180000" miny="1430000" maxx=""3180000 maxy
="1430000" />
<FIELDS>
<FIELD name="FID" value="0" />
<FIELD name="#SHAPE#" value="[Geometry]" />
<FIELD name="USGS_ID" value="7103780" />
<FIELD name="DESCRIPTO" value="MONUMENT CREEK" />
<FIELD name="URL"
value="http://waterdata.usgs.gov/co/nwis/uv?
dd_cd=01%2C03%2C04&format=gif&period=7&site_no=071 03780" />
</FIELDS>
</FEATURE>
</FEATURES>
</RESPONSE>

It appears there may be a line break in "FIELD name="URL""... the
value attribute appears on the next line. Does white space matter
here? I ask because the following error is being thrown at runtime:

Server Error in '/Website1' Application.
--------------------------------------------------------------------------------

'=' is an unexpected token. The expected token is ';'. Line 12,
position 88.
Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.

Exception Details: System.Xml.XmlException: '=' is an unexpected
token. The expected token is ';'. Line 12, position 88.

Line 12 is exactly where I noticed the break between FIELD name="URL"
and value="" occurs! The data returned from the database, the url, is
over 80 characters long. Is this too much for an XML value? Or is
there a way to code it so the break and or character limitation can be
accounted for?

Suggestions are greatly appreciated.

Thanks!

Feb 5 '07 #1
1 1615
Adam Sandler wrote:
<?xml version="1.0" encoding ="UTF-8">
<RESPONSE>
<FEATURES>
<FEATURE>
<ENVELOPE minx="3180000" miny="1430000" maxx=""3180000 maxy
="1430000" />
<FIELDS>
<FIELD name="FID" value="0" />
<FIELD name="#SHAPE#" value="[Geometry]" />
<FIELD name="USGS_ID" value="7103780" />
<FIELD name="DESCRIPTO" value="MONUMENT CREEK" />
<FIELD name="URL"
value="http://waterdata.usgs.gov/co/nwis/uv?
dd_cd=01%2C03%2C04&format=gif&period=7&site_no=071 03780" />
^^^^^^^
The problem is the unescaped ampersand, you need to use
&amp; (& a m p ; for web forum readers)
to escape the ampersand. The same for the other two ampersands.
--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
Feb 6 '07 #2

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

Similar topics

6
by: Dave C. | last post by:
Hello, I have created the following trigger: CREATE TRIGGER tr_UDFTest ON UserDefinedFields FOR INSERT, UPDATE AS DECLARE @foobar varchar(100) SELECT @foobar= foobar FROM inserted IF (...
1
by: KathyB | last post by:
I've discovered I need to use LoadXML instead of Load for an xml string versus an xml file. HOWEVER, I get the above message when .net goes to load the string. The string comes from an...
2
by: Eric Zechman via .NET 247 | last post by:
I have a project in which I get xml posted via a hidden form field (data=<xml></xml>). People are entering names like Bill & Sandy Smith. this is coming over as:...
6
by: jmgonet | last post by:
Hello everybody, I'm having troubles loading a Xml string encoded in UTF-8. If I try this code: ------------------------------ XmlDocument doc=new XmlDocument(); String s="<?xml...
2
by: ksedran | last post by:
I am having a "not all variables bound" issue when trying to delete a row from a datagrid. I have a datagrid populated with data from a oracle table as follows: da = New...
2
by: Raoul Watson | last post by:
I have used isNull statement for as long as I have used VB.. Recently I am devugging a program and it is very clear that the "IsNull" function sometimes would return a true even when the value is...
2
by: binder | last post by:
How do I eliminate an extra backslash that is appearing after LoadXML call? This issue is causing an error with Process.Start. I have a string stored in sql: c:\program files\internet...
2
by: GarryJones | last post by:
(I am sorry if this is the wrong group for this posting, I cant find a group on usenet for phpmyadmin, but maybe someone would be nice enough to answer me anyway....) I need to import data into...
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?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
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.