xerces-c-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ss ak <ssa...@gmail.com>
Subject xsd to XML
Date Tue, 28 Jul 2009 18:37:43 GMT
Hi,

I am new to this API...would like to create an XML from an XSD.
and using SCMPrint as an example...

1.This does not take an element  which is COMPLEX inside...only top element
can be complex....

But i have nested complex elements..any idea how to take care...

2. what parameters to i need to set to create a DOM Tree while parsing this
XSD...
here we are loading Grammar and traversing using namespaces....Is this the
way or can we use API in any means in creating an XML from XSD...

Please help needed and need of the work of my work....

Thanks,,,,,

parser->loadGrammar(xsdFile, Grammar::SchemaGrammarType, true);
XERCES_STD_QUALIFIER cout << "********** Printing out information from
Schema **********" << "\n\n";
bool updatedXSModel;
XSModel *xsModel = grammarPool->getXSModel(updatedXSModel);
if (xsModel)
{
StringList *namespaces = xsModel->getNamespaces();
for (unsigned i = 0; i < namespaces->size(); i++) {
XERCES_STD_QUALIFIER cout << "Processing Namespace: ";
const XMLCh *nameSpace = namespaces->elementAt(i);
if (nameSpace && *nameSpace)
XERCES_STD_QUALIFIER cout << StrX(nameSpace);
XERCES_STD_QUALIFIER cout <<
"\n============================================" << XERCES_STD_QUALIFIER
endl << XERCES_STD_QUALIFIER endl;
processElements(xsModel->getComponentsByNamespace(XSConstants::ELEMENT_DECLARATION,
nameSpace));
processTypeDefinitions(xsModel->getComponentsByNamespace(XSConstants::TYPE_DEFINITION,
nameSpace));
}
}
else
{
XERCES_STD_QUALIFIER cout << "No XSModel to print" << "\n\n";
}

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message