XML Schema newbie

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Hello,

I'm completely new to programming and I have a question regarding xml
schemas in the xmlschemaset.

Bascially, I am reading in a bunch of schema files, adding them to a
schema set, compiling into 1. What I would like to do at this point
is display the compiled schema in a windows form and write the
compiled schema to a file of my designation.

Please help.

Code Below:

private void loadschemaToolStripMenuItem_Click(object sender,
EventArgs e)
{
string[] fileNames = functionOpenFile("XMLSCHEMA");
XmlSchemaSet xmlSchemaSet = new XmlSchemaSet();
XmlUrlResolver xmlresolver = new XmlUrlResolver();
xmlresolver.Credentials =
CredentialCache.DefaultCredentials;
xmlSchemaSet.XmlResolver = xmlresolver;
ArrayList duplicateSchemaList = new ArrayList();
xmlSchemaSet.ValidationEventHandler +=
ValidationErrorHandler;

foreach (string fileName in fileNames)
{

xmlSchemaSet.Add(fileName.ToString(),XmlReader.Create(fileName));
}

ArrayList schemaList = new
ArrayList(xmlSchemaSet.Schemas());

for (int i = 0; i < schemaList.Count; i++)
{
if (((XmlSchema)schemaList[i]).SourceUri ==
string.Empty)
{
duplicateSchemaList.Add((XmlSchema)schemaList[i]);
}
else
{
for (int j = i + 1; j < schemaList.Count; j++)
{
if (((XmlSchema)schemaList[i]).SourceUri ==
((XmlSchema)schemaList[j]).SourceUri)
{

duplicateSchemaList.Add((XmlSchema)schemaList[j]);
}
}
}
}

foreach (XmlSchema schema in duplicateSchemaList)
{
xmlSchemaSet.Remove(schema);
}

xmlSchemaSet.Compile();


}

.



Relevant Pages

  • Inherited DataTable Serialization Problem in WCF
    ... services layer sitting on a server between a web server hosting ASP.NET 2.0 ... message in the error seems to be: "Schema type ... 'Components.DataStructures.EquipmentList' is not found in the XmlSchemaSet." ... contractContext, IWsdlExportExtension ...
    (microsoft.public.dotnet.xml)
  • Inherited DataTable Serialization Problem in WCF
    ... services layer sitting on a server between a web server hosting ASP.NET 2.0 ... message in the error seems to be: "Schema type ... 'Components.DataStructures.EquipmentList' is not found in the XmlSchemaSet." ... contractContext, IWsdlExportExtension ...
    (microsoft.public.dotnet.framework.adonet)
  • XML Schema newbie
    ... Bascially, I am reading in a bunch of schema files, adding them to a ... schema set, compiling into 1. ... is display the compiled schema in a windows form and write the ... XmlSchemaSet xmlSchemaSet = new XmlSchemaSet; ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Proper way to cache objects?
    ... Anything else pins data in memory - which you should only do when the cost of re-retrieving the data is absurd compared to it's size. ... xml validation won't require us to keep re-reading the actual schema file. ... Having a static XmlSchemaSet in my assembly (plus some methods for managing ... the concurrency around adding XmlSchemas to it) is appealing from a code ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Proper way to cache objects?
    ... He might be talking about a specific Microsoft certification though...like ... xml validation won't require us to keep re-reading the actual schema file. ... Having a static XmlSchemaSet in my assembly (plus some methods for managing ... the concurrency around adding XmlSchemas to it) is appealing from a code ...
    (microsoft.public.dotnet.framework.aspnet)