--- Sibon Barman <[EMAIL PROTECTED]> ha scritto: > I am
having problem in validating a xml document
> with xml schema using
> xerces 1.3.0:
>
> Here is the xml document:
> <ui-look-and-feel
>
xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance"
>
> xsi:noNamespaceSchemaLocation="uilfparam.xsd">
> <default-font>
> <font name="SansSerif" style="plain" size="12"/>
> </default-font>
>
> <default-title-font>
> <font name="Dialog" style="bold" size="12" />
> </default-title-font>
>
> </ui-look-and-feel>
>
> Here is the xml schema:
> <?xml version="1.0"?>
> <schema xmlns="http://www.w3.org/2000/10/XMLSchema">
> <element name="ui-look-and-feel"
> type="RootElemType" />
>
> <complexType name="FontType" content="empty">
> <attribute name="name" type="string" minOccurs="1"
> />
> <attribute name="style" minOccurs="1">
> <simpleType base="string">
> <enumeration value="plain" />
> <enumeration value="bold" />
> <enumeration value="italic" />
> </simpleType>
> </attribute>
> <attribute name="size"
> type="positiveInteger" minOccurs="1" />
> </complexType>
>
> <complexType name="DefaultType">
> <element name="font" type="FontType" />
> </complexType>
>
> <complexType name="UIConstantType">
> <element name="font" type="FontType"
> minOccurs="0"/>
> </complexType>
>
>
> <complexType name="RootElemType">
> <element name="default-font" type="DefaultType"
> minOccurs="0" />
> <element name="default-title-font"
> type="DefaultType" minOccurs="0"
> />
> <element name="ui-constant" type="UIConstantType"
> minOccurs="0"
> maxOccurs="*"/>
> </complexType>
> </schema>
>
> Here is the piece of code that deals with the
> schema:
> //Xerces 1.3
> DOMParser parser = new DOMParser();
> parser.setErrorHandler(new
> UISAXEventHandler());
>
>
parser.setFeature("http://apache.org/xml/features/validation/schema",
> true);
>
>
parser.setFeature("http://xml.org/sax/features/validation",
> true);
>
>
parser.setFeature("http://apache.org/xml/features/dom/defer-node-expansion",
> true);
> parser.parse(filename);
> //JDOM
> DOMBuilder builder = new
> DOMBuilder(ADAPTER_CLASS);
> Document doc =
> builder.build(parser.getDocument());
>
> I get the following error when I run the
> application :
>
> [Error] uilfparam.xml:27:60: Element type
> "ui-look-and-feel" must be
> declared.
>
> I couldn't figure out the problem ---- can anybody
> see where this problem
> could be coming from?
Try :
<complexType name="DefaultType">
-----> <sequence>
<element name="font" type="FontType" />
-----> </sequence>
</complexType>
for all the type definition but the FontType type.
I used SAXParser and works well.
bye.
______________________________________________________________________
Do You Yahoo!?
Il tuo indirizzo gratis e per sempre @yahoo.it su http://mail.yahoo.it
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]