Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2003

    Unanswered: Couldn't output CORRECT character for XML entities.


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

    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


    Set objNodes = objXMLDOM.selectNodes("/book")
    For Each objBookNode In objNodes
    'go to all chapters nodes
    For Each child In objBookNode.childNodes
    If ch.nodeName = "title" then
    'insert t in the field "title" of the chapter table
    End If
    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!


  2. #2
    Join Date
    Oct 2003
    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?



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts