Can't validate against XML Schema take 2

Hi,
A few weeks ago I posted a message asking how an XML Schema file should be deployed
in a web application. During 15 days I recived a lot of replies to questions I
didn't ask but none to the question I asked. I recall that the XML Schema file
is deployed with the web application in WEB-INF. I tried also WEB-INF/classes
and WEB_INF/lib. The XML SChema file is not found. So I'm asking again: how is
one supposed to deploy an XML Schema file in a Web application ?
Kind regards,
Nicolas DUMINIL

Hi :-)
Yes it does, in the DomHandler.java it serializes to XML then does the
reparse with validation.
BTW, I realized that I left out of the zip the xsd file. It is
attached. Note also the bar.xml is using this schema from
http://localhost
You also have another alternative: employ a parser-specific extension to
do the revalidation. Xerces' extension appears to be early support for
nonfinal DOM Level 3, which supports this as part of "normalizing" a DOM
tree. See http://xml.apache.org/xerces2-j/faq-dom.html#faq-7.
Good luck in your continuing efforts,
Bruce
Nicolas DUMINIL wrote:
>
Bruce,
The example you attached doesn't do any schema validation, as you seem thinking.
In order to do schema validation, one needs at least a schema, as an XSD file.
Or the example you provided doesn't contain any schema, at least I didn't see
any, maybe I'm blind. The example you provided is only doing parsing and, consequently,
it doesn't have anything to do with the problem I posted. Thank you for your time
but honestly, don't feel obligated to just reply anything if you don't have the
answer or you don't understand the problem.
Kind regards,
Nicolas DUMINIL
Bruce Stephens <[email protected]> wrote:
Hello,
To obtain information from our outstanding support team you need to open
a communication dialog using the support portal or email. The
newsgroups are informally maintained by volunteers (typically
development engineers), are not maintained by customer support, and
provide no guarantee for response time or problem resolution.
Attached is a simple web service example that does schema validation.
See if this works OK in your environment.
Hope this is of some value,
Bruce
Nicolas DUMINIL wrote:
I went on http://support.bea.com but there is no any usefull information.
I took
a look in the examples you suggested and I found out that it simplydoesn't have
anything to do with the problem I mentioned. My problem is validatingXML documents
against an XML Schema. As I repeted at least 10 times:
1. I know how to parse XML documents.
2. I know how to use DTDs in validating XML documents.
3. I also have all the information concerning the XML Schema validationand I
know how to configure the parser for that.
The problem I have is that my XML Schema deployed with the applicationis not
found. It i not on the CLASSPATH, it is deployed with the applicationas any application
component.
Kr,
Nicolas DUMINIL
Bruce Stephens <[email protected]> wrote:
Hello,
Since this has been an ongoing issue, the best solution at this point
may be to open a dialog with our outstanding support group:
http://support.bea.com or [email protected]
BTW, you also may want to take a quick look at the example provided:
http://dev2dev.bea.com/codelibrary/code/examples_xml.jsp
Hope this is of some value,
Bruce
Nicolas DUMINIL wrote:
Hi,
A few weeks ago I posted a message asking how an XML Schema file
should
be deployed
in a web application. During 15 days I recived a lot of replies
to
questions I
didn't ask but none to the question I asked. I recall that the XMLSchema file
is deployed with the web application in WEB-INF. I tried also WEB-INF/classes
and WEB_INF/lib. The XML SChema file is not found. So I'm asking
again:
how is
one supposed to deploy an XML Schema file in a Web application ?
Kind regards,
Nicolas DUMINIL
[simple.xsd]

