Xml schema Vs DTD

Hi,
Can some one please give me a pointer or elaborated detail regarding how using xml schema helps instead of using DTDs and the most popular and efficient tool out there that converts DTDs into XSDs? I know there is some inforamtion about this in W3C documents, anything more consice than the W3C documents will help.
Thanks,

usermolak wrote:
Can some one please give me a pointer or elaborated detail regarding how using xml schema helps instead of using DTDs Check this out:
Oracle® XML DB Developer's Guide - How DTDs and XML Schema Differ
and the most popular and efficient tool out there that converts DTDs into XSDs?
I use Altova XML Spy. This editor is used in many examples in the Oracle Documentation.
Cheers,
Mihajlo

Similar Messages

  • XSU Generated Schemas and DTDs are bad input for oracg

    Hi,
    I'm trying to write a utility that accepts a database schema name and writes XML Schemas and a DTDs for each table based on a:
    select * from table_name
    over each table in the schema. I would then like to use those files as input to the oracg utility to produce java files. There are some problems though. The DTD representation is not meant as a standalone DTD. In other words its of the form:
    <!DOCTYPE NAME [
    ...dtd defs here ...
    ]>
    which oracg doesn't like. Its not a big deal to do some post processing and delete the DOCTYPE defenition, but then oracg barfs with the following error:
    Error: DTD Class Generator failed to generate classes. oracle.xml.parser.v2.XMLParseException: Expected 'DOCTYPE'.
    Here is the DTD I was trying to generate a class from:
    <!ELEMENT STATION (ROW)*>
    <!ELEMENT ROW (STN_THTR_AREA_CODE, STN_ID_CD, STN_NM?, STN_ESTD_DATA?, STN_CTRY_CD?, STN_SW_TYPE_CD?, STN_AGNY_CD?, STN_
    MFR_CD?, STN_CURR_SFTWR?, STN_TIME_ZONE?, STN_LATD?, STN_LNGTD?, STN_NM_VLD_CALLS_1?, STN_NM_VLD_CALLS_2?, STN_NM_VLD_CA
    LLS_3?, STN_NM_VLD_CALLS_4?, STN_NM_CALLS_1?, STN_NM_CALLS_2?, STN_NM_CALLS_3?, STN_NM_CALLS_4?, STN_STDY_ID_1?, STN_STD
    Y_ID_2?, STN_STDY_ID_3?, STN_STDY_ID_4?, STN_CLASS_A_PHONES_ESTD_QTY?, STN_CLASS_B_PHONES_ESTD_QTY?, STN_POC_TTL?, STN_P
    OC_FIRST_NM?, STN_POC_LAST_NM?, STN_POC_OFC_SYM_NM?, STN_POC_APO_PPO?, STN_POC_PSTL_CD?, STN_POC_AUTVN_TLPHN_NBR?, STN_M
    ODIFIED_DT?, STN_TANDEM?, STN_MEMO?, STN_SW_TYPE_DESC?, STN_FREQ?, STN_THTR, STN_STDY_ID, STN_GEOLOC?, STN_SHIFT_FLG, ST
    N_SEQ?, STN_TMPLT_NM?)>
    <!ATTLIST ROW num CDATA #REQUIRED>
    <!ELEMENT STN_THTR_AREA_CODE (#PCDATA)>
    <!ELEMENT STN_ID_CD (#PCDATA)>
    <!ELEMENT STN_NM (#PCDATA)>
    <!ELEMENT STN_ESTD_DATA (#PCDATA)>
    <!ELEMENT STN_CTRY_CD (#PCDATA)>
    <!ELEMENT STN_SW_TYPE_CD (#PCDATA)>
    <!ELEMENT STN_AGNY_CD (#PCDATA)>
    <!ELEMENT STN_MFR_CD (#PCDATA)>
    <!ELEMENT STN_CURR_SFTWR (#PCDATA)>
    <!ELEMENT STN_TIME_ZONE (#PCDATA)>
    <!ELEMENT STN_LATD (#PCDATA)>
    <!ELEMENT STN_LNGTD (#PCDATA)>
    <!ELEMENT STN_NM_VLD_CALLS_1 (#PCDATA)>
    <!ELEMENT STN_NM_VLD_CALLS_2 (#PCDATA)>
    <!ELEMENT STN_NM_VLD_CALLS_3 (#PCDATA)>
    <!ELEMENT STN_NM_VLD_CALLS_4 (#PCDATA)>
    <!ELEMENT STN_NM_CALLS_1 (#PCDATA)>
    <!ELEMENT STN_NM_CALLS_2 (#PCDATA)>
    <!ELEMENT STN_NM_CALLS_3 (#PCDATA)>
    <!ELEMENT STN_NM_CALLS_4 (#PCDATA)>
    <!ELEMENT STN_STDY_ID_1 (#PCDATA)>
    <!ELEMENT STN_STDY_ID_2 (#PCDATA)>
    <!ELEMENT STN_STDY_ID_3 (#PCDATA)>
    <!ELEMENT STN_STDY_ID_4 (#PCDATA)>
    <!ELEMENT STN_CLASS_A_PHONES_ESTD_QTY (#PCDATA)>
    <!ELEMENT STN_CLASS_B_PHONES_ESTD_QTY (#PCDATA)>
    <!ELEMENT STN_POC_TTL (#PCDATA)>
    <!ELEMENT STN_POC_FIRST_NM (#PCDATA)>
    <!ELEMENT STN_POC_LAST_NM (#PCDATA)>
    <!ELEMENT STN_POC_OFC_SYM_NM (#PCDATA)>
    <!ELEMENT STN_POC_APO_PPO (#PCDATA)>
    <!ELEMENT STN_POC_PSTL_CD (#PCDATA)>
    <!ELEMENT STN_POC_AUTVN_TLPHN_NBR (#PCDATA)>
    <!ELEMENT STN_MODIFIED_DT (#PCDATA)>
    <!ELEMENT STN_TANDEM (#PCDATA)>
    <!ELEMENT STN_MEMO (#PCDATA)>
    <!ELEMENT STN_SW_TYPE_DESC (#PCDATA)>
    <!ELEMENT STN_FREQ (#PCDATA)>
    <!ELEMENT STN_THTR (#PCDATA)>
    <!ELEMENT STN_STDY_ID (#PCDATA)>
    <!ELEMENT STN_GEOLOC (#PCDATA)>
    <!ELEMENT STN_SHIFT_FLG (#PCDATA)>
    <!ELEMENT STN_SEQ (#PCDATA)>
    <!ELEMENT STN_TMPLT_NM (#PCDATA)>
    I'm also having problems dealing with schemas. The call to OracleXMLQuery.getXMLMetaData(OracleXMLQuery.SCHEMA, false) returns the following for this particular table:
    <DOCUMENT xmlns:xsd="http://www.w3.org/2000/10/XMLSchema"<xsd:schema xmlns:xsd="http://www.w3.org/2000/10/XMLSchema">
    <xsd:element name="STATION">
    <xsd:complexType>
    <xsd:sequence>
    <xsd:element name="ROW" minOccurs="0" maxOccurs="unbounded">
    <xsd:complexType>
    <xsd:sequence>
    <xsd:element name="STN_THTR_AREA_CODE" type="xsd:string" minOc curs="0"/>
    <xsd:element name="STN_ID_CD" type="xsd:string" minOccurs="0"/>
    <xsd:element name="STN_NM" type="xsd:string" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_ESTD_DATA" type="xsd:string" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_CTRY_CD" type="xsd:string" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_SW_TYPE_CD" type="xsd:string" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_AGNY_CD" type="xsd:string" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_MFR_CD" type="xsd:string" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_CURR_SFTWR" type="xsd:string" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_TIME_ZONE" type="xsd:integer" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_LATD" type="xsd:string" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_LNGTD" type="xsd:string" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_NM_VLD_CALLS_1" type="xsd:integer" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_NM_VLD_CALLS_2" type="xsd:integer" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_NM_VLD_CALLS_3" type="xsd:integer" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_NM_VLD_CALLS_4" type="xsd:integer" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_NM_CALLS_1" type="xsd:integer" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_NM_CALLS_2" type="xsd:integer" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_NM_CALLS_3" type="xsd:integer" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_NM_CALLS_4" type="xsd:integer" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_STDY_ID_1" type="xsd:string" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_STDY_ID_2" type="xsd:string" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_STDY_ID_3" type="xsd:string" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_STDY_ID_4" type="xsd:string" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_CLASS_A_PHONES_ESTD_QTY" type="xsd:integer" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_CLASS_B_PHONES_ESTD_QTY" type="xsd:integer" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_POC_TTL" type="xsd:string" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_POC_FIRST_NM" type="xsd:string" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_POC_LAST_NM" type="xsd:string" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_POC_OFC_SYM_NM" type="xsd:string" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_POC_APO_PPO" type="xsd:string" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_POC_PSTL_CD" type="xsd:string" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_POC_AUTVN_TLPHN_NBR" type="xsd:string" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_MODIFIED_DT" type="xsd:string" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_TANDEM" type="xsd:string" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_MEMO" type="xsd:string" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_SW_TYPE_DESC" type="xsd:string" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_FREQ" type="xsd:integer" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_THTR" type="xsd:string" minOccurs="0"/>
    <xsd:element name="STN_STDY_ID" type="xsd:string" minOccurs="0"/>
    <xsd:element name="STN_GEOLOC" type="xsd:string" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_SHIFT_FLG" type="xsd:string" minOccurs="0"/>
    <xsd:element name="STN_SEQ" type="xsd:integer" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_TMPLT_NM" type="xsd:string" nullable="true" minOccurs="0"/>
    </xsd:sequence>
    <xsd:attribute name="num" type="xsd:integer"/>
    </xsd:complexType&g t;
    </xsd:element>
    </xsd:sequence>
    </xsd:complexType>
    </xsd:element>
    </xsd:schema>
    />
    The oracg utility gives the following errors with this as input:
    file:/export/home/kennedy/generatedSchemas/STATION.xsd<Line 1, Column 58>: XML-0190: (Fatal Error) Whitespace required.
    file:/export/home/kennedy/generatedSchemas/STATION.xsd<Line 1, Column 58>: XML-0201: (Fatal Error) Expected name instead of <.
    file:/export/home/kennedy/generatedSchemas/STATION.xsd<Line 1, Column 58>: XML-0122: (Fatal Error) '=' missing in attribute.
    file:/export/home/kennedy/generatedSchemas/STATION.xsd<Line 1, Column 59>: XML-0125: (Fatal Error) Attribute value should start with quote.
    Error: Schema Class Generator failed to generate classes. oracle.xml.parser.v2.XMLParseException: Whitespace required.
    which clearly points to the fact that the XSD:SCHEMA element is enclosed in the Document Element. Removing the document tag completely and leaving XSD:SCHEMA as the root element works. But thats a lot of post processing to be doing and I was wondering if there was a way to generate XML Schemas and DTDs using the standalone representations.
    If there is no way to do that, could somebody help me fix the error generated by oracg with my DTD?
    Thanks,
    Matt

    Hi,
    I'm trying to write a utility that accepts a database schema name and writes XML Schemas and a DTDs for each table based on a:
    select * from table_name
    over each table in the schema. I would then like to use those files as input to the oracg utility to produce java files. There are some problems though. The DTD representation is not meant as a standalone DTD. In other words its of the form:
    <!DOCTYPE NAME [
    ...dtd defs here ...
    ]>
    which oracg doesn't like. Its not a big deal to do some post processing and delete the DOCTYPE defenition, but then oracg barfs with the following error:
    Error: DTD Class Generator failed to generate classes. oracle.xml.parser.v2.XMLParseException: Expected 'DOCTYPE'.
    Here is the DTD I was trying to generate a class from:
    <!ELEMENT STATION (ROW)*>
    <!ELEMENT ROW (STN_THTR_AREA_CODE, STN_ID_CD, STN_NM?, STN_ESTD_DATA?, STN_CTRY_CD?, STN_SW_TYPE_CD?, STN_AGNY_CD?, STN_
    MFR_CD?, STN_CURR_SFTWR?, STN_TIME_ZONE?, STN_LATD?, STN_LNGTD?, STN_NM_VLD_CALLS_1?, STN_NM_VLD_CALLS_2?, STN_NM_VLD_CA
    LLS_3?, STN_NM_VLD_CALLS_4?, STN_NM_CALLS_1?, STN_NM_CALLS_2?, STN_NM_CALLS_3?, STN_NM_CALLS_4?, STN_STDY_ID_1?, STN_STD
    Y_ID_2?, STN_STDY_ID_3?, STN_STDY_ID_4?, STN_CLASS_A_PHONES_ESTD_QTY?, STN_CLASS_B_PHONES_ESTD_QTY?, STN_POC_TTL?, STN_P
    OC_FIRST_NM?, STN_POC_LAST_NM?, STN_POC_OFC_SYM_NM?, STN_POC_APO_PPO?, STN_POC_PSTL_CD?, STN_POC_AUTVN_TLPHN_NBR?, STN_M
    ODIFIED_DT?, STN_TANDEM?, STN_MEMO?, STN_SW_TYPE_DESC?, STN_FREQ?, STN_THTR, STN_STDY_ID, STN_GEOLOC?, STN_SHIFT_FLG, ST
    N_SEQ?, STN_TMPLT_NM?)>
    <!ATTLIST ROW num CDATA #REQUIRED>
    <!ELEMENT STN_THTR_AREA_CODE (#PCDATA)>
    <!ELEMENT STN_ID_CD (#PCDATA)>
    <!ELEMENT STN_NM (#PCDATA)>
    <!ELEMENT STN_ESTD_DATA (#PCDATA)>
    <!ELEMENT STN_CTRY_CD (#PCDATA)>
    <!ELEMENT STN_SW_TYPE_CD (#PCDATA)>
    <!ELEMENT STN_AGNY_CD (#PCDATA)>
    <!ELEMENT STN_MFR_CD (#PCDATA)>
    <!ELEMENT STN_CURR_SFTWR (#PCDATA)>
    <!ELEMENT STN_TIME_ZONE (#PCDATA)>
    <!ELEMENT STN_LATD (#PCDATA)>
    <!ELEMENT STN_LNGTD (#PCDATA)>
    <!ELEMENT STN_NM_VLD_CALLS_1 (#PCDATA)>
    <!ELEMENT STN_NM_VLD_CALLS_2 (#PCDATA)>
    <!ELEMENT STN_NM_VLD_CALLS_3 (#PCDATA)>
    <!ELEMENT STN_NM_VLD_CALLS_4 (#PCDATA)>
    <!ELEMENT STN_NM_CALLS_1 (#PCDATA)>
    <!ELEMENT STN_NM_CALLS_2 (#PCDATA)>
    <!ELEMENT STN_NM_CALLS_3 (#PCDATA)>
    <!ELEMENT STN_NM_CALLS_4 (#PCDATA)>
    <!ELEMENT STN_STDY_ID_1 (#PCDATA)>
    <!ELEMENT STN_STDY_ID_2 (#PCDATA)>
    <!ELEMENT STN_STDY_ID_3 (#PCDATA)>
    <!ELEMENT STN_STDY_ID_4 (#PCDATA)>
    <!ELEMENT STN_CLASS_A_PHONES_ESTD_QTY (#PCDATA)>
    <!ELEMENT STN_CLASS_B_PHONES_ESTD_QTY (#PCDATA)>
    <!ELEMENT STN_POC_TTL (#PCDATA)>
    <!ELEMENT STN_POC_FIRST_NM (#PCDATA)>
    <!ELEMENT STN_POC_LAST_NM (#PCDATA)>
    <!ELEMENT STN_POC_OFC_SYM_NM (#PCDATA)>
    <!ELEMENT STN_POC_APO_PPO (#PCDATA)>
    <!ELEMENT STN_POC_PSTL_CD (#PCDATA)>
    <!ELEMENT STN_POC_AUTVN_TLPHN_NBR (#PCDATA)>
    <!ELEMENT STN_MODIFIED_DT (#PCDATA)>
    <!ELEMENT STN_TANDEM (#PCDATA)>
    <!ELEMENT STN_MEMO (#PCDATA)>
    <!ELEMENT STN_SW_TYPE_DESC (#PCDATA)>
    <!ELEMENT STN_FREQ (#PCDATA)>
    <!ELEMENT STN_THTR (#PCDATA)>
    <!ELEMENT STN_STDY_ID (#PCDATA)>
    <!ELEMENT STN_GEOLOC (#PCDATA)>
    <!ELEMENT STN_SHIFT_FLG (#PCDATA)>
    <!ELEMENT STN_SEQ (#PCDATA)>
    <!ELEMENT STN_TMPLT_NM (#PCDATA)>
    I'm also having problems dealing with schemas. The call to OracleXMLQuery.getXMLMetaData(OracleXMLQuery.SCHEMA, false) returns the following for this particular table:
    <DOCUMENT xmlns:xsd="http://www.w3.org/2000/10/XMLSchema"<xsd:schema xmlns:xsd="http://www.w3.org/2000/10/XMLSchema">
    <xsd:element name="STATION">
    <xsd:complexType>
    <xsd:sequence>
    <xsd:element name="ROW" minOccurs="0" maxOccurs="unbounded">
    <xsd:complexType>
    <xsd:sequence>
    <xsd:element name="STN_THTR_AREA_CODE" type="xsd:string" minOc curs="0"/>
    <xsd:element name="STN_ID_CD" type="xsd:string" minOccurs="0"/>
    <xsd:element name="STN_NM" type="xsd:string" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_ESTD_DATA" type="xsd:string" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_CTRY_CD" type="xsd:string" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_SW_TYPE_CD" type="xsd:string" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_AGNY_CD" type="xsd:string" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_MFR_CD" type="xsd:string" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_CURR_SFTWR" type="xsd:string" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_TIME_ZONE" type="xsd:integer" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_LATD" type="xsd:string" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_LNGTD" type="xsd:string" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_NM_VLD_CALLS_1" type="xsd:integer" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_NM_VLD_CALLS_2" type="xsd:integer" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_NM_VLD_CALLS_3" type="xsd:integer" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_NM_VLD_CALLS_4" type="xsd:integer" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_NM_CALLS_1" type="xsd:integer" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_NM_CALLS_2" type="xsd:integer" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_NM_CALLS_3" type="xsd:integer" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_NM_CALLS_4" type="xsd:integer" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_STDY_ID_1" type="xsd:string" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_STDY_ID_2" type="xsd:string" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_STDY_ID_3" type="xsd:string" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_STDY_ID_4" type="xsd:string" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_CLASS_A_PHONES_ESTD_QTY" type="xsd:integer" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_CLASS_B_PHONES_ESTD_QTY" type="xsd:integer" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_POC_TTL" type="xsd:string" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_POC_FIRST_NM" type="xsd:string" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_POC_LAST_NM" type="xsd:string" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_POC_OFC_SYM_NM" type="xsd:string" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_POC_APO_PPO" type="xsd:string" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_POC_PSTL_CD" type="xsd:string" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_POC_AUTVN_TLPHN_NBR" type="xsd:string" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_MODIFIED_DT" type="xsd:string" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_TANDEM" type="xsd:string" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_MEMO" type="xsd:string" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_SW_TYPE_DESC" type="xsd:string" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_FREQ" type="xsd:integer" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_THTR" type="xsd:string" minOccurs="0"/>
    <xsd:element name="STN_STDY_ID" type="xsd:string" minOccurs="0"/>
    <xsd:element name="STN_GEOLOC" type="xsd:string" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_SHIFT_FLG" type="xsd:string" minOccurs="0"/>
    <xsd:element name="STN_SEQ" type="xsd:integer" nullable="true" minOccurs="0"/>
    <xsd:element name="STN_TMPLT_NM" type="xsd:string" nullable="true" minOccurs="0"/>
    </xsd:sequence>
    <xsd:attribute name="num" type="xsd:integer"/>
    </xsd:complexType&g t;
    </xsd:element>
    </xsd:sequence>
    </xsd:complexType>
    </xsd:element>
    </xsd:schema>
    />
    The oracg utility gives the following errors with this as input:
    file:/export/home/kennedy/generatedSchemas/STATION.xsd<Line 1, Column 58>: XML-0190: (Fatal Error) Whitespace required.
    file:/export/home/kennedy/generatedSchemas/STATION.xsd<Line 1, Column 58>: XML-0201: (Fatal Error) Expected name instead of <.
    file:/export/home/kennedy/generatedSchemas/STATION.xsd<Line 1, Column 58>: XML-0122: (Fatal Error) '=' missing in attribute.
    file:/export/home/kennedy/generatedSchemas/STATION.xsd<Line 1, Column 59>: XML-0125: (Fatal Error) Attribute value should start with quote.
    Error: Schema Class Generator failed to generate classes. oracle.xml.parser.v2.XMLParseException: Whitespace required.
    which clearly points to the fact that the XSD:SCHEMA element is enclosed in the Document Element. Removing the document tag completely and leaving XSD:SCHEMA as the root element works. But thats a lot of post processing to be doing and I was wondering if there was a way to generate XML Schemas and DTDs using the standalone representations.
    If there is no way to do that, could somebody help me fix the error generated by oracg with my DTD?
    Thanks,
    Matt

  • Validating a xml document via dtd or xml schema

    hi.
    i am trying to validate a xml document's structure via dtd or xml schema. unfortunately i dont have a clue how to do this. although i read some documents about it i didnt find a way to it yet.
    i am using dom4j to build a org.dom4j.Document from a String.
    my expectations were like this:
    - read data into string
    - create org.dom4j.Document from a string
    - after successfully creating the document calling document.validate(xmlSchema) throwing a ParseException (or something like this when the xml doesnt meet the requirements given by the schema)
    please help!

    Class org.dom4j.Document does not have a validate() method.

  • XML validation against schema (NOT DTD)

    Hi,
    I am fairly new at parsing XML documents, but I am trying to parse
    an XML document using the Xerces SAXParser.
    I can parse my xml document, no problems there, but I want to validate
    it against an xml schema file, without specifying the file in the xml document.
    How can I do this? If I set validating to true, it gives me errors about a DTD,
    but I don't have a DTD, I want to use a schema file.
    Can anybody help me, or give me a code example?
    THanks,
    Sven

    SAXParser parser = new SAXParser();
                 parser.setFeature("http://xml.org/sax/features/validation",
                          true);
                 parser.setFeature("http://apache.org/xml/features/validation/schema",
                          true);
                 parser.setFeature("http://apache.org/xml/features/validation/schema-full-checking",
                          true);

  • Storing DTD or xml schema in DB

    Is there a recommended best practice for using db tables to store constraints represented by a DTD or xml schema? I'm not looking to store a normal xml doc in the db, but rather something like the DTD that can be read and used to validate incoming documents. I'd also rather have this in a table somehow to handle changes to the DTD structure. Any advice much appreciated -
    Rob

    You are correct that there is no XML Schema for our configuration files.
    One of the reasons is that custom adapters can configure any settings they need in their destinations.  The other reason is that the server will not start if there is anything in the config XML that isn't read by the server on startup.  This ensures that mis-spellings and invalid tags do not get ignored.
    You are right however, we should create an xsd for them.  I filed an enhancement request - #2726353.
    Tom

  • Schema or DTD in XML portlet?

    I'm wondering whether or not it's possible to use an XML schema as opposed to a DTD in an XML component.
    Is it?

    No I guess that is not supported.
    rahul

  • XMLType toobject return invalid number while providing the XML Schema/DTD

    We are exploring an option of converting XML into an oracle object and found toobject procedure that does the job. It works fine without XML Schema and provides XML data as oracle object. But it takes more time in parsing the XML since it uses canonical mapping. I hope by providing XML Schema we can improve the performance of this procedure. However when we use toobject with XML Schema it reports error as INVALID NUMBER irrespective of the input XML changes. Could anyone help me in this regard?

    Sorry
    The option of using toObect() to get an instance of the object that was creaed by regidsteing an XML Schema with the database, or which is associated with an XML Schema that has been registered with the database is depricated and will be removed in the next release. The main reason for this is that we reserve the right to change the structure, naming conventions or any other aspects of the object model we dervie from an XML schema, even as a result of a one-off patch, and consequently any code that was written to rely on this mapping would be broken on a regular basis.
    We do gurantee that code that uses the XML abstraction (eg XPATH/XQUERY) to access the content of the XML will work unchanged...
    In you case you have 2 options...
    1. Use the canonical mapping mechansim
    2. Write code that instantiates the objects from the outpiut of an XMLTable...
    -M

  • Difference between schema and DTD

    Difference between schema and DTD
    <author>
    <firstname></firstname>
    <lastname></lastname>
    </author>
    How will u write dtd and schema for above XML ?

    DTD:
    <!ELEMENT author(firstname, lastname)>
    <!ELEMENT firstname(#PCDATA)>
    <!ELEMENT lastname(#PCDATA)>
    Schema:
    <xs:element name="author">
    <xs:complexType>
    <xs:sequence>
    <xs:element name="firstname" type="xs:string"/>
    <xs:element name="lastname" type="xs:string"/>
    </xs:sequence>
    </xs:complexType>
    </xs:element>

  • XML Schema file in data definition

    Hi,
    I am creating a custom RTF template for a seeded data definition in the eBusiness Suite. The data definition has an XML Schema file loaded however this does not include all the data required for the template. Running the report to just generate the XML (i.e. no template) I can see that the additional data is available at this level just not included in the XSD.
    I have built the template including the additional elements from the XML and expected to have to create a custom data definition as well to add the additional elements to the XSD. However the template is working against the seeded definition and successfully picking up the elements that are not included in the XSD.
    Has anybody else come across this situation? And are there any potential issues? I could create a custom data definition as well to load an amended XSD but this would be a more invasive change as it would involve end dating the seeded data definition which I would prefer not to do. The report is not being generated from a concurrent request so I cannot just create a custom request and leave the seeded report untouched.
    Thanks,
    Sarah

    The XML Schema is only required if you are using a PDF template (the template file itself is PDF) with field-mapping. For other template types the schema is optional.
    The XML Schema is used to define a "class" of XML documents, so to speak. The define the semantics and structure of the XML documents more thoroughly.
    If you have closely related reports, you could use a single schema to standardize (in a sense) the XML to be output from the class of related reports. In that case you could have a single schema file uploaded to multiple reports/data-definitions.
    The W3C has good documentation on XML Schema.
    If you want to see samples, you can use tools such as dtd2xs to create sample schemas from your DTD.

  • Error when registering XML Schema

    When I try to register a schema with XDB I keep getting an ORA-31000 error. It says that the schema it references is not a valid XDB schema, but when I try to register that one it says the first one isn't valid.

    Testing with 11g I get
    I assume you have registered 'http://www.w3.org/2005/08/addressing/ws-addr.xsd'
    SQL> set echo on
    SQL> spool testcase.log
    SQL> --
    SQL> connect sys/ as sysdba
    Enter password:
    Connected.
    SQL> set define on
    SQL> set timing on
    SQL> --
    SQL> define USERNAME = IXSEMF01
    SQL> --
    SQL> def PASSWORD = IXSEMF01
    SQL> --
    SQL> def USER_TABLESPACE = USERS
    SQL> --
    SQL> def TEMP_TABLESPACE = TEMP
    SQL> --
    SQL> drop user &USERNAME cascade
      2  /
    old   1: drop user &USERNAME cascade
    new   1: drop user IXSEMF01 cascade
    drop user IXSEMF01 cascade
    ERROR at line 1:
    ORA-01918: user 'IXSEMF01' does not exist
    Elapsed: 00:00:00.03
    SQL> grant connect, resource to &USERNAME identified by &PASSWORD
      2  /
    old   1: grant connect, resource to &USERNAME identified by &PASSWORD
    new   1: grant connect, resource to IXSEMF01 identified by IXSEMF01
    Grant succeeded.
    Elapsed: 00:00:00.01
    SQL> grant create any directory, drop any directory to &USERNAME
      2  /
    old   1: grant create any directory, drop any directory to &USERNAME
    new   1: grant create any directory, drop any directory to IXSEMF01
    Grant succeeded.
    Elapsed: 00:00:00.00
    SQL> grant alter session, create view to &USERNAME
      2  /
    old   1: grant alter session, create view to &USERNAME
    new   1: grant alter session, create view to IXSEMF01
    Grant succeeded.
    Elapsed: 00:00:00.00
    SQL> alter user &USERNAME default tablespace &USER_TABLESPACE temporary tablespace &TEMP_TABLESPACE
      2  /
    old   1: alter user &USERNAME default tablespace &USER_TABLESPACE temporary tablespace &TEMP_TABLESPACE
    new   1: alter user IXSEMF01 default tablespace USERS temporary tablespace TEMP
    User altered.
    Elapsed: 00:00:00.00
    SQL> connect &USERNAME/&PASSWORD
    Connected.
    SQL> --
    SQL> alter session set events ='19027 trace name context forever, level 0x800'
      2  /
    Session altered.
    Elapsed: 00:00:00.00
    SQL> var schemaURL  varchar2(700)
    SQL> var schemaURL1 varchar2(700)
    SQL> var schemaURL2 varchar2(700)
    SQL> var xmlschema CLOB
    SQL> --
    SQL> begin
      2    :schemaURL := 'http://www.w3.org/2005/08/addressing/ws-addr.xsd';
      3    :xmlSchema :=
      4  '<?xml version="1.0" encoding="utf-8"?>
      5  <!--
      6  <!DOCTYPE xs:schema PUBLIC "-//W3C//DTD XMLSCHEMA 200102//EN" "http://www.w3.org/2001/XMLSchema.dtd">
      7      W3C XML Schema defined in the Web Services Addressing 1.0 specification
      8      http://www.w3.org/TR/ws-addr-core
      9
    10     Copyright c 2005 World Wide Web Consortium,
    11
    12     (Massachusetts Institute of Technology, European Research Consortium for
    13     Informatics and Mathematics, Keio University). All Rights Reserved. This
    14     work is distributed under the W3Cr Software License [1] in the hope that
    15     it will be useful, but WITHOUT ANY WARRANTY; without even the implied
    16     warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    17
    18     [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
    19
    20     $Id: ws-addr.xsd,v 1.3 2005/08/09 13:17:35 hugo Exp $
    21  -->
    22  <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://www.w3.org/2005/08/addressing" targetNamespace="http://www.w3.
    org/2005/08/addressing" blockDefault="#all" elementFormDefault="qualified" finalDefault="" attributeFormDefault="unqualified">
    23
    24     <!-- Constructs from the WS-Addressing Core -->
    25
    26     <xs:element name="EndpointReference" type="tns:EndpointReferenceType"/>
    27     <xs:complexType name="EndpointReferenceType" mixed="false">
    28             <xs:sequence>
    29                     <xs:element name="Address" type="tns:AttributedURIType"/>
    30                     <xs:element name="ReferenceParameters" type="tns:ReferenceParametersType" minOccurs="0"/>
    31                     <xs:element ref="tns:Metadata" minOccurs="0"/>
    32                     <xs:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
    33             </xs:sequence>
    34             <xs:anyAttribute namespace="##other" processContents="lax"/>
    35     </xs:complexType>
    36
    37     <xs:complexType name="ReferenceParametersType" mixed="false">
    38             <xs:sequence>
    39                     <xs:any namespace="##any" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
    40             </xs:sequence>
    41             <xs:anyAttribute namespace="##other" processContents="lax"/>
    42     </xs:complexType>
    43
    44     <xs:element name="Metadata" type="tns:MetadataType"/>
    45     <xs:complexType name="MetadataType" mixed="false">
    46             <xs:sequence>
    47                     <xs:any namespace="##any" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
    48             </xs:sequence>
    49             <xs:anyAttribute namespace="##other" processContents="lax"/>
    50     </xs:complexType>
    51
    52     <xs:element name="MessageID" type="tns:AttributedURIType"/>
    53     <xs:element name="RelatesTo" type="tns:RelatesToType"/>
    54     <xs:complexType name="RelatesToType" mixed="false">
    55             <xs:simpleContent>
    56                     <xs:extension base="xs:anyURI">
    57                             <xs:attribute name="RelationshipType" type="tns:RelationshipTypeOpenEnum" use="optional" default="http://www
    .w3.org/2005/08/addressing/reply"/>
    58                             <xs:anyAttribute namespace="##other" processContents="lax"/>
    59                     </xs:extension>
    60             </xs:simpleContent>
    61     </xs:complexType>
    62
    63     <xs:simpleType name="RelationshipTypeOpenEnum">
    64             <xs:union memberTypes="tns:RelationshipType xs:anyURI"/>
    65     </xs:simpleType>
    66
    67     <xs:simpleType name="RelationshipType">
    68             <xs:restriction base="xs:anyURI">
    69                     <xs:enumeration value="http://www.w3.org/2005/08/addressing/reply"/>
    70             </xs:restriction>
    71     </xs:simpleType>
    72
    73     <xs:element name="ReplyTo" type="tns:EndpointReferenceType"/>
    74     <xs:element name="From" type="tns:EndpointReferenceType"/>
    75     <xs:element name="FaultTo" type="tns:EndpointReferenceType"/>
    76     <xs:element name="To" type="tns:AttributedURIType"/>
    77     <xs:element name="Action" type="tns:AttributedURIType"/>
    78
    79     <xs:complexType name="AttributedURIType" mixed="false">
    80             <xs:simpleContent>
    81                     <xs:extension base="xs:anyURI">
    82                             <xs:anyAttribute namespace="##other" processContents="lax"/>
    83                     </xs:extension>
    84             </xs:simpleContent>
    85     </xs:complexType>
    86
    87     <!-- Constructs from the WS-Addressing SOAP binding -->
    88
    89     <xs:attribute name="IsReferenceParameter" type="xs:boolean"/>
    90
    91     <xs:simpleType name="FaultCodesOpenEnumType">
    92             <xs:union memberTypes="tns:FaultCodesType xs:QName"/>
    93     </xs:simpleType>
    94
    95     <xs:simpleType name="FaultCodesType">
    96             <xs:restriction base="xs:QName">
    97                     <xs:enumeration value="tns:InvalidAddressingHeader"/>
    98                     <xs:enumeration value="tns:InvalidAddress"/>
    99                     <xs:enumeration value="tns:InvalidEPR"/>
    100                     <xs:enumeration value="tns:InvalidCardinality"/>
    101                     <xs:enumeration value="tns:MissingAddressInEPR"/>
    102                     <xs:enumeration value="tns:DuplicateMessageID"/>
    103                     <xs:enumeration value="tns:ActionMismatch"/>
    104                     <xs:enumeration value="tns:MessageAddressingHeaderRequired"/>
    105                     <xs:enumeration value="tns:DestinationUnreachable"/>
    106                     <xs:enumeration value="tns:ActionNotSupported"/>
    107                     <xs:enumeration value="tns:EndpointUnavailable"/>
    108             </xs:restriction>
    109     </xs:simpleType>
    110
    111     <xs:element name="RetryAfter" type="tns:AttributedUnsignedLongType"/>
    112     <xs:complexType name="AttributedUnsignedLongType" mixed="false">
    113             <xs:simpleContent>
    114                     <xs:extension base="xs:unsignedLong">
    115                             <xs:anyAttribute namespace="##other" processContents="lax"/>
    116                     </xs:extension>
    117             </xs:simpleContent>
    118     </xs:complexType>
    119
    120     <xs:element name="ProblemHeaderQName" type="tns:AttributedQNameType"/>
    121     <xs:complexType name="AttributedQNameType" mixed="false">
    122             <xs:simpleContent>
    123                     <xs:extension base="xs:QName">
    124                             <xs:anyAttribute namespace="##other" processContents="lax"/>
    125                     </xs:extension>
    126             </xs:simpleContent>
    127     </xs:complexType>
    128
    129     <xs:element name="ProblemHeader" type="tns:AttributedAnyType"/>
    130     <xs:complexType name="AttributedAnyType" mixed="false">
    131             <xs:sequence>
    132                     <xs:any namespace="##any" processContents="lax" minOccurs="1" maxOccurs="1"/>
    133             </xs:sequence>
    134             <xs:anyAttribute namespace="##other" processContents="lax"/>
    135     </xs:complexType>
    136
    137     <xs:element name="ProblemIRI" type="tns:AttributedURIType"/>
    138
    139     <xs:element name="ProblemAction" type="tns:ProblemActionType"/>
    140     <xs:complexType name="ProblemActionType" mixed="false">
    141             <xs:sequence>
    142                     <xs:element ref="tns:Action" minOccurs="0"/>
    143                     <xs:element name="SoapAction" minOccurs="0" type="xs:anyURI"/>
    144             </xs:sequence>
    145             <xs:anyAttribute namespace="##other" processContents="lax"/>
    146     </xs:complexType>
    147
    148  </xs:schema>';
    149  end;
    150  /
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:00.00
    SQL> declare
      2    xmlschema xmltype := xmltype(:xmlschema);
      3  begin
      4    dbms_xmlschema.registerSchema
      5    (
      6        schemaURL => :schemaURL
      7       ,schemaDoc => xmlschema
      8       ,local     => TRUE
      9       ,genBean   => false
    10       ,genTypes  => TRUE
    11       ,genTables => TRUE
    12    );
    13  end;
    14  /
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:03.07
    SQL>
    SQL> begin
      2    :schemaURL1 := 'muws1-2.xsd';
      3    :xmlSchema :=
      4  '<?xml version="1.0" encoding="utf-8"?>
      5  <!-- edited with XMLSpy v2005 rel. 3 U (http://www.altova.com) by Dirk Grissett (Oracle Corp.) --> <xs:schema xmlns:muws1="http://docs.
    oasis-open.org/wsdm/muws1-2.xsd" xmlns:muws2="http://docs.oasis-open.org/wsdm/muws2-2.xsd" xmlns:wsa="http://www.w3.org/2005/08/addressing"
    xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://docs.oasis-open.org/wsdm/muws1-2.xsd" elementFormDefault="qualified" att
    ributeFormDefault="unqualified">
      6     <xs:import namespace="http://docs.oasis-open.org/wsdm/muws2-2.xsd" schemaLocation="muws2-2.xsd"/>
      7     <xs:import namespace="http://www.w3.org/2005/08/addressing" schemaLocation="http://www.w3.org/2005/08/addressing/ws-addr.xsd"/>
      8     <xs:element name="ResourceId" type="xs:anyURI"/>
      9     <xs:element name="ManageabilityCapability" type="xs:anyURI"/>
    10     <xs:complexType name="CorrelatablePropertiesType">
    11             <xs:sequence>
    12                     <xs:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
    13             </xs:sequence>
    14             <xs:attribute name="Dialect" type="xs:anyURI"/>
    15             <xs:attribute name="NegativeAssertionPossible" type="xs:boolean"/>
    16             <xs:anyAttribute namespace="##other"/>
    17     </xs:complexType>
    18     <xs:element name="CorrelatableProperties" type="muws1:CorrelatablePropertiesType"/>
    19     <xs:complexType name="ComponentAddressType">
    20             <xs:sequence>
    21                     <xs:element name="ManagementURL" type="xs:string"/>
    22                     <xs:any namespace="##any" processContents="lax"/>
    23             </xs:sequence>
    24     </xs:complexType>
    25     <xs:complexType name="ComponentType">
    26             <xs:sequence>
    27                     <xs:element name="ResourceId" type="xs:anyURI" minOccurs="0"/>
    28                     <xs:element name="ComponentAddress" type="muws1:ComponentAddressType" minOccurs="0"/>
    29                     <xs:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
    30             </xs:sequence>
    31             <xs:anyAttribute namespace="##other"/>
    32     </xs:complexType>
    33     <xs:complexType name="ManagementEventType">
    34             <xs:sequence>
    35                     <xs:element name="EventId" type="xs:anyURI"/>
    36                     <xs:element name="SourceComponent" type="muws1:ComponentType"/>
    37                     <xs:element name="ReporterComponent" type="muws1:ComponentType" minOccurs="0"/>
    38                     <xs:element ref="muws2:Situation"/>
    39                     <xs:element name="ExtendedData" type="muws1:ExtendedDataType" minOccurs="0" maxOccurs="unbounded"/>
    40                     <xs:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
    41             </xs:sequence>
    42             <xs:attribute name="ReportTime" type="xs:dateTime" use="optional"/>
    43             <xs:anyAttribute namespace="##other"/>
    44     </xs:complexType>
    45     <xs:element name="ManagementEvent" type="muws1:ManagementEventType"/>
    46     <xs:element name="ManageabilityEndpointReference" type="wsa:EndpointReferenceType"/>
    47     <xs:complexType name="ExtendedDataElementType">
    48             <xs:sequence>
    49                     <xs:choice>
    50                             <xs:element name="values" minOccurs="0">
    51                                     <xs:simpleType>
    52                                             <xs:restriction base="xs:string">
    53                                                     <xs:maxLength value="1024"/>
    54                                             </xs:restriction>
    55                                     </xs:simpleType>
    56                             </xs:element>
    57                             <xs:element name="hexValue" type="xs:hexBinary" minOccurs="0"/>
    58                             <xs:element name="intValues" type="xs:int" minOccurs="0"/>
    59                             <xs:element name="longValues" type="xs:long" minOccurs="0"/>
    60                             <xs:element name="shortValues" type="xs:short" minOccurs="0"/>
    61                             <xs:element name="dateTimeValues" type="xs:dateTime" minOccurs="0"/>
    62                             <xs:element name="byteValues" type="xs:byte" minOccurs="0"/>
    63                             <xs:element name="booleanValues" type="xs:boolean" minOccurs="0"/>
    64                             <xs:element name="floatValues" type="xs:float" minOccurs="0"/>
    65                             <xs:element name="doubleValues" type="xs:double" minOccurs="0"/>
    66                             <xs:element name="largeStringValue" type="xs:string" minOccurs="0"/>
    67                     </xs:choice>
    68             </xs:sequence>
    69             <xs:attribute name="name" use="required">
    70                     <xs:simpleType>
    71                             <xs:restriction base="xs:Name">
    72                                     <xs:maxLength value="64"/>
    73                             </xs:restriction>
    74                     </xs:simpleType>
    75             </xs:attribute>
    76             <xs:attribute name="type" use="required">
    77                     <xs:simpleType>
    78                             <xs:restriction base="xs:string">
    79                                     <xs:enumeration value="noValue"/>
    80                                     <xs:enumeration value="byte"/>
    81                                     <xs:enumeration value="short"/>
    82                                     <xs:enumeration value="int"/>
    83                                     <xs:enumeration value="long"/>
    84                                     <xs:enumeration value="float"/>
    85                                     <xs:enumeration value="double"/>
    86                                     <xs:enumeration value="string"/>
    87                                     <xs:enumeration value="dateTime"/>
    88                                     <xs:enumeration value="boolean"/>
    89                                     <xs:enumeration value="byteArray"/>
    90                                     <xs:enumeration value="shortArray"/>
    91                                     <xs:enumeration value="intArray"/>
    92                                     <xs:enumeration value="longArray"/>
    93                                     <xs:enumeration value="floatArray"/>
    94                                     <xs:enumeration value="doubleArray"/>
    95                                     <xs:enumeration value="stringArray"/>
    96                                     <xs:enumeration value="dateTimeArray"/>
    97                                     <xs:enumeration value="booleanArray"/>
    98                                     <xs:enumeration value="hexBinary"/>
    99                                     <xs:enumeration value="largeStringValue"/>
    100                             </xs:restriction>
    101                     </xs:simpleType>
    102             </xs:attribute>
    103     </xs:complexType>
    104     <xs:complexType name="ExtendedDataType">
    105             <xs:sequence>
    106                     <xs:element name="ExtendedDataElement" type="muws1:ExtendedDataElementType" minOccurs="0" maxOccurs="unbounded"/>
    107             </xs:sequence>
    108             <xs:attribute name="profile" type="xs:ID"/>
    109     </xs:complexType>
    110     <!--
    111                                         SCHEMA COPY Material Copy and paste element references below into the schema of a resource prope
    rties document.
    112  These references are provide to insure that the correct minOccurs/maxOccurs attributes are specified in a resource property document sc
    hema.
    113
    114  NOTE: You must import the MUWS Part 1 schema namespace (MUWS1).
    115
    116          **    Identity Properties    **
    117            <xs:element ref="muws1:ResourceId"/>
    118
    119
    120          **    ManageabilityCharacteristics Properties    **
    121            <xs:element ref="muws1:ManageabilityCapability"
    122                        minOccurs="0" maxOccurs="unbounded"/>
    123
    124          **    Correlatable Properties    **
    125            <xs:element ref="muws1:CorrelatableProperties"
    126                        minOccurs="0" maxOccurs="unbounded"/>
    127
    128  -->
    129  </xs:schema>';
    130  end;
    131  /
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:00.00
    SQL> declare
      2    xmlschema xmltype := xmltype(:xmlschema);
      3  begin
      4    dbms_xmlschema.registerSchema
      5    (
      6        schemaURL => :schemaURL1
      7       ,schemaDoc => xmlschema
      8       ,local     => TRUE
      9       ,genBean   => false
    10       ,genTypes  => TRUE
    11       ,genTables => TRUE
    12       ,force => TRUE
    13    );
    14  end;
    15  /
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:00.35
    SQL> begin
      2    :schemaURL2 := 'muws2-2.xsd';
      3    :xmlSchema :=
      4  '<?xml version="1.0" encoding="utf-8"?>
      5  <!-- edited with XMLSpy v2005 rel. 3 U (http://www.altova.com) by Dirk Grissett (Oracle Corp.) -->
      6  <xs:schema xmlns:muws2="http://docs.oasis-open.org/wsdm/muws2-2.xsd" xmlns:muws1="http://docs.oasis-open.org/wsdm/muws1-2.xsd" xmlns:ws
    a="http://www.w3.org/2005/08/addressing" xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://docs.oasis-open.org/wsdm/muws2-
    2.xsd" elementFormDefault="qualified" attributeFormDefault="unqualified">
      7     <xs:import namespace="http://docs.oasis-open.org/wsdm/muws1-2.xsd" schemaLocation="muws1-2.xsd"/>
      8     <xs:import namespace="http://www.w3.org/2005/08/addressing" schemaLocation="http://www.w3.org/2005/08/addressing/ws-addr.xsd"/>
      9     <xs:import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="http://www.w3.org/2001/xml.xsd"/>
    10     <xs:complexType name="LangString">
    11             <xs:simpleContent>
    12                     <xs:extension base="xs:string">
    13                             <xs:attribute ref="xml:lang" use="required"/>
    14                             <xs:anyAttribute namespace="##other"/>
    15                     </xs:extension>
    16             </xs:simpleContent>
    17     </xs:complexType>
    18     <!-- Begin properties for the Description capability -->
    19     <xs:element name="Caption" type="muws2:LangString"/>
    20     <xs:element name="Description" type="muws2:LangString"/>
    21     <xs:element name="Version" type="xs:string"/>
    22     <!-- End   properties for the Description capability -->
    23     <xs:complexType name="CategoryType">
    24             <xs:sequence>
    25                     <xs:any namespace="##any" processContents="lax" minOccurs="0"/>
    26             </xs:sequence>
    27     </xs:complexType>
    28     <xs:complexType name="StateType">
    29             <xs:complexContent>
    30                     <xs:extension base="muws2:CategoryType"/>
    31             </xs:complexContent>
    32     </xs:complexType>
    33     <xs:element name="State" type="muws2:StateType"/>
    34     <xs:element name="EnteredState" type="muws2:StateType"/>
    35     <xs:element name="PreviousState" type="muws2:StateType"/>
    36     <xs:complexType name="StateTransitionType">
    37             <xs:sequence>
    38                     <xs:element ref="muws2:EnteredState"/>
    39                     <xs:element ref="muws2:PreviousState" minOccurs="0"/>
    40                     <xs:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
    41             </xs:sequence>
    42             <xs:attribute name="TransitionIdentifier" type="xs:anyURI" use="optional"/>
    43             <xs:attribute name="Time" type="xs:dateTime" use="required"/>
    44             <xs:anyAttribute namespace="##other"/>
    45     </xs:complexType>
    46     <xs:element name="StateTransition" type="muws2:StateTransitionType"/>
    47     <!-- Begin properties for the OperationalStatus capability -->
    48     <xs:element name="OperationalStatus">
    49             <xs:simpleType>
    50                     <xs:restriction base="xs:string">
    51                             <xs:enumeration value="Available"/>
    52                             <xs:enumeration value="PartiallyAvailable"/>
    53                             <xs:enumeration value="Unavailable"/>
    54                             <xs:enumeration value="Unknown"/>
    55                     </xs:restriction>
    56             </xs:simpleType>
    57     </xs:element>
    58     <!-- End   properties for the OperationalStatus capability -->
    59     <xs:attributeGroup name="MetricAttributes">
    60             <xs:attribute name="ResetAt" type="xs:dateTime"/>
    61             <xs:attribute name="LastUpdated" type="xs:dateTime"/>
    62             <xs:attribute name="Duration" type="xs:duration"/>
    63     </xs:attributeGroup>
    64     <!-- Begin properties for the Metrics capability -->
    65     <xs:element name="CurrentTime" type="xs:dateTime"/>
    66     <!-- End   properties for the Metrics capability -->
    67     <xs:complexType name="RelationshipTypeType">
    68             <xs:complexContent>
    69                     <xs:extension base="muws2:CategoryType"/>
    70             </xs:complexContent>
    71     </xs:complexType>
    72     <xs:element name="Self">
    73             <xs:complexType/>
    74     </xs:element>
    75     <xs:complexType name="RelationshipParticipantType">
    76             <xs:sequence>
    77                     <xs:element ref="muws2:Self" minOccurs="0"/>
    78                     <xs:element ref="muws1:ManageabilityEndpointReference" minOccurs="0" maxOccurs="unbounded"/>
    79                     <xs:element ref="wsa:EndpointReference" minOccurs="0" maxOccurs="unbounded"/>
    80                     <xs:element ref="muws1:ResourceId" minOccurs="0"/>
    81                     <xs:element name="Role" type="xs:anyURI"/>
    82                     <xs:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
    83             </xs:sequence>
    84             <xs:anyAttribute namespace="##other"/>
    85     </xs:complexType>
    86     <!-- Begin properties for the RelationshipResource capability -->
    87     <xs:element name="Name" type="xs:string"/>
    88     <xs:element name="Type" type="muws2:RelationshipTypeType"/>
    89     <xs:element name="Participant" type="muws2:RelationshipParticipantType"/>
    90     <!-- End   properties for the RelationshipResource capability -->
    91     <xs:complexType name="RelationshipType">
    92             <xs:sequence>
    93                     <xs:element ref="muws2:Name" minOccurs="0"/>
    94                     <xs:element ref="muws2:Type"/>
    95                     <xs:element ref="muws2:Participant" minOccurs="2" maxOccurs="unbounded"/>
    96                     <xs:element name="AccessEndpointReference" type="wsa:EndpointReferenceType" minOccurs="0"/>
    97                     <xs:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
    98             </xs:sequence>
    99             <xs:anyAttribute namespace="##other"/>
    100     </xs:complexType>
    101     <!-- Begin properties for the Relationship capability -->
    102     <xs:element name="Relationship" type="muws2:RelationshipType"/>
    103     <!-- End   properties for the Relationship capability -->
    104     <xs:element name="RelationshipCreatedNotification">
    105             <xs:complexType>
    106                     <xs:sequence>
    107                             <xs:element ref="muws2:Relationship"/>
    108                             <xs:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
    109                     </xs:sequence>
    110                     <xs:anyAttribute namespace="##other"/>
    111             </xs:complexType>
    112     </xs:element>
    113     <xs:element name="RelationshipDeletedNotification">
    114             <xs:complexType>
    115                     <xs:sequence>
    116                             <xs:element ref="muws2:Relationship"/>
    117                             <xs:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
    118                     </xs:sequence>
    119                     <xs:anyAttribute namespace="##other"/>
    120             </xs:complexType>
    121     </xs:element>
    122     <xs:element name="QueryRelationshipsByType">
    123             <xs:complexType>
    124                     <xs:sequence>
    125                             <xs:element name="RequestedType" type="xs:QName"/>
    126                     </xs:sequence>
    127             </xs:complexType>
    128     </xs:element>
    129     <xs:element name="QueryRelationshipsByTypeResponse">
    130             <xs:complexType>
    131                     <xs:sequence>
    132                             <xs:element ref="muws2:Relationship" minOccurs="0" maxOccurs="unbounded"/>
    133                     </xs:sequence>
    134             </xs:complexType>
    135     </xs:element>
    136     <xs:element name="CreationNotification">
    137             <xs:complexType>
    138                     <xs:sequence>
    139                             <xs:element ref="muws1:ManageabilityEndpointReference" minOccurs="0" maxOccurs="unbounded"/>
    140                     </xs:sequence>
    141                     <xs:anyAttribute namespace="##other"/>
    142             </xs:complexType>
    143     </xs:element>
    144     <xs:element name="DestructionNotification">
    145             <xs:complexType>
    146                     <xs:sequence>
    147                             <xs:element ref="muws1:ResourceId" minOccurs="0"/>
    148                     </xs:sequence>
    149                     <xs:anyAttribute namespace="##other"/>
    150             </xs:complexType>
    151     </xs:element>
    152     <xs:complexType name="SituationCategoryType">
    153             <xs:complexContent>
    154                     <xs:extension base="muws2:CategoryType">
    155                             <xs:sequence>
    156                                     <xs:element name="SituationName" minOccurs="0"/>
    157                             </xs:sequence>
    158                     </xs:extension>
    159             </xs:complexContent>
    160     </xs:complexType>
    161     <xs:element name="fred" type="xs:string"/>
    162     <xs:complexType name="SubstitutableMsgType">
    163             <xs:sequence>
    164                     <xs:element name="Value" type="xs:anySimpleType" minOccurs="0" maxOccurs="unbounded"/>
    165             </xs:sequence>
    166             <xs:attribute name="MsgId" type="xs:string" use="required"/>
    167             <xs:attribute name="MsgIdType" type="xs:anyURI" use="required"/>
    168     </xs:complexType>
    169     <xs:complexType name="SituationType">
    170             <xs:sequence>
    171                     <xs:element name="SituationCategory" type="muws2:SituationCategoryType"/>
    172                     <xs:element name="SuccessDisposition" minOccurs="0">
    173                             <xs:simpleType>
    174                                     <xs:restriction base="xs:string">
    175                                             <xs:enumeration value="Successful"/>
    176                                             <xs:enumeration value="Unsuccessful"/>
    177                                     </xs:restriction>
    178                             </xs:simpleType>
    179                     </xs:element>
    180                     <xs:element name="SituationTime" type="xs:dateTime"/>
    181                     <xs:element name="Priority" type="xs:short" minOccurs="0"/>
    182                     <xs:element name="Severity" type="xs:short" minOccurs="0"/>
    183                     <xs:element name="Message" type="muws2:LangString" minOccurs="0"/>
    184                     <xs:element name="SubstitutableMsg" type="muws2:SubstitutableMsgType" minOccurs="0"/>
    185             </xs:sequence>
    186     </xs:complexType>
    187     <xs:element name="Situation" type="muws2:SituationType"/>
    188     <xs:complexType name="EventCorrelationPropertiesType">
    189             <xs:sequence>
    190                     <xs:element name="repeatCount" minOccurs="0">
    191                             <xs:simpleType>
    192                                     <xs:restriction base="xs:short">
    193                                             <xs:minInclusive value="0"/>
    194                                     </xs:restriction>
    195                             </xs:simpleType>
    196                     </xs:element>
    197                     <xs:element name="elapsedTime" minOccurs="0">
    198                             <xs:simpleType>
    199                                     <xs:restriction base="xs:long">
    200                                             <xs:minInclusive value="0"/>
    201                                     </xs:restriction>
    202                             </xs:simpleType>
    203                     </xs:element>
    204             </xs:sequence>
    205             <xs:attribute name="sequenceNumber" type="xs:unsignedLong"/>
    206     </xs:complexType>
    207     <xs:element name="EventCorrelationProperties" type="muws2:EventCorrelationPropertiesType"/>
    208     <xs:complexType name="MsgCatalogInformationType">
    209             <xs:sequence>
    210                     <xs:element name="msgCatalog" type="xs:anyURI"/>
    211                     <xs:element name="msgCatalogType" type="xs:anyURI" minOccurs="0"/>
    212             </xs:sequence>
    213     </xs:complexType>
    214     <xs:element name="MsgCatalogInformation" type="muws2:MsgCatalogInformationType"/>
    215     <!-- #####   Metadata description elements   ##### -->
    216     <xs:element name="Capability" type="xs:anyURI"/>
    217     <xs:complexType name="DialectableExpressionType" mixed="true">
    218             <xs:sequence>
    219                     <xs:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
    220             </xs:sequence>
    221             <xs:attribute name="Dialect" type="xs:anyURI" use="required"/>
    222             <xs:anyAttribute namespace="##other"/>
    223     </xs:complexType>
    224     <xs:element name="ValidWhile" type="muws2:DialectableExpressionType"/>
    225     <xs:element name="Units" type="xs:string"/>
    226     <xs:element name="ChangeType">
    227             <xs:simpleType>
    228                     <xs:restriction base="xs:string">
    229                             <xs:enumeration value="Counter"/>
    230                             <xs:enumeration value="Gauge"/>
    231                             <xs:enumeration value="Unknown"/>
    232                     </xs:restriction>
    233             </xs:simpleType>
    234     </xs:element>
    235     <xs:element name="TimeScope">
    236             <xs:simpleType>
    237                     <xs:restriction base="xs:string">
    238                             <xs:enumeration value="Interval"/>
    239                             <xs:enumeration value="PointInTime"/>
    240                             <xs:enumeration value="SinceReset"/>
    241                     </xs:restriction>
    242             </xs:simpleType>
    243     </xs:element>
    244     <xs:element name="GatheringTime">
    245             <xs:simpleType>
    246                     <xs:restriction base="xs:string">
    247                             <xs:enumeration value="OnChange"/>
    248                             <xs:enumeration value="Periodic"/>
    249                             <xs:enumeration value="OnDemand"/>
    250                             <xs:enumeration value="Unknown"/>
    251                     </xs:restriction>
    252             </xs:simpleType>
    253     </xs:element>
    254     <xs:element name="CalculationInterval" type="xs:duration"/>
    255     <xs:element name="MetricGroup" type="xs:anyURI"/>
    256     <xs:element name="PostCondition" type="muws2:DialectableExpressionType"/>
    257     <!-- =========   StartSituation   ============  -->
    258     <xs:element name="StartSituation">
    259             <xs:complexType>
    260                     <xs:complexContent>
    261                             <xs:restriction base="muws2:SituationCategoryType"/>
    262                     </xs:complexContent>
    263             </xs:complexType>
    264     </xs:element>
    265     <xs:element name="StartInitiated">
    266             <xs:complexType>
    267                     <xs:complexContent>
    268                             <xs:restriction base="muws2:SituationCategoryType">
    269                                     <xs:sequence>
    270                                             <xs:element ref="muws2:StartSituation"/>
    271                                     </xs:sequence>
    272                             </xs:restriction>
    273                     </xs:complexContent>
    274             </xs:complexType>
    275     </xs:element>
    276     <xs:element name="RestartInitiated">
    277             <xs:complexType>
    278                     <xs:complexContent>
    279                             <xs:restriction base="muws2:SituationCategoryType">
    280                                     <xs:sequence>
    281                                             <xs:element ref="muws2:StartSituation"/>
    282                                     </xs:sequence>
    283                             </xs:restriction>
    284                     </xs:complexContent>
    285             </xs:complexType>
    286     </xs:element>
    287     <xs:element name="StartCompleted">
    288             <xs:complexType>
    289                     <xs:complexContent>
    290                             <xs:restriction base="muws2:SituationCategoryType">
    291                                     <xs:sequence>
    292                                             <xs:element ref="muws2:StartSituation"/>
    293                                     </xs:sequence>
    294                             </xs:restriction>
    295                     </xs:complexContent>
    296             </xs:complexType>
    297     </xs:element>
    298     <!-- =========   StopSituation   ============  -->
    299     <xs:element name="StopSituation">
    300             <xs:complexType>
    301                     <xs:complexContent>
    302                             <xs:restriction base="muws2:SituationCategoryType"/>
    303                     </xs:complexContent>
    304             </xs:complexType>
    305     </xs:element>
    306     <xs:element name="StopInitiated">
    307             <xs:complexType>
    308                     <xs:complexContent>
    309                             <xs:restriction base="muws2:SituationCategoryType">
    310                                     <xs:sequence>
    311                                             <xs:element ref="muws2:StopSituation"/>
    312                                     </xs:sequence>
    313                             </xs:restriction>
    314                     </xs:complexContent>
    315             </xs:complexType>
    316     </xs:element>
    317     <xs:element name="AbortInitiated">
    318             <xs:complexType>
    319                     <xs:complexContent>
    320                             <xs:restriction base="muws2:SituationCategoryType">
    321                                     <xs:sequence>
    322                                             <xs:element ref="muws2:StopSituation"/>
    323                                     </xs:sequence>
    324                             </xs:restriction>
    325                     </xs:complexContent>
    326             </xs:complexType>
    327     </xs:element>
    328     <xs:element name="PauseInitiated">
    329             <xs:complexType>
    330                     <xs:complexContent>
    331                             <xs:restriction base="muws2:SituationCategoryType">
    332                                     <xs:sequence>
    333                                             <xs:element ref="muws2:StopSituation"/>
    334                                     </xs:sequence>
    335                             </xs:restriction>
    336                     </xs:complexContent>
    337             </xs:complexType>
    338     </xs:element>
    339     <xs:element name="StopCompleted">
    340             <xs:complexType>
    341                     <xs:complexContent>
    342                             <xs:restriction base="muws2:SituationCategoryType">
    343                                     <xs:sequence>
    344                                             <xs:element ref="muws2:StopSituation"/>
    345                                     </xs:sequence>
    346                             </xs:restriction>
    347                     </xs:complexContent>
    348             </xs:complexType>
    349     </xs:element>
    350     <!-- =========   RequestSituation   ============  -->
    351     <xs:element name="RequestSituation">
    352             <xs:complexType>
    353                     <xs:complexContent>
    354                             <xs:restriction base="muws2:SituationCategoryType"/>
    355                     </xs:complexContent>
    356             </xs:complexType>
    357     </xs:element>
    358     <xs:element name="RequestInitiated">
    359             <xs:complexType>
    360                     <xs:complexContent>
    361                             <xs:restriction base="muws2:SituationCategoryType">
    362                                     <xs:sequence>
    363                                             <xs:element ref="muws2:RequestSituation"/>
    364                                     </xs:sequence>
    365                             </xs:restriction>
    366                     </xs:complexContent>
    367             </xs:complexType>
    368     </xs:element>
    369     <xs:element name="RequestCompleted">
    370             <xs:complexType>
    371                     <xs:complexContent>
    372                             <xs:restriction base="muws2:SituationCategoryType">
    373                                     <xs:sequence>
    374                                             <xs:element ref="muws2:RequestSituation"/>
    375                                     </xs:sequence>
    376                             </xs:restriction>
    377                     </xs:complexContent>
    378             </xs:complexType>
    379     </xs:element>
    380     <!-- =========   DestroySituation   ============  -->
    381     <xs:element name="DestroySituation">
    382             <xs:complexType>
    383                     <xs:complexContent>
    384                             <xs:restriction base="muws2:SituationCategoryType"/>
    385                     </xs:complexContent>
    386             </xs:complexType>
    387     </xs:element>
    388     <xs:element name="DestroyInitiated">
    389             <xs:complexType>
    390                     <xs:complexContent>
    391                             <xs:restriction base="muws2:SituationCategoryType">
    392                                     <xs:sequence>
    393                                             <xs:element ref="muws2:DestroySituation"/>
    394                                     </xs:sequence>
    395                             </xs:restriction>
    396                     </xs:complexContent>
    397             </xs:complexType>
    398     </xs:element>
    399     <xs:element name="DestroyCompleted">
    400             <xs:complexType>
    401                     <xs:complexContent>
    402                             <xs:restriction base="muws2:SituationCategoryType">
    403                                     <xs:sequence>
    404                                             <xs:element ref="muws2:DestroySituation"/>
    405                                     </xs:sequence>
    406                             </xs:restriction>
    407                     </xs:complexContent>
    408             </xs:complexType>
    409     </xs:element>
    410     <!-- =========   CreateSituation   ============  -->
    411     <xs:element name="CreateSituation">
    412             <xs:complexType>
    413                     <xs:complexContent>
    414                             <xs:restriction base="muws2:SituationCategoryType"/>
    415                     </xs:complexContent>
    416             </xs:complexType>
    417     </xs:element>
    418     <xs:element name="CreateInitiated">
    419             <xs:complexType>
    420                     <xs:complexContent>
    421                             <xs:restriction base="muws2:SituationCategoryType">
    422                                     <xs:sequence>
    423                                             <xs:element ref="muws2:CreateSituation"/>
    424                                     </xs:sequence>
    425                             </xs:restriction>
    426                     </xs:complexContent>
    427             </xs:complexType>
    428     </xs:element>
    429     <xs:element name="CreateCompleted">
    430             <xs:complexType>
    431                     <xs:complexContent>
    432                             <xs:restriction base="muws2:SituationCategoryType">
    433                                     <xs:sequence>
    434                                             <xs:element ref="muws2:CreateSituation"/>
    435                                     </xs:sequence>
    436                             </xs:restriction>
    437                     </xs:complexContent>
    438             </xs:complexType>
    439     </xs:element>
    440     <!-- =========   ConnectSituation   ============  -->
    441     <xs:element name="ConnectSituation">
    442             <xs:complexType>
    443                     <xs:complexContent>
    444                             <xs:restriction base="muws2:SituationCategoryType"/>
    445                     </xs:complexContent>
    446             </xs:complexType>
    447     </xs:element>
    448     <xs:element name="ConnectInitiated">
    449             <xs:complexType>
    450                     <xs:complexContent>
    451                             <xs:restriction base="muws2:SituationCategoryType">
    452                                     <xs:sequence>
    453                                             <xs:element ref="muws2:ConnectSituation"/>
    454                                     </xs:sequence>
    455                             </xs:restriction>
    456                     </xs:complexContent>
    457             </xs:complexType>
    458     </xs:element>
    459     <xs:element name="ReconnectInitiated">
    460             <xs:complexType>
    461                     <xs:complexContent>
    462                             <xs:restriction base="muws2:SituationCategoryType">
    463                                     <xs:sequence>
    464                                             <xs:element ref="muws2:ConnectSituation"/>
    465                                     </xs:sequence>
    466                             </xs:restriction>
    467                     </xs:complexContent>
    468             </xs:complexType>
    469     </xs:element>
    470     <xs:element name="ConnectCompleted">
    471             <xs:complexType>
    472                     <xs:complexContent>
    473                             <xs:restriction base="muws2:SituationCategoryType">
    474                                     <xs:sequence>
    475                                             <xs:element ref="muws2:ConnectSituation"/>
    476                                     </xs:sequence>
    477                             </xs:restriction>
    478                     </xs:complexContent>
    479             </xs:complexType>
    480     </xs:element>
    481     <!-- =========   ReportSituation   ============  -->
    482     <xs:element name="ReportSituation">
    483             <xs:complexType>
    484                     <xs:complexContent>
    485                             <xs:restriction base="muws2:SituationCategoryType"/>
    486                     </xs:complexContent>
    487             </xs:complexType>
    488     </xs:element>
    489     <xs:element name="PerformanceReport">
    490             <xs:complexType>
    491                     <xs:complexContent>
    492                             <xs:restriction base="muws2:SituationCategoryType">
    493                                     <xs:sequence>
    494                                             <xs:element ref="muws2:ReportSituation"/>
    495                                     </xs:sequence>
    496                             </xs:restriction>
    497                     </xs:complexContent>
    498             </xs:complexType>
    499     </xs:element>
    500     <xs:element name="SecurityReport">
    501             <xs:complexType>
    502                     <xs:complexContent>
    503                             <xs:restriction base="muws2:SituationCategoryType">
    504                                     <xs:sequence>
    505                                             <xs:element ref="muws2:ReportSituation"/>
    506                                     </xs:sequence>
    507                             </xs:restriction>
    508                     </xs:complexContent>
    509             </xs:complexType>
    510     </xs:element>
    511     <xs:element name="HeartbeatReport">
    512             <xs:complexType>
    513                     <xs:complexContent>
    514                             <xs:restriction base="muws2:SituationCategoryType">
    515                                     <xs:sequence>
    516                                             <xs:element ref="muws2:ReportSituation"/>
    517                                     </xs:sequence>
    518                             </xs:restriction>
    519                     </xs:complexContent>
    520             </xs:complexType>
    521     </xs:element>
    522     <xs:element name="StatusReport">
    523             <xs:complexType>
    524                     <xs:complexContent>
    525                             <xs:restriction base="muws2:SituationCategoryType">
    526                                     <xs:sequence>
    527                                             <xs:element ref="muws2:ReportSituation"/>
    528                                     </xs:sequence>
    529                             </xs:restriction>
    530                     </xs:complexContent>
    531             </xs:complexType>
    532     </xs:element>
    533     <xs:element name="TraceReport">
    534             <xs:complexType>
    535                     <xs:complexContent>
    536                             <xs:restriction base="muws2:SituationCategoryType"&g

  • Try to do my first XML Schema in SQL Server 2012 Mangement Studio(SSMS2012)-How to execute the xsd and xml files in SSMS2012?

    Hi all,
    I learmed the basic stuff of XML, DTD, DOM, etc. long time ago. Now, I came back to resume my XML journey and try to learn the XML Schemas, XPath and XQuery. I have Microsoft SQL Server 2012 Management Studio (SSMS2012) in our computer network. From
    Page 221 of the old Book "Beginning XML 2nd Edition" written by David Hunter, et.al., (published by Wrox), I copied the name5.xsd and name5.xml :
    <?xml version="1.0"?>
    <schema xmlns=http://www.w3.org/2001/XMLSchema"
    targetNamespace="http://www.wrox.com/name" xmlns:target="http://www.wrox.com/name"
    elementFormDefault="qualified">
    <element name="name">
    <complexType>
    <sequence>
    <element name="first" type="string"/>
    <element name="middle" type="string"/>
    <element name="last" type="string"/>
    </sequence>
    </complexType>
    </element>
    </schema>
    <?xml version="1.0"?>
    <name
    xmlns=http://www.wrox.com/name"
    xmlns:xsi="http://www.wrox.org/2001XMLSchema-instance"
    xsi:schemaLocation="http://www.wrox.com/name name5.xsd"
    title="Mr.">
    <first>John</first>
    <middle>Frizgerald</middle>
    <last>Doe</last>
    </name>
    How can I execute these two files in my SSMS2012 for doing my first XML Schema trial?
    Please kindly help, advise and respond.
    Thanks in advance,
    Scott Chang

    Hi Eric Zhang, Thanks for your nice response.
    1) I saw the CREATE XML SCHEMA COLLECTION (Transact-SQL) and tried  its first example "Create XML schema collection in the database" in my SQL Server 2012 Management Studio (SSMS2012):
    -- Create a sample database in which to load the XML schema collection.
    -- Copied this set of code stsments from Microsoft Library (ms176009)
    -- ColesMS12_20a.sql (saved in C:/Documents/SQL Server Management Studio)
    -- 19 March 2015 1145 AM
    CREATE DATABASE SampleDB
    GO
    USE SampleDB
    GO
    CREATE XML SCHEMA COLLECTION ManuInstructionsSchemaCollection AS
    N'<?xml version="1.0" encoding="UTF-16"?>
    <xsd:schema targetNamespace="http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/ProductModelManuInstructions"
    xmlns ="http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/ProductModelManuInstructions"
    elementFormDefault="qualified"
    attributeFormDefault="unqualified"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema" >
    <xsd:complexType name="StepType" mixed="true" >
    <xsd:choice minOccurs="0" maxOccurs="unbounded" >
    <xsd:element name="tool" type="xsd:string" />
    <xsd:element name="material" type="xsd:string" />
    <xsd:element name="blueprint" type="xsd:string" />
    <xsd:element name="specs" type="xsd:string" />
    <xsd:element name="diag" type="xsd:string" />
    </xsd:choice>
    </xsd:complexType>
    <xsd:element name="root">
    <xsd:complexType mixed="true">
    <xsd:sequence>
    <xsd:element name="Location" minOccurs="1" maxOccurs="unbounded">
    <xsd:complexType mixed="true">
    <xsd:sequence>
    <xsd:element name="step" type="StepType" minOccurs="1" maxOccurs="unbounded" />
    </xsd:sequence>
    <xsd:attribute name="LocationID" type="xsd:integer" use="required"/>
    <xsd:attribute name="SetupHours" type="xsd:decimal" use="optional"/>
    <xsd:attribute name="MachineHours" type="xsd:decimal" use="optional"/>
    <xsd:attribute name="LaborHours" type="xsd:decimal" use="optional"/>
    <xsd:attribute name="LotSize" type="xsd:decimal" use="optional"/>
    </xsd:complexType>
    </xsd:element>
    </xsd:sequence>
    </xsd:complexType>
    </xsd:element>
    </xsd:schema>' ;
    GO
    -- Verify - list of collections in the database.
    select *
    from sys.xml_schema_collections
    -- Verify - list of namespaces in the database.
    select name
    from sys.xml_schema_namespaces
    -- Use it. Create a typed xml variable. Note collection name specified.
    DECLARE @x xml (ManuInstructionsSchemaCollection)
    GO
    --Or create a typed xml column.
    CREATE TABLE T (
    i int primary key,
    x xml (ManuInstructionsSchemaCollection))
    GO
    -- ////The following code statements are not used in order to create SampleDB
    -- Clean up
    ---DROP TABLE T
    ---GO
    ---DROP XML SCHEMA COLLECTION ManuInstructionsSchemaCollection
    ---Go
    ---USE Master
    ---GO
    ---DROP DATABASE SampleDB
    It worked and I got the following results:
    1 4 NULL sys 2009-04-13 12:59:13.390 2012-02-10 20:16:02.097
    65536 1 NULL ManuInstructionsSchemaCollection 2015-03-19 11:47:17.660 2015-03-19 11:47:17.660
    http://www.w3.org/2001/XMLSchema
    http://schemas.microsoft.com/sqlserver/2004/sqltypes
    http://www.w3.org/XML/1998/namespace
    http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/ProductModelManuInstructions
    But, I don't undertand (i) what SCHEMA COECTION is, (ii) what <xsd:schema targetNamespace=.....</xsd:complexType> are, (iii) How I can specify my "project specific" schema in the Microsoft SCHEMA COLLECTION to check my xml file.
    2) I dived in the XQuery programmimng in SSMS2012 in the last few weeks. I used the examles of Ad-Hoc XML File Query by Seth Delconte (in
    httpS://www.simple-talk.com/content/print.aspx?article=1756) in my SSMS2012. They worked. But I don't understand the (i) Importing XML data using a function, (ii) Using the XQuery contans()
    function to find substrings, (iii)Efficiency comparisons in the article.
    Please kindly help me in enlightening me to resolve the difficulties listed in 1) and 2).
    Thanks,
    Scott Chang

  • How to parse XML against XSD,DTD, etc.. locally (no internet connection) ?

    i've searched on how to parse xml against xsd,dtd,etc.. without the needs of internet connection..
    but unfortunately, only the xsd file can be set locally and still there needs the internet connection for the other features, properties.
    XML: GML file input from gui
    XSD: input from gui
    javax.xml
    package demo;
    import java.io.File;
    import java.io.IOException;
    import java.net.MalformedURLException;
    import java.net.URL;
    import javax.xml.XMLConstants;
    import javax.xml.transform.Source;
    import javax.xml.transform.stream.StreamSource;
    import javax.xml.validation.Schema;
    import javax.xml.validation.SchemaFactory;
    import javax.xml.validation.Validator;
    import org.xml.sax.SAXException;
    public class Sample1WithJavaxXML {
         public static void main(String[] args) {
              URL schemaFile = null;
              try {
                   //schemaFile = new URL("http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd");
                   File file0 = new File("AppSchema-C01-v1_0.xsd");
                   schemaFile = new URL(file0.toURI().toString());
              } catch (MalformedURLException e1) {
                   // TODO Auto-generated catch block
                   e1.printStackTrace();
              //Source xmlFile = new StreamSource(new File("web.xml"));
              Source xmlFile = new StreamSource(new File("C01.xml"));
              SchemaFactory schemaFactory = SchemaFactory
                  .newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
              //File file1 = new File("XMLSchema.dtd");
              //SchemaFactory schemaFactory = SchemaFactory
                   //.newInstance("javax.xml.validation.SchemaFactory:XMLSchema.dtd");
              Schema schema = null;
              try {
                   schema = schemaFactory.newSchema(schemaFile);
              } catch (SAXException e1) {
                   // TODO Auto-generated catch block
                   e1.printStackTrace();
              Validator validator = schema.newValidator();
              try {
                validator.validate(xmlFile);
                System.out.println(xmlFile.getSystemId() + " is valid");
              } catch (SAXException e) {
                System.out.println(xmlFile.getSystemId() + " is NOT valid");
                System.out.println("Reason: " + e.getLocalizedMessage());
              } catch (IOException e) {
                   // TODO Auto-generated catch block
                   e.printStackTrace();
    }Xerces
    package demo;
    import java.io.File;
    import java.util.Date;
    import org.apache.xerces.parsers.DOMParser;
    public class SchemaTest {
         private String xmlFile = "";
         private String xsdFile = "";
         public SchemaTest(String xmlFile, String xsdFile) {
              this.xmlFile = xmlFile;
              this.xsdFile = xsdFile;
         public static void main (String args[]) {
              File file0 = new File("AppSchema-C01-v1_0.xsd");
              String xsd = file0.toURI().toString();
              SchemaTest testXml = new SchemaTest("C01.xml",xsd);
              testXml.process();
         public void process() {
              File docFile = new File(xmlFile);
              DOMParser parser = new DOMParser();
              try {
                   parser.setFeature("http://xml.org/sax/features/validation", true);
                   parser.setFeature("http://apache.org/xml/features/validation/schema", true);
                   parser.setProperty("http://apache.org/xml/properties/schema/external-noNamespaceSchemaLocation",
                             xsdFile);
                   ErrorChecker errors = new ErrorChecker();
                   parser.setErrorHandler(errors);
                   System.out.println(new Date().toString() + " START");
                   parser.parse(docFile.toString());
              } catch (Exception e) {
                   System.out.print("Problem parsing the file.");
                   System.out.println("Error: " + e);
                   System.out.println(new Date().toString() + " ERROR");
                   return;
              System.out.println(new Date().toString() + " END");
    }

    Thanks a lot Sir DrClap..
    I tried to use and implement the org.w3c.dom.ls.LSResourceResolver Interface which is based on the SAX2 EntityResolver.
    please give comments the way I implement it. Here's the code:
    LSResourceResolver Implementation
    import org.w3c.dom.ls.LSInput;
    import org.w3c.dom.ls.LSResourceResolver;
    import abc.xml.XsdConstant.Path.DTD;
    import abc.xml.XsdConstant.Path.XSD;
    public class LSResourceResolverImpl implements LSResourceResolver {
         public LSResourceResolverImpl() {
          * {@inheritDoc}
         @Override
         public LSInput resolveResource(String type, String namespaceURI, String publicId, String systemId, String baseURI) {
              ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
              LSInput input = new LSInputImpl(publicId, systemId, baseURI);
              if ("http://www.w3.org/2001/xml.xsd".equals(systemId)) {
                   input.setByteStream(classLoader.getResourceAsStream(XSD.XML));
              } else if (XsdConstant.PUBLIC_ID_XMLSCHEMA.equals(publicId)) {
                   input.setByteStream(classLoader.getResourceAsStream(DTD.XML_SCHEMA));
              } else if (XsdConstant.PUBLIC_ID_DATATYPES.equals(publicId)) {
                   input.setByteStream(classLoader.getResourceAsStream(DTD.DATATYPES));
              return input;
    }I also implement org.w3c.dom.ls.LSInput
    import java.io.InputStream;
    import java.io.Reader;
    import org.w3c.dom.ls.LSInput;
    public class LSInputImpl implements LSInput {
         private String publicId;
         private String systemId;
         private String baseURI;
         private InputStream byteStream;
         private String stringData;
         public LSInputImpl(String publicId, String systemId, String baseURI) {
              super();
              this.publicId = publicId;
              this.systemId = systemId;
              this.baseURI = baseURI;
         //getters & setters
    }Then, here's the usage/application:
    I create XMLChecker class (SchemaFactory implementation is Xerces)
    import java.io.File;
    import java.io.IOException;
    import java.util.ArrayList;
    import java.util.List;
    import javax.xml.XMLConstants;
    import javax.xml.stream.FactoryConfigurationError;
    import javax.xml.transform.Source;
    import javax.xml.transform.stream.StreamSource;
    import javax.xml.validation.Schema;
    import javax.xml.validation.SchemaFactory;
    import javax.xml.validation.Validator;
    import org.xml.sax.ErrorHandler;
    import org.xml.sax.SAXException;
    import org.xml.sax.SAXParseException;
    import abc.xml.XsdConstant.Path.XSD;
    public class XMLChecker {
         private ErrorMessage errorMessage = new ErrorMessage();
         public boolean validate(String filePath){
              final ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
              List<Source> schemas = new ArrayList<Source>();
              schemas.add(new StreamSource(classLoader.getResourceAsStream(XSD.XML_SCHEMA)));
              schemas.add(new StreamSource(classLoader.getResourceAsStream(XSD.XLINKS)));
              schemas.add(new StreamSource(classLoader.getResourceAsStream("abc/xml/AppSchema.xsd")));
              SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
              schemaFactory.setResourceResolver(new LSResourceResolverImpl());
              try {
                   Schema schema = schemaFactory.newSchema(schemas.toArray(new Source[schemas.size()]));
                   Validator validator = schema.newValidator();
                   validator.setErrorHandler(new ErrorHandler() {
                        @Override
                        public void error(SAXParseException e) throws SAXException {
                             errorMessage.setErrorMessage(e.getMessage());
                             errorMessage.setLineNumber(e.getLineNumber());
                             errorMessage.setColumnNumber(e.getLineNumber());
                             throw e;
                        @Override
                        public void fatalError(SAXParseException e) throws SAXException {
                             errorMessage.setErrorMessage(e.getMessage());
                             errorMessage.setLineNumber(e.getLineNumber());
                             errorMessage.setColumnNumber(e.getLineNumber());
                             throw e;
                        @Override
                        public void warning(SAXParseException e) throws SAXException {
                             errorMessage.setErrorMessage(e.getMessage());
                             errorMessage.setLineNumber(e.getLineNumber());
                             errorMessage.setColumnNumber(e.getLineNumber());
                             throw e;
                   StreamSource source = new StreamSource(new File(filePath));
                   validator.validate(source);
              } catch (SAXParseException e) {
                   return false;
              } catch (SAXException e) {
                   errorMessage.setErrorMessage(e.getMessage());
                   return false;
              } catch (FactoryConfigurationError e) {
                   errorMessage.setErrorMessage(e.getMessage());
                   return false;
              } catch (IOException e) {
                   errorMessage.setErrorMessage(e.getMessage());
                   return false;
              return true;
         public ErrorMessage getErrorMessage() {
              return errorMessage;
    }Edited by: erossy on Aug 31, 2010 1:56 AM

  • Yes, I want to create object-relational schema from DTD.

    Thank you for reply~~
    I want to create object-relational schema from DTD using object type or collections as mentioned.
    In reply, it is impossible.
    But, I read Oracle supports storing an XML document with object-relation. I executed storing sample, but I had to create schema manually.
    Is it really impossible to create OR schema from DTD automatically?

    Yes. You need to create your database schema before insert XML data to it.

  • JAXB 1.3 can't parse W3 SOAP 2003-05 envelope XML schema

    Hello,
    I was trying to use JAXB to parse the MMAP schema from the SMS Forum
    (http://www.smsforum.net/schemas/mmap/v1.0/mmap.xsd). I finally
    tracked it down to XJC choking on the included SOAP envelope schema's
    use of the xml:lang attribute for a tag called reasontext. Here's the
    pared-down test case:
    C:\java\src\baz>%JWSDP_HOME%\jaxb\bin\xjc.bat http://www.w3.org/2003/05/soap-envelope/soap-envelope.xsd
    %JWSDP_HOME%\jaxb\bin\xjc.bat http://www.w3.org/2003/05/soap-envelope/soap-envelope.xsd
    parsing a schema...
    [ERROR] src-resolve: Cannot resolve the name 'xml:lang' to a(n) attribute declaration component.
      line 97 of soap-envelope.xsd
    [ERROR] src-ct.0.1: Complex Type Definition Representation Error for type 'reasontext'.  Element 'attribute' is invalid, misplaced, or occurs too often.
      line 97 of soap-envelope.xsd
    Failed to parse a schema.
    C:\java\src\baz>I believe that the relevant portions of the schemas and namespaces in
    question are:
    http://www.w3.org/2003/05/soap-envelope/soap-envelope.xsd
    <xs:complexType name="reasontext">
    <xs:simpleContent>
    <xs:extension base="xs:string">
    <xs:attribute ref="xml:lang" use="required" />
    </xs:extension>
    </xs:simpleContent>
    </xs:complexType>http://www.w3.org/2001/XMLSchema.xsd
    <xs:complexType name="attribute" mixed="false">
    <xs:complexContent>
    <xs:extension base="xs:annotated">
    <xs:sequence>
    <xs:element name="simpleType" minOccurs="0" type="xs:localSimpleType" />
    </xs:sequence>
    <xs:attributeGroup ref="xs:defRef" />
    <xs:attribute name="type" type="xs:QName" />
    <xs:attribute name="use" use="optional" default="optional">
    <xs:simpleType>
    <xs:restriction base="xs:NMTOKEN">
    <xs:enumeration value="prohibited" />
    <xs:enumeration value="optional" />
    <xs:enumeration value="required" />
    </xs:restriction>
    </xs:simpleType>
    </xs:attribute>
    <xs:attribute name="default" type="xs:string" />
    <xs:attribute name="fixed" type="xs:string" />
    <xs:attribute name="form" type="xs:formChoice" />
    </xs:extension>
    </xs:complexContent>
    </xs:complexType>http://www.w3.org/2001/XMLSchema.xsd
    <xs:attributeGroup name="defRef">
    <xs:annotation>
    <xs:documentation>for element, group and attributeGroup, which both define and reference</xs:documentation>
    </xs:annotation>
    <xs:attribute name="name" type="xs:NCName" />
    <xs:attribute name="ref" type="xs:QName" />
    </xs:attributeGroup>http://www.w3.org/XML/1998/namespace
    The namespace whose name is http://www.w3.org/XML/1998/namespace is
    bound by definition to the prefix xml: according to Namespaces in XML,
    W3C Recommendation 14 Jan 1999. Note that unlike all other XML
    namespaces, both the name and the prefix are specified; i.e., if you
    want XML 1.0 processors to recognize this namespace, you must use the
    reserved prefix xml:.
    xml:lang and xml:space
    As of the last update of this document, the XML 1.0 Specification
    defines two attribute names in this namespace:
    xml:lang
    Designed for identifying the human language used in the scope of the
    element to which it's attached.
    .I'm no XML schema expert, but it looks to me like "name" and "ref"
    are both valid attributes for an <xs:attribute> tag and that the XML
    namespace standard requires XML processors to recognize the xml:lang
    attribute. Hence, this appears to me to be a bug in JAXB.
    A secondary bug is that the original error message left the name of
    the offending included schema blank:
    C:\java\src\foo>d:\java\jwsdp\jwsdp-1.3\jaxb\bin\xjc.bat http://www.smsforum.net/schemas/mmap/v1.0/mmap.xsd
    parsing a schema...
    [ERROR] src-resolve: Cannot resolve the name 'xml:lang' to a(n) attribute declaration component.
      line 97 of
    [ERROR] src-ct.0.1: Complex Type Definition Representation Error for type 'reasontext'.  Element 'attribute' is invalid, misplaced, or occurs too often.
      line 97 of
    Failed to parse a schema.
    C:\java\src\foo>In case it helps with problem diagnosis, I'm running with J2SDK 1.4.2
    and have copied the endorsed jar files into the JRE lib as instructured
    with JAXB:
    C:\java\src\baz>java -version
    java -version
    java version "1.4.2"
    Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2-b28)
    Java HotSpot(TM) Client VM (build 1.4.2-b28, mixed mode)
    C:\java\src\baz>dir %JAVA_HOME%\jre\lib\endorsed
    dir %JAVA_HOME%\jre\lib\endorsed
    Volume in drive D has no label.
    Volume Serial Number is 70AE-6E52
    Directory of D:\java\j2se\j2sdk1.4.2\jre\lib\endorsed
    03/31/2004  09:41 AM    <DIR>          .
    03/31/2004  09:41 AM    <DIR>          ..
    03/29/2004  01:28 PM            56,619 dom.jar
    03/29/2004  01:28 PM            60,963 sax.jar
    03/29/2004  01:28 PM         2,823,241 xalan.jar
    03/29/2004  01:28 PM         2,667,618 xercesImpl.jar
    10/10/2003  06:36 PM         1,379,810 xsltc.jar
                   6 File(s)      6,989,573 bytes
                   2 Dir(s)   7,889,731,584 bytes free
    C:\java\src\baz>I'm quite interested in the resolution of this issue as I'm stopped in
    my tracks on progress here. Help with resolution, whether in JAXB or
    my usage of it, will be much appreciated. I did a search of existing
    issues but didn't notice a duplicate. Thanks in advance.

    I have also come across a similar problem with validating an xml file with an xml:lang attribute. It seems to be common across the schema validation and dtd validation. I get the following error with both schema and dtd validation:
    Validation Error Msg (0): unexpected attribute "xml:lang"
    Validation Error Location (0): FreeFormText
    The test file extract looks like this:
    <FreeFormText xml:lang="EN">Pelle</FreeFormText>
    The schema defines the node as:
    <xs:complexType name="FreeFormText">
              <xs:simpleContent>
                   <xs:extension base="FreeFormTextType">
                        <xs:attribute name="lang" type="xs:language"/>
                   </xs:extension>
              </xs:simpleContent>
    </xs:complexType>
    and the dtd defines the node as:
    <!ELEMENT FreeFormText
         (#PCDATA)>
    <!ATTLIST FreeFormText xml:lang CDATA #IMPLIED >
    This looks like a bug in JAXB to me aswell. Any help on it would be much appreciated as i am also stuck.

  • JAXP API provides no way to enable XML Schema validation mode

    I am evaluating XDK 9.2.0.5.0 for Java and have encountered another
    problem with XML Schema support when using the JAXP API.
    Using the classes in oracle.xml.jaxp.*, it appears to be impossible to
    enable XML Schema validation mode. I can set the schema object, but
    the parser does not use it for validation.
    If I use DOMParser directly, I can call the setValidationMode(int)
    method to turn on schema validation mode. There is no equivalient
    means to enable XML Schema validation when using the JAXP API.
    Test case for JAXP API:
    === begin OracleJAXPSchemaTest.java ======
    package dfranklin;
    import java.io.*;
    import javax.xml.parsers.*;
    import javax.xml.transform.*;
    import javax.xml.transform.dom.*;
    import javax.xml.transform.stream.*;
    import oracle.xml.parser.schema.XMLSchema;
    import oracle.xml.parser.schema.XSDBuilder;
    import org.w3c.dom.*;
    import org.xml.sax.*;
    public class OracleJAXPSchemaTest
    private final static String xsd = ""
    +"<xsd:schema xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" targetNamespace=\"urn:dfranklin:test\">"
    +" <xsd:element name=\"amount\" type=\"xsd:integer\"/>"
    +"</xsd:schema>";
    private final static String xml =
    "<amount xmlns=\"urn:dfranklin:test\">1</amount>";
    public static void main(String[] args)
    throws Exception
    System.setProperty("javax.xml.parsers.DocumentBuilderFactory",
              "oracle.xml.jaxp.JXDocumentBuilderFactory");
    new OracleJAXPSchemaTest().run();
    public void run()
    throws Exception
    DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
    dbf.setValidating(true);
    dbf.setNamespaceAware(true);
    XMLSchema xmlSchema = buildXMLSchema(new StringReader(xsd));
    dbf.setAttribute("oracle.xml.parser.XMLParser.SchemaObject",
              xmlSchema);
    DocumentBuilder docbldr = dbf.newDocumentBuilder();
    Document doc = docbldr.parse(new InputSource(new StringReader(xml)));
    print(doc);
    private XMLSchema buildXMLSchema(Reader xsdin)
    throws Exception
    XSDBuilder xsdBuilder = new XSDBuilder();
    XMLSchema xmlSchema = (XMLSchema)xsdBuilder.build(xsdin, null);
    return xmlSchema;
    private void print(Document doc)
    throws
    javax.xml.transform.TransformerConfigurationException,
    javax.xml.transform.TransformerException
    Transformer xformer = TransformerFactory.newInstance().newTransformer();
    xformer.transform(new DOMSource(doc), new StreamResult(System.out));
    System.out.println();
    === end OracleJAXPSchemaTest.java ======
    Running that program:
    java dfranklin.OracleJAXPSchemaTest
    produces this output
    Exception in thread "main" oracle.xml.parser.v2.XMLParseException: Element 'amount' used but not declared.
    at oracle.xml.parser.v2.XMLError.flushErrors(XMLError.java:148)
    at oracle.xml.parser.v2.NonValidatingParser.parseDocument(NonValidatingParser.java:269)
    at oracle.xml.parser.v2.XMLParser.parse(XMLParser.java:149)
    at oracle.xml.jaxp.JXDocumentBuilder.parse(JXDocumentBuilder.java:96)
    at dfranklin.OracleJAXPSchemaTest.run(OracleJAXPSchemaTest.java:40)
    at dfranklin.OracleJAXPSchemaTest.main(OracleJAXPSchemaTest.java:27)
    This shows that the parser is not using the XML Schema to validate the
    document. I think it's expecting to find a DTD.
    Here is the equivalent program using DOMParser directly, and setting
    validation mode to SCHEMA_VALIDATION.
    === begin OracleParserTest.java ====
    package dfranklin;
    import java.io.*;
    import javax.xml.transform.*;
    import javax.xml.transform.dom.*;
    import javax.xml.transform.stream.*;
    import oracle.xml.parser.schema.XMLSchema;
    import oracle.xml.parser.schema.XSDBuilder;
    import oracle.xml.parser.v2.DOMParser;
    import oracle.xml.parser.v2.XMLParser;
    import org.w3c.dom.*;
    import org.xml.sax.*;
    public class OracleParserTest
    private final static String xsd = ""
    +"<xsd:schema xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" targetNamespace=\"urn:dfranklin:test\">"
    +" <xsd:element name=\"amount\" type=\"xsd:integer\"/>"
    +"</xsd:schema>";
    private final static String xml =
    "<amount xmlns=\"urn:dfranklin:test\">1</amount>";
    public static void main(String[] args)
    throws Exception
    new OracleParserTest().run();
    public void run()
    throws Exception
    DOMParser dp = new DOMParser();
    XMLSchema xmlSchema = buildXMLSchema(new StringReader(xsd));
    dp.setXMLSchema(xmlSchema);
    dp.setValidationMode(XMLParser.SCHEMA_VALIDATION);
    dp.parse(new InputSource(new StringReader(xml)));
    Document doc = dp.getDocument();
    print(doc);
    private XMLSchema buildXMLSchema(Reader xsdin)
    throws Exception
    XSDBuilder xsdBuilder = new XSDBuilder();
    XMLSchema xmlSchema = (XMLSchema)xsdBuilder.build(xsdin, null);
    return xmlSchema;
    private void print(Document doc)
    throws
    javax.xml.transform.TransformerConfigurationException,
    javax.xml.transform.TransformerException
    Transformer xformer = TransformerFactory.newInstance().newTransformer();
    xformer.transform(new DOMSource(doc), new StreamResult(System.out));
    System.out.println();
    === end OracleParserTest.java ====
    Running that program
    java dfranklin.OracleParserTest
    produces this output
    <?xml version = '1.0'?>
    <amount xmlns="urn:dfranklin:test">1</amount>
    In this case, the parser has validated the document.
    I also tried this with version 10.1.0.0.0 beta, and got the same
    error.
    Darin Franklin

    Thanks for posting that. I tried that code and still got my problem. The big difference is that I'm reading a group of XML files each of which uses a large number of schema files. There are over 50 schema files organized so they can be included as needed. Each of the XML files has a noNamespaceSchemaLocation attribute specifying one of the ten top schma files, that includes many others.
    However, I did solve the problem. I added one line --
           saxb.setFeature( "http://apache.org/xml/features/validation/schema",
                    true);
            // next line is new
            saxb.setProperty( JAXPConstants.JAXP_SCHEMA_LANGUAGE,
                    JAXPConstants.W3C_XML_SCHEMA );after the setFeature to turn on schema validation.
    (It needs an import org.apache.xerces.jaxp.JAXPConstants; statement.)
    Note:With the feature set to true and the setProperty commented out, the EntityResolver is called at construction tiem, and for each schema file, but each element is flagged as needing to be declared.
    With the feature commented out, and the setProperty in place, the EntityResolver is not called, and there is no validation performed. (I added invalid content to one of the files and there were no errors listed.)
    With both the setFeature and the setProperty in place, however, I get the calls from the EntityResolver indicating that it is processing the schema files, and for the good files, I get no errror, but for the bad file, I get an error indicating a bad validation.
    Now I can make the EntityResolver quiet and get what I wanted. Maybe there are other ways to do this, but I've got one that works. :-)
    Thanks to all who have helped.
    Dave Patterson

Maybe you are looking for