j-users@xerces.apache.org
[Top] [All Lists]

How to find the group information by SAX-Parsing

Subject: How to find the group information by SAX-Parsing
From: "Di Li"
Date: Wed, 14 Mar 2007 13:54:11 +0100
Hi all,

i am now writing my master thesis and have a question about SAX:

I am trying to find the group information (sequence, choice and all) by SAX-Parsing of a xml instance, which has been defined in the XML Schema.

for example, this is the schema:

<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema ">
    <xs:element name="persons">
        <xs:complexType>
            <xs:sequence maxOccurs="unbounded">
                <xs:element name="name" type="xs:string" />
                <xs:element name="birthday" type="xs:date" minOccurs="0"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
</xs:schema>


and this is its instance:

<?xml version="1.0" encoding="UTF-8"?>
<persons>
    <name>Schulz</name>
    <birthday>1970-04-15</birthday>
    <name>Ferner</name>
    <name>Lee</name>
    <birthday>1981-08-15</birthday>
</persons>

i want to find out by sax-parsing, that Schulz and 1970-04-15 are the attributes of the first person, the second person has the name Ferner, and the last two elements are the attributes of the third person.

Is there a standard solution for this problem? Actually the validator of the SAX Parser does have the same problem. By validating of a XML document relating to his schema the sax-based validator must also find the group information. How does it work?

I researched seveval literatures, but didn't find any solutions. They just say, that the SAX Parser has also the possibility to validate a doument and how i can start the validater and how can i handle the validating errors. The internal functionality of the validater is unknown.

I don't want to validate the whole document, but just to find the group information. So i want to know, if there has been already a solution for it? If yes, can anyone tell me, how it works or give me some sources to research?

Thanks in advance!

Best Regards!

Di
<Prev in Thread] Current Thread [Next in Thread>