You should be able to define the Types and Properties manually if you want
to. I would ask WHY you want to do this as using a schema is a lot simpler!
Could you post your config.xsd and config.xml?
If you add a line
cout << dataFactory << endl;
That should print the Types and Properties you have defined and you can
compare that to the Types/Properties defined by loading the schema.
Cheers,
On 04/06/07, Adriano Crestani <[EMAIL PROTECTED]> wrote:
Is there a way to load data from a XML file without a XML schema file,
only
defining the graph type and properties manually on code?
The code bellow works:
DataFactoryPtr dataFactory = DataFactory::getDataFactory();
XSDHelperPtr xsdh = HelperProvider::getXSDHelper(dataFactory);
xsdh->defineFile("config.xsd");
XMLHelperPtr xmlh = HelperProvider::getXMLHelper(dataFactory);
XMLDocumentPtr doc = xmlh->loadFile("config.xml");
DataObjectPtr root = doc->getRootDataObject();
But when I defining manually the graph struct it does not:
DataFactoryPtr dataFactory = DataFactory::getDataFactory();
dataFactory->addType(DAS_NAMESPACE, "Table");
const Type& table = dataFactory->getType(DAS_NAMESPACE, "Table");
dataFactory->addPropertyToType(table, "tableName", SDO_NAMESPACE,
"String",
false, false, true);
dataFactory->addPropertyToType(table, "typeName", SDO_NAMESPACE, "String",
false, false, true);
dataFactory->resolve();
This method is not intended to be called by a client. I don't think it
should even be on the DataFactory interface.
XMLHelperPtr xmlh = HelperProvider::getXMLHelper(dataFactory);
XMLDocumentPtr doc = xmlh->loadFile("config.xml", DAS_NAMESPACE);
DataObjectPtr root = doc->getRootDataObject(); // the root data object
returned is NULL
Adriano Crestani
Cheers,
--
Pete