Validating the import XSD file
It is important to regenerate the PolicyCenter XSD files after you
modify the data model. These files are likely to change as you configure the data model.
You generate these XSD files by opening a command prompt in the PolicyCenter installation directory and entering the following command:
gwb genImportAdminDataXsd
You can validate the XML of
your import file against a pc_import.xsd file by using the
following code:
uses java.io.File
uses java.io.FileInputStream
uses javax.xml.validation.SchemaFactory
uses javax.xml.XMLConstants
uses javax.xml.parsers.SAXParserFactory
uses org.xml.sax.helpers.DefaultHandler
uses gw.testharness.TestBase
// Provide the correct directory of the pc_import.xsd
var schemaFile = new File("pc_import.xsd")
TestBase.assertTrue(schemaFile + " Should exists", schemaFile.exists());
var factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
var schema = factory.newSchema(schemaFile)
var spf = SAXParserFactory.newInstance()
spf.setSchema(schema)
spf.Validating = true
spf.NamespaceAware = true
var parser = spf.newSAXParser();
var fis = new FileInputStream("myImportFile.xml")
parser.parse(fis, new DefaultHandler())
