XML Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreXML Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old December 17th, 2003, 04:35 PM
srivalli9 srivalli9 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2003
Posts: 48 srivalli9 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 6 m 4 sec
Reputation Power: 6
Couldn't output CORRECT character for XML entities.

Hi,

I have the following XML file
-----------------------------
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE book SYSTEM "book.dtd">
<book>
<chapter>
<chapinfo>
<title>THE EFFECT OF &mdash; CONSERVATION LAWS</title>
<author>Tom Sealy</author>
</chapinfo>
<chapbody>
Colonel Drake &mu; discovered oil in Pennsylvania.
</chapbody>
</chapter>
</book>
-----------------------------

The DTD is...
-----------------------------
<?xml encoding="utf-8"?>

<!ENTITY % Text "(#PCDATA)*">

<!ELEMENT book (chapter*)>
<!ELEMENT chapter (chapinfo,chapbody)>
<!ELEMENT chapinfo (title,author)>
<!ELEMENT chapbody %Text;>

<!ELEMENT title %Text; >
<!ELEMENT author %Text; >

<!ENTITY mdash "—">
<!ENTITY mu "&#x3BC;">
-----------------------------

Now I wrote a VB program that accesses this XML file and updates the Access Database.
Here goes a fragment of it...
------------------------------
Dim objXMLDOM As New MSXML2.DOMDocument
Dim objNodes As IXMLDOMNodeList
Dim objBookNode As IXMLDOMNode
Dim title As IXMLDOMNode
Dim author As IXMLDOMNode
Dim body As IXMLDOMNode

objXMLDOM.Load("book.xml")

Set objNodes = objXMLDOM.selectNodes("/book")
For Each objBookNode In objNodes
'go to all chapters nodes
For Each child In objBookNode.childNodes
ch=child.childNodes(0).childNodes(0)
If ch.nodeName = "title" then
t=ch.nodeTypedValue
'insert t in the field "title" of the chapter table
End If
......
Next
Next
------------------------------
But the problem is that, the entities are not correctly replaced with their character equivalents. Instead, a square symbol(&#148 is inserted in its place.

Can anyone tell me how I could let my program convert these entities into CORRECT character representation?

Any help is grately appreciated!

Thanks a lot!

-Srivalli.


*************************************


In the above post, the entities are correctly replaced(both in the XML file and the DTD) by the characters they represent.

mdash stands for &_#_151_; (without _ )
mu stands for &_#_x3BC_; (without _ )

But my VB program puts them as square symbols, for some unknown reason. Could anyone solve this?

Thanks.

-Srivalli.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreXML Programming > Couldn't output CORRECT character for XML entities.


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
Stay green...Green IT