nyfin paul
asked on
How can we skip or delete doctype while transforming one xml into another xml
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 Pip3B12ShippingOrderReques t SYSTEM "3B12_MS_V01_02_ShippingOr derRequest .dtd" PUBLIC "SYSTEM">
My vba program to call source xml and xslt given below, Sub dummy() Call Transform("C:\Users\nypaul \Desktop\X MLTESTING\ SOURCE\01_ open_file_ 20180606_0 93719_1135 .xml", "C:\Users\nypaul\Desktop\X MLTESTING\ abc.xsl", "C:\Users\nypaul\Desktop\t esting\out \01_open_f ile_180428 _045209_10 213.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.DOMDo cument") Set StyleSheet = CreateObject("MSXML2.DOMDo cument") Set Result = CreateObject("MSXML2.DOMDo cument")
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.transformNodeToObje ct 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 >
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 Pip3B12ShippingOrderReques
My vba program to call source xml and xslt given below, Sub dummy() Call Transform("C:\Users\nypaul
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.DOMDo
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.transformNodeToObje
' 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 >
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.