Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


XML in Access 2003:IXMLDOMNode-Invalid Character in Content Model

From: SHC@-----------.---------.---
To: NULL
Date: 5/3/2005 11:53:00 AM
Hi all, 
I ran the attached volcanoes.xml (with geology.dtd) in the Module of Access 
2003. 
I got the following error:  
                        Microsoft  Office Access 
             You have error Invalid Character in content model. 
                                            |OK| 

Please help and advise me what is wrong in my source code and how to correct 
the problem. 
Thanks in advance, 
SHC 

//////---Module of Access 2003---///// 

Sub getGeologyNodeList() 

' The following Microsoft® Visual Basic® example uses vocanoes.xml 
' to create an IXMLDOMNodeList and display its XML. 
' Supports iteration through the live collection, in addition to 
'  indexed access. 


Dim xmlDoc As New MSXML2.DOMDocument50 
Dim currNode As IXMLDOMNode 

Set xmlDoc = New MSXML2.DOMDocument50 

xmlDoc.async = False 
xmlDoc.Load ("C:\MSXML-msdn\volcanoes.xml") 

If (xmlDoc.parseError.errorCode <> 0) Then 
  Dim myErr 
  Set myErr = xmlDoc.parseError 
  MsgBox ("You have error " & myErr.reason) 
Else 
  Set objNodeList = xmlDoc.getElementsByTagName("volcano") 
  Dim strResult As String 
      strResult = "The node list has " & objNodeList.length & _ 
            " items." & vbCrLf 
  MsgBox ("strResult-how many?: " & strResult) 
  Dim x As Long 
  x = 1 
  For x = 1 To objNodeList.length 
      strResult = strResult & CStr(x) & ": " & objNodeList.Item(x - 1).XML & 
vbCrLf 
  Next 
  MsgBox ("strResult-details:  " & strResult) 
End If 


End Sub 


////---volcanoes.xml---//// 
<?xml version="1.0" ?> 
<!DOCTYPE geology SYSTEM "geology.dtd"> 
<!-- Volcano data --> 
<geology> 
  <volcano name="Erebus"> 
    <location>Ross Island, Antarctica</location> 
    <height value="3794" unit="m"/> 
    <type>stratovolcano</type> 
    <eruption>constant activity</eruption> 
    <magma>basanite to trachyte</magma> 
  </volcano> 
  <volcano name="Hekla"> 
    <location>Iceland</location> 
    <type>stratovolcano</type> 
    <height value="1491" unit="m"/> 
    <eruption>1970</eruption> 
    <eruption>1980</eruption> 
    <eruption>1991</eruption> 
    <magma>calcalkaline</magma> 
    <comment>The type is actually intermediate between crater row 
    and stratovolcano types</comment> 
  </volcano> 
  <volcano name="Mauna Loa"> 
    <location>Hawaii</location> 
    <type>shield</type> 
    <height value="13677" unit="ft"/> 
    <eruption>1984</eruption> 
    <magma>basaltic</magma> 
  </volcano> 
</geology> 

/////---geology.dtd---//// 
<!ELEMENT  geology  (volcano)+> 
<!ELEMENT  volcano  (location, height, type, eruption+, magma, comment?> 
<!ATTLIST  volcano  name  CDATA  #IMPLIED> 
<!ELEMENT  location  (#PCDATA)> 
<!ELEMENT  height  EMPTY> 
<!ATTLIST  height  value  CDATA  #IMPLIED 
                            unit  CDATA  #IMPLIED) 
<!ELEMENT  type  (#PCDATA)> 
<!ELEMENT  eruption  (#PCDATA)> 
<!ELEMENT  magma  (#PCDATA)> 
<!ELEMENT  comment  (#PCDATA)> 

-- 
SHC


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent