How can we skip or delete doctype while transforming one xml into another xml

nyfin paul
nyfin paul used Ask the Experts™
on
How can we skip or delete doctype while transforming one xml into another xml

the problem is while i loading xml with vba program that cant able to read xml sheet due to DTD. if i am disable dtd it is working fine. can you help me to understand what changes are required for vba to ignore DTD?

my xml sheet start like <?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE Pip3B12ShippingOrderRequest SYSTEM "3B12_MS_V01_02_ShippingOrderRequest.dtd" PUBLIC "SYSTEM">

My vba program to call source xml and xslt given below, Sub dummy() Call Transform("C:\Users\nypaul\Desktop\XMLTESTING\SOURCE\01_open_file_20180606_093719_1135.xml", "C:\Users\nypaul\Desktop\XMLTESTING\abc.xsl", "C:\Users\nypaul\Desktop\testing\out\01_open_file_180428_045209_10213.xml")

MsgBox "ok"

End Sub

Function Transform(sourceFile, styleSheetFile, resultFile) As Boolean

Dim Source As Object Dim StyleSheet As Object Dim Result As Object

Set Source = CreateObject("MSXML2.DOMDocument") Set StyleSheet = CreateObject("MSXML2.DOMDocument") Set Result = CreateObject("MSXML2.DOMDocument")

On Error GoTo TheEnd

Transform = True

' Load data. Source.async = False Source.Load sourceFile

' Load style sheet. StyleSheet.async = False StyleSheet.Load styleSheetFile

' Do the transformation Source.transformNodeToObject StyleSheet, Result Result.Save resultFile

' Transformation done, exit normally Exit Function TheEnd: ' If an error occured, return False Transform = False

End Function XSLT FORMAT LIKE <?xml version="1.0" encoding="iso-8859-1"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/> <xsl:template match="/"> <ENVELOPE >
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
IT / Software Engineering Consultant
Top Expert 2016
Commented:
Have you tried setting the following, not sure if this might get around the problem you are having or not...

Source.validateOnParse = False


»bp

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial