MathCAD 13 Document and XMLDocument.Loadxml
MathCAD 13 Document and XMLDocument.Loadxml
(OP)
I'm trying to load a MathCAD 13 document into an xmldocument in Visual Studio 2005
Dim xmlDoc As New Xml.XmlDocument
'Load the xml document
xmlDoc.LoadXml("test1.xmcd")
But I get the follwing error message:
Data at the root level is invalid. Line 1, position 1.
The first lines of the xml document are:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?validation-md5-digest a38d3955c9cd5d0521007998f5a2d587?>
<worksheet version="2.0.2" xmlns="http://schemas.mathsoft.com/worksheet20" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ws="http://schemas.mathsoft.com/worksheet20" xmlns:ml="http://schemas.mathsoft.com/math20" xmlns:u="http://schemas.mathsoft.com/units10" xmlns:p="http://schemas.mathsoft.com/provenance10">
When I just use
I struggle to use
I don't know if it's related but I seem to think so.
Any ideas?
CODE
Dim xmlDoc As New Xml.XmlDocument
'Load the xml document
xmlDoc.LoadXml("test1.xmcd")
But I get the follwing error message:
Data at the root level is invalid. Line 1, position 1.
The first lines of the xml document are:
CODE
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?validation-md5-digest a38d3955c9cd5d0521007998f5a2d587?>
<worksheet version="2.0.2" xmlns="http://schemas.mathsoft.com/worksheet20" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ws="http://schemas.mathsoft.com/worksheet20" xmlns:ml="http://schemas.mathsoft.com/math20" xmlns:u="http://schemas.mathsoft.com/units10" xmlns:p="http://schemas.mathsoft.com/provenance10">
When I just use
CODE
xmlDoc.Load("test1.xmcd")
I struggle to use
CODE
xmldoc.SelectNodes("worksheet")
I don't know if it's related but I seem to think so.
Any ideas?





RE: MathCAD 13 Document and XMLDocument.Loadxml
I know where I've made one mistake, I should have used
CODE
and not
CODE
The LoadXML method is looking for xml text.
I still need help on the select nodes method though
RE: MathCAD 13 Document and XMLDocument.Loadxml
CODE
Dim nsmgr As Xml.XmlNamespaceManager = New Xml.XmlNamespaceManager(xmlDoc.NameTable)
nsmgr.AddNamespace("ws", "http://schemas.mathsoft.com/worksheet20")
nsmgr.AddNamespace("", "http://schemas.mathsoft.com/worksheet20")
nsmgr.AddNamespace("ml", "http://schemas.mathsoft.com/math20")
nsmgr.AddNamespace("u", "http://schemas.mathsoft.com/units10")
nsmgr.AddNamespace("p", "http://schemas.mathsoft.com/provenance10")
Dim wkNode As Xml.XmlNode
For Each wkNode In xmlDoc.SelectNodes("ws:worksheet", nsmgr)
'... Code here ...
Next