W3C home > Mailing lists > Public > xmlschema-dev@w3.org > January 2003

RE: check element type during schema validation

From: Xia Li <xli@galdosinc.com>
Date: Thu, 9 Jan 2003 15:42:10 -0800
To: "'Lingzhi Zhang'" <lzhang@cse.ogi.edu>, <xmlschema-dev@w3.org>
Message-ID: <001f01c2b838$baf9af00$700aa8c0@XLI>

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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:14:35 GMT