Similar Messages

  • Unable to validate against XML schema-URGENT!!!!

    Hi,
    I'm new to JAXP. I've been trying to validate an XML document against a Schema. But the error I get is as following:
    java Schema org.xml.sax.SAXNotRecognizedException:
    Property: http://java.sun.com/xml/jaxp/properties/schemaLanguage
    at org.apache.crimson.parser.XMLReaderImpl.setProperty(XMLReaderImpl.java:272)
    at org.apache.crimson.jaxp.SAXParserImpl.setProperty(SAXParserImpl.java:190) at Schema.main(Schema.java:20)
    I understand that this problem is because my system is using the old default Crimson parser.
    could some one please help me out with installing and using the latest Xerces parser.
    1. I have jdk 1.4.2
    2. I have JWSDP 1.4( can the jar files there help or do I have to download the jar's from apache?)
    3. please let me know the full trouble shooting process including where should I place the jar files or how should I set the classpath.
    4. would this affect validating against a DTD(which works fine now)
    thanks in advance.
    cheers
    R43

    JAXP SAXParser produces the error
    java Schema org.xml.sax.SAXNotRecognizedException:
    Property: http://java.sun.com/xml/jaxp/properties/schemaLanguage

  • Can't get XMLto validate against a schema.

    I can't get an XML file to validate against a schema. I'm not sure if the problem is in my schema, XML file, or Java code.
    Here is the schema:
    <?xml version="1.0"?>
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
        <xs:element name="TerraFrame">
         <xs:complexType>
             <xs:element name="connection" minOccurs="1" maxOccurs="unbounded">
              <xs:complexType>
                  <xs:sequence>
                        <xs:element name="label" type="xs:string"/>
                        <xs:element name="type" type="xs:string"/>
                        <xs:element name="address" type="xs:string"/>
                  </xs:sequence>
              </xs:complexType>
             </xs:element>
         </xs:complexType>
        </xs:element>
    </xs:schema>Here is the XML file:
    <?xml version="1.0"?>
    <TerraFrame xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
         <!-- default connection -->
         <connection>
             <label>default</label>
             <type>JavaProxy</type>
             <address></address>
         </connection>
         <!-- default RMI connection -->
         <connection>
             <label>rmi_default</label>
             <type>RMIProxy</type>
             <address>//localhost/RemoteControllerService</address>
         </connection>
         <!-- default Web Service connection -->
         <connection>
             <label>web_service_default</label>
             <type>WebServiceProxy</type>
             <address>http://localhost/</address>
         </connection>
         <!-- default Java connection -->
         <connection>
             <label>java_default</label>
             <type>JavaProxy</type>
             <address></address>
         </connection>
    </TerraFrame>And finally, here is the code snippit where I'm validating:
    [EDIT:] The constants CONNECTIONS_XML_FILE and CONNECTIONS_SCHEMA_FILE just point to the XML and schema files, respectively. I have verified that these paths are correct and working.
    static final String JAXP_SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
      static final String W3C_XML_SCHEMA = "http://www.w3.org/2001/XMLSchema";
      static final String JAXP_SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource";
    public void parse()
       DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
        factory.setValidating(true);
        factory.setAttribute(JAXP_SCHEMA_LANGUAGE, W3C_XML_SCHEMA);
        factory.setAttribute(JAXP_SCHEMA_SOURCE, new File(CONNECTIONS_SCHEMA_FILE));
        DocumentBuilder builder;
        try
          builder = factory.newDocumentBuilder();
          builder.setErrorHandler(new XMLConnectionsErrorHandler());
          document = builder.parse(new File(CONNECTIONS_XML_FILE));
    }Any clue as to why this is failing with the following error?:
    The content of '#AnonType_TerraFrame' is invalid.  Element 'element' is invalid, misplaced, or occurs too often.Message was edited by:
    sadpanda

    I can't get an XML file to validate against a schema. I'm not sure if the problem is in my schema, XML file, or Java code.
    Here is the schema:
    <?xml version="1.0"?>
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
        <xs:element name="TerraFrame">
         <xs:complexType>
             <xs:element name="connection" minOccurs="1" maxOccurs="unbounded">
              <xs:complexType>
                  <xs:sequence>
                        <xs:element name="label" type="xs:string"/>
                        <xs:element name="type" type="xs:string"/>
                        <xs:element name="address" type="xs:string"/>
                  </xs:sequence>
              </xs:complexType>
             </xs:element>
         </xs:complexType>
        </xs:element>
    </xs:schema>Here is the XML file:
    <?xml version="1.0"?>
    <TerraFrame xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
         <!-- default connection -->
         <connection>
             <label>default</label>
             <type>JavaProxy</type>
             <address></address>
         </connection>
         <!-- default RMI connection -->
         <connection>
             <label>rmi_default</label>
             <type>RMIProxy</type>
             <address>//localhost/RemoteControllerService</address>
         </connection>
         <!-- default Web Service connection -->
         <connection>
             <label>web_service_default</label>
             <type>WebServiceProxy</type>
             <address>http://localhost/</address>
         </connection>
         <!-- default Java connection -->
         <connection>
             <label>java_default</label>
             <type>JavaProxy</type>
             <address></address>
         </connection>
    </TerraFrame>And finally, here is the code snippit where I'm validating:
    [EDIT:] The constants CONNECTIONS_XML_FILE and CONNECTIONS_SCHEMA_FILE just point to the XML and schema files, respectively. I have verified that these paths are correct and working.
    static final String JAXP_SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
      static final String W3C_XML_SCHEMA = "http://www.w3.org/2001/XMLSchema";
      static final String JAXP_SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource";
    public void parse()
       DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
        factory.setValidating(true);
        factory.setAttribute(JAXP_SCHEMA_LANGUAGE, W3C_XML_SCHEMA);
        factory.setAttribute(JAXP_SCHEMA_SOURCE, new File(CONNECTIONS_SCHEMA_FILE));
        DocumentBuilder builder;
        try
          builder = factory.newDocumentBuilder();
          builder.setErrorHandler(new XMLConnectionsErrorHandler());
          document = builder.parse(new File(CONNECTIONS_XML_FILE));
    }Any clue as to why this is failing with the following error?:
    The content of '#AnonType_TerraFrame' is invalid.  Element 'element' is invalid, misplaced, or occurs too often.Message was edited by:
    sadpanda

  • Vivado 2013.4 ERROR: [IP_Flow 19-395] Problem validating against XML schema: Invalid value format for this type spirit:order

    Hello,
    I just downloaded and installed Vivado 2013.4 on my Xubuntu 12.04 machine. But when I try to add IP from the IP catalog, as in the ug937 Lab1 step2, it fails with obscure error messages (see below).
    Here's basically what I did:
    -In the Flow Navigator, i select the IP Catalog button.
    -In the search field of the IP Catalog, I type DDS.
    -then I double-click the DDS Compiler and my error occure.
    Please Help,
    Jerome.
    [HDL 9-1061] Parsing VHDL file "/home/jmassol/Desktop/Vivado/vivado_debug/ug937/project_xsim/project_xsim.srcs/sources_1/imports/ug937/sources/sinegen_demo.vhd" into library work ["/home/jmassol/Desktop/Vivado/vivado_debug/ug937/project_xsim/project_xsim.srcs/sources_1/imports/ug937/sources/sinegen_demo.vhd":1]
    Analysis Results[IP_Flow 19-3378] Failed to create IP instance 'dds_compiler_0'. Error saving IP file.
    [IP_Flow 19-193] Failed to save BOM file '/home/jmassol/.Xil/Vivado-2683-ubuntu/coregen/dds_compiler_0/dds_compiler_0.xml'.
    [IP_Flow 19-193] Failed to save BOM file '/home/jmassol/.Xil/Vivado-2683-ubuntu/coregen/dds_compiler_0/dds_compiler_0.xml'.
    [HDL 9-1061] Parsing VHDL file "/home/jmassol/Desktop/Vivado/vivado_debug/ug937/project_xsim/project_xsim.srcs/sources_1/imports/ug937/sources/sinegen.vhd" into library work ["/home/jmassol/Desktop/Vivado/vivado_debug/ug937/project_xsim/project_xsim.srcs/sources_1/imports/ug937/sources/sinegen.vhd":1]
    [IP_Flow 19-194] Failed to save IP instance 'dds_compiler_0'.
    set_property target_language Verilog [current_project]
    [IP_Flow 19-193] Failed to save BOM file '/home/jmassol/.Xil/Vivado-2683-ubuntu/coregen/dds_compiler_0/dds_compiler_0.xml'.
    [IP_Flow 19-193] Failed to save BOM file '/home/jmassol/.Xil/Vivado-2683-ubuntu/coregen/dds_compiler_0/dds_compiler_0.xml'.
    [IP_Flow 19-395] Problem validating against XML schema: Invalid value format for this type spirit:order
    [IP_Flow 19-194] Failed to save IP instance 'dds_compiler_0'.
    [IP_Flow 19-395] Problem validating against XML schema: Invalid value format for this type spirit:order
    sources_1[IP_Flow 19-194] Failed to save IP instance 'dds_compiler_0'.
    [HDL 9-1061] Parsing VHDL file "/home/jmassol/Desktop/Vivado/vivado_debug/ug937/project_xsim/project_xsim.srcs/sources_1/imports/ug937/sources/sinegen_demo.vhd" into library work ["/home/jmassol/Desktop/Vivado/vivado_debug/ug937/project_xsim/project_xsim.srcs/sources_1/imports/ug937/sources/sinegen_demo.vhd":1]
    [IP_Flow 19-194] Failed to save IP instance 'dds_compiler_0'.
    [IP_Flow 19-194] Failed to save IP instance 'dds_compiler_0'.
    update_compile_order -fileset sim_1
    [IP_Flow 19-193] Failed to save BOM file '/home/jmassol/.Xil/Vivado-2683-ubuntu/coregen/dds_compiler_0/dds_compiler_0.xml'.
    [HDL 9-1061] Parsing VHDL file "/home/jmassol/Desktop/Vivado/vivado_debug/ug937/project_xsim/project_xsim.srcs/sources_1/imports/ug937/sources/fsm.vhd" into library work ["/home/jmassol/Desktop/Vivado/vivado_debug/ug937/project_xsim/project_xsim.srcs/sources_1/imports/ug937/sources/fsm.vhd":1]
    [IP_Flow 19-3378] Failed to create IP instance 'dds_compiler_0'. Error saving IP file.
    [IP_Flow 19-395] Problem validating against XML schema: Invalid value format for this type spirit:order
    [IP_Flow 19-3378] Failed to create IP instance 'dds_compiler_0'. Error saving IP file.
    [IP_Flow 19-395] Problem validating against XML schema: Invalid value format for this type spirit:order
    [HDL 9-1061] Parsing VHDL file "/home/jmassol/Desktop/Vivado/vivado_debug/ug937/project_xsim/project_xsim.srcs/sources_1/imports/ug937/sources/fsm.vhd" into library work ["/home/jmassol/Desktop/Vivado/vivado_debug/ug937/project_xsim/project_xsim.srcs/sources_1/imports/ug937/sources/fsm.vhd":1]
    [IP_Flow 19-395] Problem validating against XML schema: Invalid value format for this type spirit:order
    [IP_Flow 19-3378] Failed to create IP instance 'dds_compiler_0'. Error saving IP file.
    [HDL 9-1654] Analyzing Verilog file "/home/jmassol/Desktop/Vivado/vivado_debug/ug937/project_xsim/project_xsim.srcs/sources_1/imports/ug937/sim/testbench.v" into library work ["/home/jmassol/Desktop/Vivado/vivado_debug/ug937/project_xsim/project_xsim.srcs/sources_1/imports/ug937/sim/testbench.v":1]
    [IP_Flow 19-395] Problem validating against XML schema: Invalid value format for this type spirit:order
    [HDL 9-1061] Parsing VHDL file "/home/jmassol/Desktop/Vivado/vivado_debug/ug937/project_xsim/project_xsim.srcs/sources_1/imports/ug937/sources/debounce.vhd" into library work ["/home/jmassol/Desktop/Vivado/vivado_debug/ug937/project_xsim/project_xsim.srcs/sources_1/imports/ug937/sources/debounce.vhd":1]
    [IP_Flow 19-193] Failed to save BOM file '/home/jmassol/.Xil/Vivado-2683-ubuntu/coregen/dds_compiler_0/dds_compiler_0.xml'.
    [IP_Flow 19-2313] Loaded Vivado IP repository '/opt/Xilinx/Vivado/2013.4/data/ip'.
    [IP_Flow 19-395] Problem validating against XML schema: Invalid value format for this type spirit:order
    [IP_Flow 19-3378] Failed to create IP instance 'dds_compiler_0'. Error saving IP file.
    [IP_Flow 19-1704] No user IP repositories specified
    [IP_Flow 19-194] Failed to save IP instance 'dds_compiler_0'.
    [IP_Flow 19-193] Failed to save BOM file '/home/jmassol/.Xil/Vivado-2683-ubuntu/coregen/dds_compiler_0/dds_compiler_0.xml'.
    [IP_Flow 19-3378] Failed to create IP instance 'dds_compiler_0'. Error saving IP file.
    Vivado Commands[Project 1-11] Changing the constrs_type of fileset 'constrs_1' to 'XDC'.
    [IP_Flow 19-193] Failed to save BOM file '/home/jmassol/.Xil/Vivado-2683-ubuntu/coregen/dds_compiler_0/dds_compiler_0.xml'.
    [IP_Flow 19-3378] Failed to create IP instance 'dds_compiler_0'. Error saving IP file.
    [IP_Flow 19-193] Failed to save BOM file '/home/jmassol/.Xil/Vivado-2683-ubuntu/coregen/dds_compiler_0/dds_compiler_0.xml'.
    sim_1[IP_Flow 19-194] Failed to save IP instance 'dds_compiler_0'.
    [IP_Flow 19-395] Problem validating against XML schema: Invalid value format for this type spirit:order
    [HDL 9-1654] Analyzing Verilog file "/home/jmassol/Desktop/Vivado/vivado_debug/ug937/project_xsim/project_xsim.srcs/sources_1/imports/ug937/sim/testbench.v" into library work ["/home/jmassol/Desktop/Vivado/vivado_debug/ug937/project_xsim/project_xsim.srcs/sources_1/imports/ug937/sim/testbench.v":1]
    [IP_Flow 19-395] Problem validating against XML schema: Invalid value format for this type spirit:order
    [IP_Flow 19-3378] Failed to create IP instance 'dds_compiler_0'. Error saving IP file.
    [IP_Flow 19-234] Refreshing IP repositories
    [IP_Flow 19-3378] Failed to create IP instance 'dds_compiler_0'. Error saving IP file.
    [IP_Flow 19-395] Problem validating against XML schema: Invalid value format for this type spirit:order
    [IP_Flow 19-194] Failed to save IP instance 'dds_compiler_0'.
    [IP_Flow 19-193] Failed to save BOM file '/home/jmassol/.Xil/Vivado-2683-ubuntu/coregen/dds_compiler_0/dds_compiler_0.xml'.
    [IP_Flow 19-194] Failed to save IP instance 'dds_compiler_0'.
    [IP_Flow 19-395] Problem validating against XML schema: Invalid value format for this type spirit:order
    [IP_Flow 19-193] Failed to save BOM file '/home/jmassol/.Xil/Vivado-2683-ubuntu/coregen/dds_compiler_0/dds_compiler_0.xml'.
    [IP_Flow 19-194] Failed to save IP instance 'dds_compiler_0'.
    [IP_Flow 19-3378] Failed to create IP instance 'dds_compiler_0'. Error saving IP file.
    [HDL 9-1061] Parsing VHDL file "/home/jmassol/Desktop/Vivado/vivado_debug/ug937/project_xsim/project_xsim.srcs/sources_1/imports/ug937/sources/debounce.vhd" into library work ["/home/jmassol/Desktop/Vivado/vivado_debug/ug937/project_xsim/project_xsim.srcs/sources_1/imports/ug937/sources/debounce.vhd":1]
    [IP_Flow 19-3378] Failed to create IP instance 'dds_compiler_0'. Error saving IP file.
    [IP_Flow 19-194] Failed to save IP instance 'dds_compiler_0'.
    [HDL 9-1061] Parsing VHDL file "/home/jmassol/Desktop/Vivado/vivado_debug/ug937/project_xsim/project_xsim.srcs/sources_1/imports/ug937/sources/sinegen.vhd" into library work ["/home/jmassol/Desktop/Vivado/vivado_debug/ug937/project_xsim/project_xsim.srcs/sources_1/imports/ug937/sources/sinegen.vhd":1]
    set_property constrs_type XDC [current_fileset -constrset]
     

    We had the same problem when switching to Ubuntu 14.04, and there actually is a solution for it: make sure your locales are set to English.
    $> env | grep LC_*
    should only show english (or C) locales, all others are known to cause parsing errors in some numbers, usually caused by wrong string-to-float conversions (e.g. 18,29 in german is 18.29 in english). You can change the locales in the file /etc/default/localesThis is not the first time we had problems with the locale settings, Xilinx does not seem to test their software with anything else than en_US, causing obscure bugs like this one.
    HTH
    Philipp

  • How can I  refer an xml  Schema that was registred in Oracle xml DB

    How can I refer an xml Schema that was registred in Oracle xml DB, from other xml schema?
    I have the follow schema,:
    <?xml version="1.0" encoding="AL32UTF8"?>
    <xsd:schema targetNamespace="schemastipostasa.xsd"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:xdb="http://xmlns.oracle.com/xdb/XDBSchema.xsd"
    elementFormDefault="unqualified" version="1.0"
    attributeFormDefault="unqualified">
    <xsd:simpleType name="codigosType" xdb:SQLType="NUMBER(4)">
    <xsd:restriction base="xsd:positiveInteger" >
    <xsd:totalDigits value="4" />
    </xsd:restriction>
    </xsd:simpleType >
    <xsd:simpleType name="integerUnoType" xdb:SQLType="NUMBER(1)">
    <xsd:restriction base="xsd:int" >
    <xsd:totalDigits value="1" />
    </xsd:restriction>
    </xsd:simpleType>
    <xsd:simpleType name="condicionType" xdb:SQLType="VARCHAR2(1)">
    <xsd:restriction base="xsd:string">
    <xsd:enumeration value="S" >
    <xsd:annotation>
    <xsd:documentation>Condicion si es S</xsd:documentation>
    </xsd:annotation>
    </xsd:enumeration>
    <xsd:enumeration value="N" >
    <xsd:annotation>
    <xsd:documentation>Condicion no es N</xsd:documentation>
    </xsd:annotation>
    </xsd:enumeration>
    </xsd:restriction>
    </xsd:simpleType >
    </xsd:schema>
    I registred the schema written above with the folowwing pl*sql :
    DECLARE
    direc varchar2(2000);
    nombreArch BFILE;
    mens varchar2(2000);
    BEGIN
    direc:=uso_comun.pack_mail.fun_valor_param('TASA','DIR_DBSERVER');
    nombreArch:=bfilename(direc,'schemas_tipos_tasa.xsd');
    DBMS_XMLSCHEMA.registerSchema(
    SCHEMAURL => 'http://xmlns.oracle.com/tasa/schemas.tipos.tasa.xsd',
    SCHEMADOC => nombreArch,
    LOCAL => TRUE,
    CSID => nls_charset_id('AL32UTF8'));
    dbms_lob.CLOSE(nombreArch);
    dbms_output.put_line('salio sin cancelar');
    exception
    when others then
    mens:=sqlerrm;
    dbms_lob.CLOSE(nombreArch);
    rollback;
    raise_application_error (-20001,'en registro shcema='||mens);
    END;
    Then, I want to register the following schema, that mention de schema above:
    <?xml version="1.0" encoding="AL32UTF8"?>
    <xsd:schema targetNamespace="schema.repuesto.xsd"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:xdb="http://xmlns.oracle.com/xdb/XDBSchema.xsd"
    xmlns:tns="http://xmlns.oracle.com/tasa/schemas.tipos.tasa.xsd"
    elementFormDefault="qualified" version="1.0"
    attributeFormDefault="unqualified" >
    <xsd:element name="PRECIORENG" type="preciorepType" />
    <xsd:complexType name="preciorepType" >
    <xsd:sequence minOccurs="1" maxOccurs="unbounded">
    <xsd:element name="CODIGO_MARCA" type="tns:codigosType" />
    <xsd:element name="ORIGEN_PRECIO" type="tns:integerUnoType" />
    <xsd:element name="INGRESO_POR_FALTANTE" type="tns:condicionType" />
    </xsd:sequence>
    </xsd:complexType>
    </xsd:schema>
    But when a run the following script whith the same db-user:
    DECLARE
    direc varchar2(2000);
    nombreArch BFILE;
    mens varchar2(2000);
    BEGIN
    direc:=uso_comun.pack_mail.fun_valor_param('TASA','DIR_DBSERVER');
    -- nombreArch:=bfilename(direc,'prueba_schema_seis.xsd');
    nombreArch:=bfilename(direc,'Schema_repuesto_nuevo.xsd');
    DBMS_XMLSCHEMA.registerSchema(
    SCHEMAURL =>'http://xmlns.oracle.com/tasa/schema.repuesto.xsd',
    SCHEMADOC => nombreArch,
    LOCAL => TRUE,
    CSID => nls_charset_id('AL32UTF8'));
    dbms_lob.CLOSE(nombreArch);
    dbms_output.put_line('salio sin cancelar');
    --commit;
    exception
    when others then
    mens:=sqlerrm;
    dbms_lob.CLOSE(nombreArch);
    rollback;
    raise_application_error (-20001,'en registro shcema='||mens);
    END;
    tell me the error: ORA: 01031, insufficient privileges!!!!, what’s wrong??,

    Hi,
    To register schema, you require XDBADMIN system privilege granted to the user.
    Please verify this and retry.
    Rgds,
    Rakesh Tripathi

  • How can I define an XML schema for this kind of XML

    Hi, There:
    I want to generate an XML file like:
    <customer>
    </customer>
    <transaction>
    </transaction>
    <customer>
    </customer>
    which have multiple customer elements and multiple transactions as well, and they can happen in mixed sequence. Can any one give me some idea about how can I create an XML schema for this kind of xml? (<xsd:complextype> <xsd:sequence> ) seems not work)
    Thanks in advance
    David

    Use a group then make it a choice, like this;
    <xs:element name="Parent">
    <xs:complexType>
    <xs:group ref="Group" minOccurs="1" maxOccurs="unbounded" />
    </xs:complexType>
    </xs:element>
    <xs:group name="Group">
    <xs:choice>
    <xs:element ref="OptionOne" type="xs:string" />
    <xs:element ref="OptionTwo" />
    </xs:choice>
    </xs:group>
    <xs:element name="OptionOne">
    <xs:complexType>
    <xs:attribute name="name" type="xs:string" />
    <xs:attribute name="Type" type="xs:string" />
    </xs:complexType>
    </xs:element>
    <xs:element name="OptionTwo">
    <xs:complexType>
    <xs:attribute name="name" type="xs:string" />
    <xs:attribute name="Type" type="xs:string" />
    </xs:complexType>
    </xs:element>
    This allows XML like this
    <Parent>
    <OptionTwo ........ />
    <OptionOne ........ />
    <OptionTwo ........ />
    <OptionOne ........ />
    <OptionOne ........ />
    </Parent>
    HH

  • How can i export a XML Schema

    Hi!
    I'm a newbie and i've export a XML file but how can i export a XML Schema from a database?
    With best regards
    Nicole

    Hi Nicole
    I never seen a tool/package/... in the DB that generates the XML Schema for a whole DB schema.
    Anyway you can find some generation capabilities in:
    - package DBMS_XMLSCHEMA (method GENERATESCHEMA)
    - XDK's utility XSU (option -withSchema)
    Chris

  • How can we validate a XML against his external schema XSD

    Hi;
    I use the XML library for create my XML file, I’m extracting the data
    from R3 and building the XML document.
    I wish to validate this document against his schema XSD built by third party (government organization) before i transfer this data (xml file)
    to the external entity.
    In my abap program:
    ¿How can i reach this validation level and if any
    error exists then how can i get or trap the detail information?
    this is a sample file XML with the external schema reference, as you can see in this part of the code.
    <?xml version="1.0" encoding="UTF-8" ?>
    - <Comprobante xmlns="http://www.sat.gob.mx/cfd/2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sat.gob.mx/cfd/2 http://www.sat.gob.mx/sitio_internet/cfd/2/cfdv2.xsd" version="2.0" serie="A" folio="0000238" fecha="2006-09-01T19:32:03-05:00" sello="o4kAzhytaTKThSk9tbTQGg5OGacAltWZwxQPZuMg1XhfjMq5jJ0GyO7w2//bf8aTuHnbqwpkR7rIgIehGLy88Xb3Ck0EDsWZEAC1QUuqRq2iWKAnGQPS4l9s0QrJHt0Ziojjd0GQFek6BYXPdlmdTjLZ2x+J8ffYEGpIQZRB8=" noAprobacion="2755" anoAprobacion="2006" formaDePago="En una sola exhibicion" noCertificado="00001000000000806462" condicionesDePago="Neto a 30 días sin DPPP" subTotal="2531.99" descuento="0.00" total="2912.90" tipoDeComprobante="ingreso">
      <DomicilioFiscal calle="AVE. UNIVERSIDAD" noExterior="992 NTE." colonia="COL. CUAUHTEMOC" municipio="SAN NICOLAS DE LOS GARZA" estado="N.L." pais="MEXICO
    We are using SAP R/3 46C
    Thanks in Advance for your help.
    Alejandro Pérez

    Hi, Alejandro
    Did you found something on SAP side in order to generated this XML.
    Currently I´m trying to find out some on SAP but nothing at this moment.
    The company that I´m working needs to implement "Factura Electonica" also.
    Probably we will use external broker to do this for us, and we will send just Idoc to the broker.
    Please, let me know your progress on SAP side.
    Regards, Fabio

  • Validate XML against Xml Schema using JDBC (thin_driver)

    hi all,
    i have a table with a xmltype-column (XmlSchema Support) and i wonna load(and validate) xml-data( as String) in the xmltype-column.
    some thing like this :
    int count=1;
    String SQLTEXT=null;
    Statement stmt=null;
    ResultSet rs =null;
    //while(count<=1000)
    try
    stmt = connection.createStatement();
    rs = stmt.executeQuery("select SEQ_patxmlschema_ID.NEXTVAL from patxmlschema");
    if(rs.next())
    id =rs.getLong(1);
    System.out.println(id);
    stmt.close();
    stmt=null;
    rs.close();
    SQLTEXT = "INSERT INTO patxmlschema(id, patID, name, status, patInfo)"+
              "VALUES(?,?,?,?,XMLType(?))";
    pStmt = connection.prepareStatement(SQLTEXT);
    long patID = random.nextInt(30000);
    System.out.println("patId: "+ patID);
    String name = RandomStringUtils.random(6,true,false);
    System.out.println("lastname: "+ name);
    String firstname=RandomStringUtils.random(5,true,false);
    System.out.println("firstname: "+ firstname);
    String status=RandomStringUtils.random(8,true,false);
    System.out.println("status: "+ status);
    String street=RandomStringUtils.random(6,true,false);
    System.out.println("street: "+ street);
    String zip=RandomStringUtils.random(5,false,true);
    System.out.println("zip: "+ zip);
    String city=RandomStringUtils.random(6,true,false);
    System.out.println("city: "+ city);
    String phone=RandomStringUtils.random(8,false,true);
    String email=RandomStringUtils.random(15,true,false);
    String state=RandomStringUtils.random(6,true,false);
    String country=RandomStringUtils.random(6,true,false);
    System.out.println("country: "+ country);
    xmldoc=
         "<Patient>"+                    "xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'"+          "xsi:noNamespaceSchemaLocation='http://olidong.net/patInfo.xsd'>"+
         "<Address>"+                         "<street>"+street+"</street>"+                         "<city>"+city+"</city>"+                    "<zip>"+zip+"</zip>"+
         "<state>"+state+"</state>"+                    "<country>"+country+"</country>"+
         "</Address>"+               "<phone>"+phone+"</phone>"+                    "<email>"+email+"</email>"+
         "</Patient>";
         pStmt.setLong(1, id);
         pStmt.setLong(2, patID);
         pStmt.setString(3, name);
         pStmt.setString(4, status);
         pStmt.setString(5, xmldoc);
         pStmt.executeUpdate();
    pStmt.close();
         pStmt=null;
         count++;
         //connection=null;
    catch(Exception e){
    e.printStackTrace();
    can you help me?
    Olidong

    hi Avi,
    my xml doc is valid. with the sqlplus the are no problem or error. tryng the same with jddbc(thin driver) i got this error.
    i don´t know, may be jdbc don´t support xml schema support insertion.
    i got this sample:
    DECLARE
    doc VARCHAR2(2000) :=
    '<schema
    targetNamespace="http://xmlns.oracle.com/xdb/documentation/purchaseOrder.xsd"
    xmlns:po="http://xmlns.oracle.com/xdb/documentation/purchaseOrder.xsd"
    xmlns="http://www.w3.org/2001/XMLSchema"
    elementFormDefault="qualified">
    <complexType name="PurchaseOrderType">
    <sequence>
    <element name="PONum" type="decimal"/>
    <element name="Company">
    <simpleType>
    <restriction base="string">
    <maxLength value="100"/>
    </restriction>
    </simpleType>
    </element>
    <element name="Item" maxOccurs="1000">
    <complexType>
    <sequence>
    <element name="Part">
    <simpleType>
    <restriction base="string">
    <maxLength value="20"/>
    </restriction>
    </simpleType>
    </element>
    <element name="Price" type="float"/>
    </sequence>
    </complexType>
    </element>
    </sequence>
    </complexType>
    <element name="PurchaseOrder" type="po:PurchaseOrderType"/>
    </schema>';
    BEGIN
    DBMS_XMLSCHEMA.registerSchema(
    'http://xmlns.oracle.com/xdb/documentation/purchaseOrder.xsd', doc);
    END;
    CREATE TABLE mypurchaseorders OF XMLType
    XMLSchema "http://xmlns.oracle.com/xdb/documentation/purchaseOrder.xsd"
    ELEMENT "PurchaseOrder"
    VARRAY xmldata."Item" STORE AS TABLE item_nested;
    INSERT INTO mypurchaseorders
    VALUES(
    XMLType(
    '<PurchaseOrder
    xmlns="http://xmlns.oracle.com/xdb/documentation/purchaseOrder.xsd"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation
    = "http://xmlns.oracle.com/xdb/documentation/purchaseOrder.xsd
    http://xmlns.oracle.com/xdb/documentation/purchaseOrder.xsd">
    <PONum>1001</PONum>
    <Company>IBM</Company>
    <Item>
    <Part>DB2 v9 Set</Part>
    <Price>2550</Price>
    </Item>
    <Item>
    <Part>8i Doc Set</Part>
    <Price>350</Price>
    </Item>
    </PurchaseOrder>'));
    with the sqlplus the are no error
    but insert with java jdbc:
    SQLTEXT = "INSERT INTO mypurchaseorders VALUES(XMLType(?))";
    String xmldoc= "<PurchaseOrder"+
    "xmlns='http://xmlns.oracle.com/xdb/documentation/purchaseOrder.xsd'" +
    "xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'" +
    "xsi:schemaLocation= 'http://xmlns.oracle.com/xdb/documentation/purchaseOrder.xsd'"+
    "'http://xmlns.oracle.com/xdb/documentation/purchaseOrder.xsd'>"+
    "<PONum>1001</PONum>"+
    "<Company>IBM</Company>"+
    "<Item> "+
    "<Part>DB2 v9 Set</Part>"+
    "<Price>2550</Price>"+
    "</Item>"+
    "<Item>"+
    "<Part>8i Doc Set</Part>"+
    "<Price>350</Price>"+
    "</Item>"+
    "</PurchaseOrder>";
    pStmt.setString(1, xmldoc);
    i got this error
    java.sql.SQLException: ORA-31011: XML parsing failed
    ORA-19202: Error occurred in XML processing
    LPX-00240: element-start tag is not well formed
    Error at line 1
    ORA-06512: at "SYS.XMLTYPE", line 301
    ORA-06512: at line 1
         at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
         at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:331)
         at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:288)
         at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:743)
         at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:213)
         at oracle.jdbc.driver.T4CPreparedStatement.executeForRows(T4CPreparedStatement.java:952)
         at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1160)
         at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3285)
         at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:3368)
         at xml_tab.doInsert(xml_tab.java:118)
         at xml_tab.main(xml_tab.java:138)
    could you help me?
    Olidong

  • How can i validate an xml against an dtd which are both in a clob ?

    Hi,
    I think my question says it all. I would like to validate
    my xml which has been stored into a clob against a dtd
    also stored in a clob. It has to be done with the xdk for plsql.
    Regards,
    Geert.

    Hi,
    I think my question says it all. I would like to validate
    my xml which has been stored into a clob against a dtd
    also stored in a clob. It has to be done with the xdk for plsql.
    Regards,
    Geert.

  • Can I validate an XML file using an external DTD

    Hi,
    I'm trying to use an external DTD to validate an XML
    file (which does not refer to this DTD). The java docs that ship
    with the XML parser aren't clear on how exactly to do this (or
    whether it can be done). I'd appreciate any advice on how I
    should perform this operation.
    Here's what I'm doing right now.
    1) The Java file
    import oracle.xml.parser.v2.*;
    public class ParseWithExternalDTD
    public static void main(String args[]) throws Exception
    DOMParser dp=new DOMParser();
    dp.parseDTD
    ("file:d:/jdk1.2/sample/test/family.DTD","family");
    DTD dtd=dp.getDoctype();
    dp.setDoctype(dtd);
    dp.parse("file:d:/jdk1.2/sample/test/family.xml");
    System.out.println("Finished with no errors!");
    2) The family.DTD file
    <!ELEMENT family (member*)>
    <!ATTLIST family lastname CDATA #REQUIRED>
    <!ELEMENT member (#PCDATA)>
    <!ATTLIST member memberid ID #REQUIRED>
    <!ATTLIST member dad IDREF #IMPLIED>
    <!ATTLIST member mom IDREF #IMPLIED>
    3) The family.xml file
    <?xml version="1.0" standalone="no"?>
    <family lastname="Smith">
    <TagToFoilParserValidation>
    </TagToFoilParserValidation>
    <member memberid="m1">Sarah</member>
    <member memberid="m2">Bob</member>
    <member memberid="m3" mom="m1" dad="m2">Joanne</member>
    <member memberid="m4" mom="m1" dad="m2">Jim</member>
    </family>
    4) The output
    Finished with no errors!
    As you can see, the DOMParser failed to validate the family.xml
    file against the family dtd otherwise, it would have reported a
    validation error when it came across the
    TagToFoilParserValidation.
    Any insight as to what I'm doing wrong would be much appreciated.
    Sincerely,
    Keki
    Project Iona
    Manufacturing Applications
    Oracle Corporation
    The views and opinions expressed here are
    my own and do not reflect the views and
    opinions of Oracle Corporation
    null

    Keki Burjorjee (Oracle) (guest) wrote:
    : 2 further questions related to this issue.
    : 1) Say I am using XSLT to transform A.xml into B.xml, and I
    : want to embed a reference to B.dtd within the B.xml file. Is
    : there an XSLT command which will allow me to do this?
    : 2) Is it possible for your team to give me a mechanism whereby
    I
    : can preset the xml parser to validate the next xml file (or
    : inputstream) it receives against a particular DTD? This scheme
    : does not require the dtd to be present within the XML file
    : Thanks,
    : - Keki
    : Oracle XML Team wrote:
    : : What you are doing wrong is not including a reference to the
    : : applicable DTD in your XML document. Without it there is no
    : way
    : : that the parser knows what to validate against. Including
    the
    : : reference is the XML standard way of specifying an external
    : : DTD. Otherwise you need to embed the DTD in your XML
    Document.
    : : Oracle XML Team
    : : http://technet.oracle.com
    : : Oracle Technology Network
    : : Keki Burjorjee (guest) wrote:
    : : : Hi,
    : : : I'm trying to use an external DTD to validate an XML
    : : : file (which does not refer to this DTD). The java docs that
    : : ship
    : : : with the XML parser aren't clear on how exactly to do this
    : (or
    : : : whether it can be done). I'd appreciate any advice on how I
    : : : should perform this operation.
    : : : Here's what I'm doing right now.
    : : : 1) The Java file
    : : : import oracle.xml.parser.v2.*;
    : : : public class ParseWithExternalDTD
    : : : public static void main(String args[]) throws Exception
    : : : DOMParser dp=new DOMParser();
    : : : dp.parseDTD
    : : : ("file:d:/jdk1.2/sample/test/family.DTD","family");
    : : : DTD dtd=dp.getDoctype();
    : : : dp.setDoctype(dtd);
    : : : dp.parse("file:d:/jdk1.2/sample/test/family.xml");
    : : : System.out.println("Finished with no errors!");
    : : : 2) The family.DTD file
    : : : <!ELEMENT family (member*)>
    : : : <!ATTLIST family lastname CDATA #REQUIRED>
    : : : <!ELEMENT member (#PCDATA)>
    : : : <!ATTLIST member memberid ID #REQUIRED>
    : : : <!ATTLIST member dad IDREF #IMPLIED>
    : : : <!ATTLIST member mom IDREF #IMPLIED>
    : : : 3) The family.xml file
    : : : <?xml version="1.0" standalone="no"?>
    : : : <family lastname="Smith">
    : : : <TagToFoilParserValidation>
    : : : </TagToFoilParserValidation>
    : : : <member memberid="m1">Sarah</member>
    : : : <member memberid="m2">Bob</member>
    : : : <member memberid="m3" mom="m1" dad="m2">Joanne</member>
    : : : <member memberid="m4" mom="m1" dad="m2">Jim</member>
    : : : </family>
    : : : 4) The output
    : : : Finished with no errors!
    : : : As you can see, the DOMParser failed to validate the
    : : family.xml
    : : : file against the family dtd otherwise, it would have
    : reported
    : : a
    : : : validation error when it came across the
    : : : TagToFoilParserValidation.
    : : : Any insight as to what I'm doing wrong would be much
    : : appreciated.
    : : : Sincerely,
    : : : Keki
    : : : Project Iona
    : : : Manufacturing Applications
    : : : Oracle Corporation
    : : : The views and opinions expressed here are
    : : : my own and do not reflect the views and
    : : : opinions of Oracle Corporation
    1) No XSLT commands exist that allow you to embed a DTD while
    doing the transformation.
    2) You can use the setDocType() method in the parser, to set a
    DTD based on which the XML document will be validated. The
    parseDTD() method allows you to parse a DTD file separately and
    get a DTD object. Here is a sample code :
    DOMParser domparser = new DOMParser();
    domparser.setValidationMode(true);
    // parse the DTD file
    domparser.parseDTD(new FileReader(dtdfile));
    DTD dtd = domparser.getDocType();
    // Parse XML file - XML file will be validated based on the DTD.
    domparser.setDocType(dtd);
    domparser.parse(new FileReader(xmlfile));
    Document doc = domparser.getDocument();
    Oracle XML Team
    http://technet.oracle.com
    Oracle Technology Network
    null

  • Validating against XML Schema

    Hi,
    does someone know how to validate a XML file against
    a XSD File (XML Schema) in ABAP. Iam using the IXML Package.
    Thanks.
    Jim

    I've originally been using Xerces1_4_0, but you're right - it's xerces-2_0_0_beta4 that does the job.
    Thanks for the hint!
    Luca

  • XML instance validation against XML schema

    How can I get a reference on the error node object after
    validation against an XML schema ?
    Ex. :
    DOMParser domP = new DOMParser();
    domP.setXMLSchema(schemaDoc); // schemaDoc = ref. on an XMLSchema
    domP.setValidationMode(XMLParser.SCHEMA_VALIDATION);
    domP.parse(reader); // reader contains the XML instance data
    If an error occurred, I only get a message string. What I need is to get a reference on the node object which contains the error in order to retrieve its properties to the schema.
    I could then alert the user with a message such as :
    "Data xxx is not valid ; it must be comprised between yy and zz...".
    Did somebody solve this problem ? May I use the XMLError class to do this ?
    Thank you

    Hi Ray,
    Were you able to resolve this issue? I am encountering a very similar problem where I am not connected to the internet and it fails during the newSchema method on javax.xml.validation.SchemaFactory. I have attempted to implement the suggestions of ExtremeGardener and vidyut with no luck.
    Per ExtremeGardener's suggestion of replacing xmlns:xs="http://www.w3.org/2001/XMLSchema" with xmlns:xs="XMLSchema.xsd" and storing it locally, it gave me an error for trying to set the "xs" or "xsd" prefixes to anything other than "http://www.w3.org/2001/XMLSchema." I forget the exact error. I also tried to use my own prefix and it did not like that either.
    Per vidyut's suggestion of using a catalog resolver, I believe that I have tried that too (if I understand correctly). I created an LSResourceResolver and tied it to the SchemaFactory. I can invoke it for a namespace but that did not resolve the issue because it only invokes the resolver on an import, include, or redefine. I believe that it is trying to reach the internet due to the xmlns:xs="http://www.w3.org/2001/XMLSchema" attribute within the top-level schema element in the XSD and I know of no way to invoke it for that.
    I also created an ErrorHandler and tied it to the SchemaFactory. That shows me the errors and they are all related to the standard XML data types defined in XMLSchema.xsd. The errors that I am seeing are all of this form: "UndeclaredPrefix: Cannot resolve 'xs:string' as a QName: the prefix 'xs' is not declared."
    I am currently using the SchemaFactory in Java 1.5, but I am thinking about trying the Xerces SchemaFactory since they are not exactly the same implementation.
    Does anyone have any other suggestions? Any help you can provide would be greatly appreciated!
    Thanks,
    betzro1

  • Can't i use xml schema and oledb data connection at the same time?

    Hello to all and thanks in advance.I use xml schema and oledb data connection at the same time and the problem is that when I try to export the xml, the outcome is not what i expect.Without the oledb connection everything is ok (just the schema) and the xml complies with the schema.
    Can't i have both schema and oledb and the exported xml be as i want it?

    You can use both at the same time, but not gor Internet access if that's what you're asking.
    Now there is a thing called Link Aggregation, which combines a number of interfaces for speed/redundancy, but it really only works locally, and then only with ALL special equipment in the route, and most likely OSX Server involved.
    Sorry.

  • Simple xerces DOMParser.  Why won't this validate? Very simple, xml schema

    I have written a java program called "Validate.java" to validate an xml file. The program uses the xerces DOMParser. When I try and validate a correct .xml file with a correct schema in an .xsd file I get the following errors:
    [Error] Document is invalid: no grammar found. line 2 column 6 - name5.xml
    [Error] Document root element "name", must match DOCTYPE root "null". line 2 column 6 - name5.xmlThe XML file, the XSD file, and the Validate.java program are all in the same directory. My CLASSPATH includes xml-apis.jar, xercesImpl.jar, and xercesSamples.jar.
    Here is the xml file (name5.xml):
    <?xml version="1.0"?>
    <name
        xmlns="http://www.myOwnURL.net/name"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://www.myOwnURL.net/name name5.xsd"
        title="Mr.">
      <first>John</first>
      <middle>Fitzgerald</middle>
      <last>Doe</last>
    </name>(I saved the file in the UTF-8 encoding, which causes it to look double spaced in some text editors.)
    The schema is in the following xsd file (name5.xsd):
    <?xml version="1.0"?>
    <schema
        xmlns="http://www.w3.org/2001/XMLSchema"
        targetNamespace="http://www.myOwnURL.net/name"
        xmlns:target="http://www.myOwnURL.net/name"
        elementFormDefault="qualified">
      <element name="name">
        <complexType>
          <sequence>
            <element name="first" type="string"/>
            <element name="middle" type="string"/>
            <element name="last" type="string"/>
          </sequence>
          <attribute name="title" type="string"/>
        </complexType>
      </element>
    </schema>(Again, the file is saved in UTF-8 format.)
    Here is the code for Validate.java:
    public class Validate implements org.xml.sax.ErrorHandler
        private String instance = null;
        private int warnings = 0;
        private int errors = 0;
        private int fatalErrors = 0;
        private org.apache.xerces.parsers.DOMParser parser = new org.apache.xerces.parsers.DOMParser();
        public Validate() // constructor
            parser.setErrorHandler(this); // Set the errorHandler
        public void setInstance(String s)
            instance = s;
        public boolean doValidate()
            try
                warnings = 0;
                errors = 0;
                fatalErrors = 0;
                try
                    // Turn the validation feature on
                    parser.setFeature( "http://xml.org/sax/features/validation", true);
                    // Parse and validate
                    System.out.println("Validating source document...");
                    parser.parse(instance);
                    // We parsed... let's give some summary info of what we did
                    System.out.println("\nComplete " + warnings + " warnings " + errors + " errors " + fatalErrors + " fatal errors");
                    // Return true if we made it this far with no errors
                    return ((errors == 0) && (fatalErrors == 0));
                catch (org.xml.sax.SAXException e)
                    System.err.println("\nCould not activate validation features - " + e.getMessage());
                    return false;
            catch (Exception e)
                System.err.println("\n"+e.getMessage());
                return false;
        public void warning(org.xml.sax.SAXParseException ex)
            System.err.println("\n[Warning] " + ex.getMessage() + " line " + ex.getLineNumber()
            + " column " + ex.getColumnNumber() + " - " + instance);
            warnings++;
        public void error(org.xml.sax.SAXParseException ex)
            System.err.println("\n[Error] " + ex.getMessage() + " line " + ex.getLineNumber()
            + " column " + ex.getColumnNumber() + " - " + instance);
            errors++;
        public void fatalError(org.xml.sax.SAXParseException ex) throws org.xml.sax.SAXException
            System.err.println("\n[Fatal Error] " + ex.getMessage() + " line " + ex.getLineNumber()
            + " column " + ex.getColumnNumber() + " - " + instance);
            fatalErrors++;
            throw ex;
        public static void main(String[] args)
            Validate validate1 = new Validate();
            if (args.length == 0)
                System.out.println("Usage : java Validate <instance>");
                return;
            // Set the instance
            if (args.length >= 1) validate1.setInstance(args[0]);
            // Validate (the doValidate returns either true or false depending on
            // whether there were any errors.)
            if (!validate1.doValidate()) return;
    }My question is: why do I get those errors??? Why doesn't everything just validate like it is supposed to??? Also, why does the error even mention DOCTYPE -- I thought that was for DTDs, and I am using XML Schema.
    I will be very grateful to anyone who can tell me what is going on here.
    Thanks,
    Jon

    I have solved my problem. I just needed to add the following line to my java program:
    parser.setFeature("http://apache.org/xml/features/validation/schema", true);I'm still not sure how I was supposed to know this, however. I guess spending three hours searching on google is what you are supposed to do. Also, I was thrown for a bit of a loop by the following official faq found at http://xml.apache.org/xerces2-j/faq-pcfp.html:
    [faq]
    Question: How can I tell the parser to validate against XML Schema and not to report DTD validation errors?
    Answer: Currently this is impossible. We hope that JAXP 1.2 will provide this capability via its schema language property. Otherwise, we might introduce a Xerces language property that will allow specifying the language against which validation will occur.
    [faq]
    I am very new to XML (less than a week), but that FAQ sure makes it sound like using only XML Schema and completely avoiding DTDs is impossible. On the other hand, I think that is what I was able to achieve by adding the above line to my code.
    Oh well.
    Jon

Maybe you are looking for