perfectxml.com
 Basic Search  Advanced Search   
Topics Resources Free Library Software XML News About Us
home » focus » msxml » ask a question » past questions & answers Friday, 12 October 2007
 
NEWS
MSXML 4.0 SP2 now available!

 
MSXML
Basics
DOM
SAX
XPath
XSLT
Schemas
SOM
HTTP Access
.NET
Data Islands
Ask a Question
   Past Q&As
C++ Samples
DLL/Version Info
Reference Guide
Books
KB Articles
   HOW TO
   SAMPLE
   INFO
   BUG/PRB
   FIX
   Misc.
MSXML Tips
   August 2002
   September 2002
MSXML Tools

Microsoft XML Core Services


Go back to list of previously asked questions and answers

Question: I want to create a DOCTYPE element. Any suggestions?
Asked By: Iain
Viewed: 2159
Answer: As far as we know MSXML DOM does not "directly" support creating DOCTYPE declaration statement. It has a node type enumeration (NODE_DOCUMENT_TYPE) - but creating a node of this type does not work.

We believe the options include using SAX to DOM and using LexicalHandler interface OR using the loadXML as outlined below:

Dim ObjXMLDoc As New MSXML2.DOMDocument40
Dim XMLStr As String

XMLStr = "<?xml version='1.0' encoding='UTF-8'?>" & _
    "<!DOCTYPE Books SYSTEM 'Catalog.dtd'>" & _
    "<RootElem />"

ObjXMLDoc.validateOnParse = False
ObjXMLDoc.resolveExternals = False

ObjXMLDoc.loadXML XMLStr
Debug.Print ObjXMLDoc.xml
We tried the above code and the SAX to DOM example using MSXML 4.0 SP1 and it worked fine.

Related KB Articles:
  • FIX: DOCTYPE Subset Omitted in Cloned XML DOM (Q263586)
  • PRB: loadXML Method Fails to Process DTD or Schema with Relative Path at the Server Side (Q254643)
  • INFO: List of Issues Fixed in Microsoft XML 4.0 Service Pack 1 (Part 3 of 4)


Go back to list of previously asked questions and answers
  Contact Us |  | Site Guide | About PerfectXML | Advertise ©2004 perfectxml.com. All rights reserved. | Privacy