If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Delphi, C etc > Couldn't output CORRECT character for XML entities.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-17-03, 15:01
srivalli9 srivalli9 is offline
Registered User
 
Join Date: Oct 2003
Posts: 32
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(”) 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.
Reply With Quote
  #2 (permalink)  
Old 12-17-03, 15:02
srivalli9 srivalli9 is offline
Registered User
 
Join Date: Oct 2003
Posts: 32
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

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On