XmlReader

XmlReader

JoAntt
Enthusiast Enthusiast
907 Views
3 Replies
Message 1 of 4

XmlReader

JoAntt
Enthusiast
Enthusiast

Hi

 

can i use XmlReader in ilogic?

i cant get it to work.

 

Imports System.Xml
Imports System.IO

Dim reader As XmlTextReader = New XmlTextReader(pathToXMLfile)
0 Likes
908 Views
3 Replies
Replies (3)
Message 2 of 4

frederic.vandenplas
Collaborator
Collaborator

Hi,

 

Does this work? i don't get any errors, but i did not tested this further

Dim xmlDoc As Object
 xmlDoc = CreateObject("Msxml2.DOMDocument.6.0")
xmlDoc.Load(xmlFileName)
If you think this answer fullfilled your needs, improved your knowledge or leads to a solution,
please feel free to "kudos"
0 Likes
Message 3 of 4

JoAntt
Enthusiast
Enthusiast

No, cant get it to work

0 Likes
Message 4 of 4

MechMachineMan
Advisor
Advisor

Here is a sample of an xml reader that i messed around with a got to a working point:

 

AddReference "System.Linq"
AddReference "System.Xml"
AddReference "System.Xml.Linq"
AddReference "System.Core"

Imports System.Linq
Imports System.Xml
Imports System.Xml.Linq
Imports System.Xml.Schema
 
 Class FunctionalClass
     Shared FeedXML As XDocument
    
    Sub Main()
            FeedXML= XDocument.Load("C:\Users\Owner\Desktop\Test File.xml")
            
            For Each oElement As XElement In FeedXML.Descendants("config")
                MsgBox(oElement)
            Next    

'            For Each oNode As XNode In FeedXML.<config>.Nodes
'                MsgBox(oNode)
'            Next
            
'            For Each oNode As XNode In FeedXML.<config>.Nodes
'                MsgBox(oNode)
'            Next

'            For Each oElement As XElement In FeedXML.<config>.Elements
'                MsgBox(oElement)
'            Next        

'            oNumber = FeedXML.<config>.<store>.<Number>.Value
'            emailbody = FeedXML.<config>.<emailsettings>.<emailbody>.Value
'            MsgBox(String.Format("Number={0}", oNumber) & vbLf & String.Format("emailbody={0}", emailbody))
    End Sub

End Class

 

 

'''''''''''''''''''''''''''''''
SAMPLE XML FILE INFO saved as  "C:\Users\Owner\Desktop\Test File.xml"
'''''''''''''''''''''''''''''''

 

<?xml version="1.0" encoding="UTF-8"?>
<config>

    <store>
          <Number>NumberValue</Number>
    </store>

    <emailsettings>
          <emailbody>EmailBodyValue</emailbody>
    </emailsettings>
</config>

 


--------------------------------------
Did you find this reply helpful ? If so please use the 'Accept as Solution' or 'Like' button below.

Justin K
Inventor 2018.2.3, Build 227 | Excel 2013+ VBA
ERP/CAD Communication | Custom Scripting
Machine Design | Process Optimization


iLogic/Inventor API: Autodesk Online Help | API Shortcut In Google Chrome | iLogic API Documentation
Vb.Net/VBA Programming: MSDN | Stackoverflow | Excel Object Model
Inventor API/VBA/Vb.Net Learning Resources: Forum Thread

Sample Solutions:Debugging in iLogic ( and Batch PDF Export Sample ) | API HasSaveCopyAs Issues |
BOM Export & Column Reorder | Reorient Skewed Part | Add Internal Profile Dogbones |
Run iLogic From VBA | Batch File Renaming| Continuous Pick/Rename Objects

Local Help: %PUBLIC%\Documents\Autodesk\Inventor 2018\Local Help

Ideas: Dockable/Customizable Property Browser | Section Line API/Thread Feature in Assembly/PartsList API Static Cells | Fourth BOM Type
0 Likes