|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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 — CONSERVATION LAWS</title> <author>Tom Sealy</author> </chapinfo> <chapbody> Colonel Drake μ 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 "μ"> ----------------------------- 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. ************************************* 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. |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > XML Programming > Couldn't output CORRECT character for XML entities. |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|