XML.orgXML.org
FOCUS AREAS |XML-DEV |XML.org DAILY NEWSLINK |REGISTRY |RESOURCES |ABOUT
OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
Need help on parsing XSD files

Hi,

I'm new to XML and need some help on parsing large XSD files which include namespaces and references to other XSD files.
Which parser is best for this purpose, SAX or DOM?

I started with SAX parser but I'm facing some difficulties with it. When I try to parse this:
<xsd:element ref="ndexia:WitnessAugmentation" minOccurs="0"/>

I do not get the data in this element. Since, this element does not have a proper ending tag like: </xsd:element>
will the ' endElement(String uri, String localName, String qName) ' end element method detect the end of element?

How to extract the ref and minOccurs values from the above element?

The xsd that I'm using has several of the following elements:

<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema targetNamespace="http://niem.gov/niem/niem-core/2.0" version="1" xmlns:niem-xsd="http://niem.gov/niem/proxy/xsd/2.0" xmlns:i="http://niem.gov/niem/appinfo/2.0" xmlns:usps="http://niem.gov/niem/usps_states/2.0" xmlns:census="http://niem.gov/niem/census/2.0" xmlns:unece="http://niem.gov/niem/unece_rec20-misc/2.0" xmlns:fips_10-4="http://niem.gov/niem/fips_10-4/2.0" xmlns:fips_6-4="http://niem.gov/niem/fips_6-4/2.0" xmlns:s="http://niem.gov/niem/structures/2.0" xmlns:iso_639-3="http://niem.gov/niem/iso_639-3/2.0" xmlns:iso_4217="http://niem.gov/niem/iso_4217/2.0" xmlns:fbi="http://niem.gov/niem/fbi/2.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:nc="http://niem.gov/niem/niem-core/2.0">
  <xsd:annotation>
    <xsd:documentation>NIEM Core includes both Universal (U) and Common (C) components.  The identities for U and C components in Core are maintained with metadata.</xsd:documentation>
    <xsd:appinfo>
      <i:ConformantIndicator>true</i:ConformantIndicator>
    </xsd:appinfo>
  </xsd:annotation>
  <xsd:import schemaLocation="../../structures/2.0/structures.xsd" namespace="http://niem.gov/niem/structures/2.0"/>
  <xsd:import schemaLocation="../../proxy/xsd/2.0/xsd.xsd" namespace="http://niem.gov/niem/proxy/xsd/2.0"/>
  <xsd:import schemaLocation="../../unece_rec20-misc/2.0/unece_rec20-misc.xsd" namespace="http://niem.gov/niem/unece_rec20-misc/2.0"/>
  <xsd:import schemaLocation="../../usps_states/2.0/usps_states.xsd" namespace="http://niem.gov/niem/usps_states/2.0"/>
  <xsd:complexType name="ActivityType">
    <xsd:annotation>
      <xsd:documentation>A data type for a single or set of related actions, events, or process steps.
</xsd:documentation>
<xsd:complexType name="WitnessType">
        <xsd:annotation>
            <xsd:documentation>A data type for a person who has observed an activity.  Builds upon a LEXS Digest Witness.</xsd:documentation>
            <xsd:appinfo>
                <i:Base i:namespace="http://niem.gov/niem/domains/jxdm/4.0" i:name="WitnessType"/>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:complexContent>
            <xsd:extension base="j:WitnessType">
                <xsd:sequence>
                    <xsd:element ref="ndexia:WitnessAugmentation" minOccurs="0"/>
                </xsd:sequence>
            </xsd:extension>
        </xsd:complexContent>
    </xsd:complexType>
    <!-- ================================================================== -->
    <!-- Entity Elements -->
    <!-- ================================================================== -->
    <!-- These elements are all substitutable for the N-DEx Entity object, so that all high level objects that may appear in a report are grouped together without having to be in a specific order. -->
    <!-- ================================================================== -->
    <xsd:element name="Aircraft" type="ndexia:AircraftType" substitutionGroup="ndexia:Entity" nillable="true">
        <xsd:annotation>
            <xsd:documentation>A mode of transportation capable of flying in the air.</xsd:documentation>
        </xsd:annotation>
    </xsd:element>

Also, do the SAX/DOM parser ignore the comment lines of their own?
Finally, how should I resolve the namespaces and references?


Thanks


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 1993-2007 XML.org. This site is hosted by OASIS