XStandard knowledge base - Can I parse the XHTML generated by XStandard using an XML parser?

The XHTML WYSIWYG Editor For Desktop & Web Applications

Can I parse the XHTML generated by XStandard using an XML parser?

Yes, markup generated by XStandard is easily parsable by XML technologies like DOM parser and XSLT. Since XStandard is a content editor, the markup it generates is an XML fragment without a root element. So, before you load this markup into an XML parser, you need to add the root element yourself.

Here is a Visual Basic 6 example:

  1. Dim objDoc As MSXML2.DOMDocument40
  2. Set objDoc = New MSXML2.DOMDocument40
  3. objDoc.async = False
  4. objDoc.loadXML "<root>" & XHTMLEditor1.Value & "</root>"
  5. MsgBox objDoc.xml
  6. Set objDoc = Nothing

Here is the same example in C#:

  1. using System.Xml;
  2. ...
  3. XmlDocument doc = new XmlDocument();
  4. XmlNamespaceManager namespaceManager = new XmlNamespaceManager(doc.NameTable);
  5. doc.LoadXml("<root>" + axXHTMLEditor1.Value + "</root>");
  6. MessageBox.Show(doc.InnerXml.ToString());