In xerces-java, it is as simple as:
----------------------------------------------------------------------
dbf.setNamespaceAware(true); dbf.setValidating(true); dbf.setAttribute("http://apache.org/xml/features/validation/schema", Boolean.TRUE); dbf.setAttribute("http://apache.org/xml/properties/dom/document-class-name", "org.apache.xerces.dom.PSVIDocumentImpl");
Document doc = db.parse("person.xml"); Element documentElement = doc.getDocumentElement() ; if (documentElement.isSupported("psvi", "1.0")){ ElementPSVI psviElem = (ElementPSVI)doc.getDocumentElement(); XSModel model = psviElement.getSchemaInformation(); XSElementDeclaration decl = psviElem.getElementDeclaration(); ----------------------------------------------------------------------------------------
And in xerces-c, how can I do this to get an XSModel object(ptr)?
In Xerces 2.6 you have two choices:
1) plug in your PSVIHandler object using setPSVIHandler(), and process the handleElementPSVI/handleAttributesPSVI callbacks
2) call setFeature(XMLUni::fgXercesDOMHasPSVIInfo) on the parser; in the generated DOM tree you can do
DOMPSVITypeInfo* psviType=(DOMPSVITypeInfo*)elem->getInterface(XMLUni::fgXercescInterfacePSVITypeInfo);
if(psviType)
{
PSVIItem::VALIDITY_STATE state=psviType->getNumericProperty(DOMPSVITypeInfo::PSVI_Validity);
bool isNil=(psviType->getNumericProperty(DOMPSVITypeInfo::PSVI_Nil)!=0);
const XMLCh* typeNS=psviType->getStringProperty(DOMPSVITypeInfo::PSVI_Type_Definition_Namespace);
const XMLCh* typeName=psviType->getStringProperty(DOMPSVITypeInfo::PSVI_Type_Definition_Name);
const XMLCh* memberTypeNS=psviType->getStringProperty(DOMPSVITypeInfo::PSVI_Member_Type_Definition_Namespace);
const XMLCh* memberTypeName=psviType->getStringProperty(DOMPSVITypeInfo::PSVI_Member_Type_Definition_Name);
}
Similarly for attributes (minus the isNil property).
Hope this helps,
Alberto
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]