Get tag name of xml file

As one tag consists of numbers and changes every time I want to read it, but this code doesn't work and I get an error in the StrMyXml.nodeName file (Invalid ID). Currently my code is like this:

Sub Create_XSD()
   Dim StrMyXml As String, MyMap As XmlMap
   Dim StrMySchema As String
   Dim tempString As String
   StrMyXml = "<Translate>"
   StrMyXml = StrMyXml & "<Alarms>"
   tempString = StrMyXml.nodeName
   StrMyXml = StrMyXml & "<" & tempString & ">"
   StrMyXml = StrMyXml & "<Nummer>tempString</Nummer>"
   StrMyXml = StrMyXml & "<Nummer Diagnosename DE>tempString & Text</Nummer Diagnosename DE>"
   StrMyXml = StrMyXml & "<Nummer Diagnosename EN>tempString & Text</Nummer Diagnosename EN>"
   StrMyXml = StrMyXml & "</" & tempString & ">"
   StrMyXml = StrMyXml & "</Alarms>"
   StrMyXml = StrMyXml & "<Alarms></Alarms>"
   StrMyXml = StrMyXml & "</Translate>"
   ' Turn off async loading.
   Application.DisplayAlerts = False
   ' Add the string to the XmlMaps collection.
   Set MyMap = ThisWorkbook.XmlMaps.Add(StrMyXml)
   Application.DisplayAlerts = True

   ' Create an empty file and output the schema.
   StrMySchema = ThisWorkbook.XmlMaps(1).Schemas(1).XML
   Open "D:\Users\F512\Desktop\MySchema.xsd" For Output As #1
   Print #1, StrMySchema
   Close #1
End Sub

      

Any help is appreciated!

Lorenz

+3


source to share


2 answers


You have StrMyXml size as string:

Dim StrMyXml As String

But then you try:



tempString = StrMyXml.nodeName

It doesn't work because strings don't have this property.

+1


source


You have StrMyXml size as string:

Dim StrMyXml As String

      

But then you try:



tempString = StrMyXml.nodeName

      

It doesn't work because strings don't have this property.

0


source







All Articles