Announcement

Collapse
No announcement yet.

XmlSpy code generation in c++: msxml schema validating problems

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • XmlSpy code generation in c++: msxml schema validating problems

    I generated data-binding code with XMLSpy for C++ and MSXML ...

    I would like to validate a generated xml document against it's schema before saving it to disk ...

    <pre>
    CpurchaseOrderDoc doc;
    CPurchaseOrderType root;

    /* document cration code */ ...

    doc.SetRootElementName(_T(""), _T("purchaseOrder"));
    doc.SetSchemaLocation(_T("purchaseOrder.xsd")); // optional

    doc.Validate(root); /* the right way to validate the doc ? */

    doc.Save(_T("purchaseOrder1.xml"), root);
    </pre>

    with this code, I get the exception:
    <pre>
    Error: Validate failed because the root element had no associated DTD/schema.
    </pre>
    this is weird because, the same generated document is validated flawlessly in XMLSpy and Stylus Studio (using MSXML DOM and SAX, tried both)

    What am I missing ?
    Working validation in StylusStudio with MSXML proves, that the document ist valid and that validation can be done using MSXML4 ... so my problem seems to be my source code ...

Working...
X