Get_Schema(); tmpstr = DocNamespace; tmpstr +=" "; tmpstr += SchemaName; att = doc->CreateAttribute("xsi:schemaLocation"); att->Value = tmpstr; node->Attributes->Append(att); void Get_Schema() { OpenFileDialog^ openfiledialog = gcnew OpenFileDialog(); openfiledialog->DefaultExt = L"xsd"; if (openfiledialog->ShowDialog() == System::Windows::Forms::DialogResult::OK) { SchemaName = openfiledialog->FileName; SchemaBar->Text = "Schema: " + SchemaName; try { doc->Schemas->Add(DocNamespace,SchemaName); } catch (Exception ^e) { MessageString = "Error adding schema: " + e->Message; MessageBox::Show(MessageString); } } }
if (ArgList->Last == nullptr) { XmlNode ^tmp; XmlAttribute ^att; String ^tmpstr; tmp = ArgDoc->CreateXmlDeclaration("1.0","UTF-8",""); ArgDoc->AppendChild(tmp); tmp = ArgDoc->CreateComment("Test XML created by IE315_Editor"); ArgDoc->AppendChild(tmp); att = ArgDoc->CreateAttribute("xmlns"); att->Value = "http://www.gph.ie/schemas/ics/IE315/v1"; ArgChild->Attributes->Append(att); att = ArgDoc->CreateAttribute("xmlns:xsi"); att->Value = "http://www.w3.org/2001/XMLSchema-instance"; ArgChild->Attributes->Append(att); tmpstr = "http://www.gph.ie/schemas/ics/IE315/v1"; // the namespace DocNamespace = tmpstr; //V1.04 - Add the new namespace to the document nsmgr = gcnew XmlNamespaceManager (ArgDoc->NameTable); nsmgr->AddNamespace(L"xsi","http://www.w3.org/2001/XMLSchema-instance"); namespace_found = true; // if there is no local schema specified, include a default. if (SchemaName == "") { tmpstr += " http://gphost2:38711/xmlreferencesite/customs/ics/IE315-EntrySummaryDeclaration/v1/schema.xsd"; SchemaBar->Text = "Schema: http://gphost2:38711/xmlreferencesite/customs/ics/IE315-EntrySummaryDeclaration/v1/schema.xsd"; SchemaName = "http://gphost2:38711/xmlreferencesite/customs/ics/IE315-EntrySummaryDeclaration/v1/schema.xsd"; // V1.04 Addition of DEBUG_SCHEMA #ifdef DEBUG_SCHEMA MessageString = "NOTE: Using DEBUG Schema!!!"; MessageBox::Show(MessageString); //C:/GPH/Schemas/IE315/v1/schema.xsd tmpstr += " C:/GPH/Schemas/IE315/v1/schema.xsd"; SchemaBar->Text = "Schema: C:/GPH/Schemas/IE315/v1/schema.xsd"; SchemaName = "C:/GPH/Schemas/IE315/v1/schema.xsd"; #endif // V1.04 //XmlSchemaCollection^ xsc = gcnew XmlSchemaCollection; //xsc->Add(DocNamespace, SchemaName); ArgDoc->Schemas->Add(DocNamespace,SchemaName); ArgDoc->Schemas->ValidationEventHandler+=eventHandler; nsmgr->AddNamespace(L"ie", DocNamespace); schema_found = true; }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)