RE: check element type during schema validation

Hi,
	Xerces support PSVI. You can use SAX parser to parse XML document, then
catch the startElement event.

	startElement(QName element, XMLAttributes attributes, Augmentations augs)

	The third argument 'augs' contains PSVI.

	here is a simple example
	startElement(QName element, XMLAttributes attributes, Augmentations augs)
throws XNIException {
		ElementPSVI elemPSVI =(ElementPSVI)augs.getItem(Constants.ELEMENT_PSVI);
        	if (elemPSVI != null) {
			XSElementDeclaration xsElementDec = elemPSVI.getElementDeclaration();
			XSTypeDefinition xsTypeDef = xsElementDec.getTypeDefinition();
		}
	}
	There are detailed examples in xerces package (samples/xni directory)
	hope this helps.
	Lisa

-----Original Message-----
From: xmlschema-dev-request@w3.org
[mailto:xmlschema-dev-request@w3.org]On Behalf Of Lingzhi Zhang
Sent: Thursday, January 09, 2003 2:54 PM
To: xmlschema-dev@w3.org
Subject: check element type during schema validation




I am trying to implement an application to check to the type of each
element in xml document using Xerces-J, for example

type movie {
	title
	year
}

then <title> and <year> should have type of movie.

I think this information should be avaible during schema
validation. However, I found that Xerces PSVI doesn't not include it. Does
any body know whether Xerces has support to it?

Stephen

Received on Thursday, 9 January 2003 18:41:38 UTC