DocumentBuilder screams IOException when DTD ref in XML!

Hi
I have an interesting problem out here. I am using JAXP & Xerces. When I try and create a document object using the DocumentBuilder.parse(), I get an IOException, if the xml string contains a reference to the DTD. Infact another exception that I get to see is java.net.ConnectException: Connection timed out.
BTW: I used xmlspy to validate the document and its fine.
Code Snippet
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = null;
Document
try
db = dbf.newDocumentBuilder();
document = db.parse(new InputSource(new StringReader(xmlString)))
catch(SaxException se)
catch(IOException e)
System.out.println(" IOException ... ");
If the xml string has no reference to the DTD it works fine however with it the error.
Any thoughts, anyone ??
Thanks in advance
~Ed

do you use an absolute path or a relative one to point to the DTD?
the technique i use to ensure a succesful finding of my DTDs is to implement my own EntityResolver to point exactly where the files are - hence programmatically transforming relatives references "mydtd.dtd" to absolute ones "c:/project/files/mydtd.dtd".
db.setEntityResolver(new EntityResolver() {
public InputSource resolveEntity(java.lang.String publicId, java.lang.String systemId)
throws SAXException, java.io.IOException
  if (systemId.endsWith(".dtd"))
    return new InputSource(*** here point to the right folder + file ***);
  else
    return null;
});

Similar Messages

  • 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

  • IOException while parsing'ejb-jar.xml

    Hi,
    While I am building my project I am getting the below error. Please anybody help suggest me to overcome this problem.
    [ejbjar] Unable to load dependency analyzer: org.apache.tools.ant.util.depend.bcel.FullAnalyzer - dependent class not found: org/apache/bcel/classfile/Visitor
    [ejbjar] Could not resolve ( publicId: -//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN, systemId: http://java.sun.com/dtd/ejb-jar_2_0.dtd) to a local entity
    BUILD FAILED
    IOException while parsing'ejb-jar.xml'. This probably indicates that the descriptor doesn't exist. Details: Connection timed out: connect
    Regards,
    Sameer

    Do you have the appropriate bcel jar file in your path that includes org/apache/bcel/classfile/Visitor?

  • Getting error when try to upload xml file into Data Template

    Hi,
    Getting error when try to upload xml file into Data Template.error:"The uploaded file XXSLARPT.xml is invalid. The file should be in XML-DATA-TEMPLATE format."Plz anybody help me.
    Thanks,
    Prasad.

    Hi,
    Anybody Help Plzzzzzz.
    thx,
    Prasad

  • Can't convert oracle.xml.parser.DTD to oracle.xml.parser.v2.DTD.

    I am getting the following Error while trying
    to compile the SampleMain.java file(Generating an XML document from a given Employee.dtd).
    I have set my classpath to use xmlparser.jar.
    D:\XMls>javac SampleMain.java
    SampleMain.java:65: Can't convert oracle.xml.parser.DTD to oracle.xml.parser.v2.DTD.
    main(java.l
    ang.String[]).
    generator.generate(dtd, doctype_name);

    Would you check the java parser version you are using? If using java parser V2, the normal lib name is xmlparserv2.jar.
    null

  • Adding DTD reference in xml

    hi,
          This way i am creating xml,
            var cAcrobat += "<Root>";
            cAcrobat += "<Sample>" + "Something" + "</Sample>";
            cAcrobat += "</Root>";
            this.createDataObject("Acrobat.xml", cAcrobat);
            var Acrobat = this.getDataObjectContents("Acrobat.xml");
            cAcrobat = util.stringFromStream(Acrobat,  "utf-8");
            var myXML = XMLData.parse(cAcrobat, false);
            var cAcrobat = myXML.saveXML('pretty');
            var Acrobat = util.streamFromString(cAcrobat, "utf-8");
            this.setDataObjectContents("Acrobat.xml", Acrobat);
    and as a result it is creating an xml file as an attachment to pdf,  as follows,
      <?xml version="1.0" encoding="UTF-8" ?>
    - <xfa:data xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/">
    - <Root>
      <Sample>Something</Sample>
      </Root>
      </xfa:data>
    but i want to add DTD reference to xml file before the Root node  and after adding it should create xml like this,
    <?xml version="1.0" encoding="UTF-8" ?>
    "<!DOCTYPE  Some-application SYSTEM 'file:C:/SomeFolder/Test.dtd'>";
    - <xfa:data xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/">
    - <Root>
      <Sample>Something</Sample>
      </Root>
      </xfa:data>
    please tell me how to add this dtd reference in xml file, and whater i am doing above is correct or not?
    please tell me how to add dtd reference in xml file.

    I already created xml file as an attachment to pdf as explained in my 1st post.  now my problem is
    How to add DTD syntax line into XML using acrobat java script or E4X objects(?). like the one below
    <DOCTYPE SomeApp:MyformData SYSTEM "C:/myreference.dtd">

  • Error when converting form to XML

    I get this error when trying to convert a form using this method:
    frmf2xml.bat OVERWRITE=YES AvaAcPt.fmb
    Oracle Forms 10.1.2 Forms to XML Tool
    Copyright(c) 2001, 2005, Oracle. All rights reserved.
    Processing module AvaAcPt.fmb
    WARNING: Invalid value (100) for property DataType on object OK.
    WARNING: Item CURR_CODE - all ListItemElements must have an Index, Name and Value.
    WARNING: Invalid value (100) for property DataType on object OK.
    WARNING: Invalid value (100) for property DataType on object INACTIVECUSTOMER.
    WARNING: Invalid value (100) for property DataType on object OK.
    XML Module saved as AvaAcPt_fmb.xml
    The WARNING: Item CURR_CODE - all ListItemElements must have an Index, Name and Value. is obvious. It a list is empty this warning is thrown out. Of course my concern is when we do the XML to Forms conversion later will the list item and associated code be reconstructed correctly?
    As for the 3 OK buttons and the INACTIVECUSTOMER button the converter puts a DataType attribute, which is meaningless to a button.
    I tried to find any peculiarities with the buttons but could not find any.
    Has anybody else experienced this problem?

    Hi,
    I have got the same warning “ all ListItemElements must have an Index, Name and Value” when converting form from fmb to xml using frmf2xml.
    Have you find any course of this and how to fix it?
    Thanks!

  • How to refer an xml file within a xml file?

    Hi
    I would like to refer a xml file within a xml file from where i would like to extracts some elements & attributes.
    Plz, suggest me hot to do.
    Thank you.

    You mean you want to link the file thru some resource pointer and then make the external file availabe for parsing and other processing operations?

  • How to get rid of .dtd file in XML file?

    If there is "<!DOCTYPE xxx SYSTEM "xxx.dtd">" in a XML file and there is no xxx.dtd file, there will be wrong while parsing in Java using JAXP, and the function: setValidating(false) is no use. I can't modify original XML file containing "<!DOCTYPE xxx SYSTEM "xxx.dtd">" and Maybe I have not that xxx.dtd file.
    Please tell me how to solve it if you know, thanks a million.

    You're stuck. You've either got to find that .dtd file, or remove the line from the XML. Your only other option is to reimplement the DTD file so that the XML can use it, or you can just redo everything

  • How to set the selectedIndex when dataProvider is an XML object in DropDownList?

    dataProvider was an XML object
    How to set the selectedIndex when dataProvider is an XML object in DropDownList?
    I do this:
    <s:DropDownList id="dropDownList" requireSelection="true" selectedIndex="2"
                    labelField="lastName" dataProvider="{employeeService.lastResult.employees.employee}"/>
    But always the first item is selected whatever the value of selectedIndex equals to.

    if i understand correctly, you want the selectedindex to be 2 when the DropDownList  displays.
    It might be the case that the dataprovider is being sought after it's already selected its index (as the dataprovider isn't already determined to begin with), so currently it's
         - setting the selected index to default
         - setting the selected index to 2 (your command)
         - getting the dataprovider
         - setting the selected index to default
    try writing a function to set the DropDownList's selected index after it's received the information, or even just attach it to the employeeService result handler.
    for quick testing sake you could just add
    <s:DropDownList id="dropDownList" requireSelection="true" updateComplete="dropDownList.selectedIndex = 2"
                    labelField="lastName" dataProvider="{employeeService.lastResult.employees.employee}"/>
    to see if my theory is correct.

  • Weird characters in Hex viewer when i check a xml

    Hi,
    We are in the test phase sending messages to a customer of us. But when we send test messages the customer tells me that there are weird characters in the xml. It happens when we check the xml in a hexadecimal viewer. In the normal viewer of in a webbrowser
    we dont see these characters. He is a example of the situation:
    Look at the characters before the <?XML 
    So my question is how can i get rid of these characters?
    PS: these characters arent in the source files. 

    These characters are called the Byte Order Mark (BOM) and provided by/to the file system to indicate the encoding to be used when opening the file. You can read about it @http://en.wikipedia.org/wiki/Byte_order_mark
    And as Sumit has already mentioned, you can switch these ON/OFF based on the Pipeline Component properties. Even if you're using the default XMLTransmit, you can edit this property on the Specific Port.
    Regards.

  • When I load a XML in a XFA form can I specify the font color?

    When I load a XML in a XFA form can I specify the font color?
    Or can I specify background color, font type(bold, ...).

    Moved to LiveCycle modules and development tools

  • Servlet throws IOException when browser is "stopped"

    Hello,
    I have a servlet running on the Sun ONE Web server 6.1 that throws this error message: "java.io.IOException: WEB8004: Error flushing the output stream".
    Through my testing, it seems as if this is caused by the user pressing the stop button before the output can be completely commited to the client. Strangely enough the error seems to thrown when IE is the browser but not when Firefox is. My guess is that what is happening is the client connection is closed when stop is pressed in IE and the server cannot write to the client anymore so the error is thrown.
    I was wondering if anyone has any insight into how to prevent this from getting thrown. I realize that this error is not a major thing and probably doesn't need to be worried about, but it is quite annoying because webmaster gets emailed anytime an exception is thrown so cutting down on pointless exceptions is something we like to do :)
    Thanks in advance.

    You could also try hitting the browser's refresh button many times as quickly as possible; it should also give similar errors. Or keep Control-R (reload) pressed down and let the keyboard's auto-repeat do its work.
    When the browser is in the process of fetching a page and decides it isn't interested in the page after all, it closes the TCP/IP connection to the server. The server will get an IOException. Nothing you can do about that. Write a catch block that ignores IOException when flushing a web page. Or maybe log "error sending page, the user probably hit the reload button", without the stack trace, into an audit log.

  • Why is the assests panel disabled when editing css or xml files?

    It's immensely annoying. Is there anyway to stop it?

    That doesn't really explain why a very useful panel is disabled. What's the logic behind it?
    This is a user-to-user forum, not Adobe customer support. You asked whether there was any way to prevent the Assets panel from being disabled when editing CSS and XML files. The answer is no.
    If you want Adobe to change the way the program works, file a feature request.

  • Error when reading data from XML using JAXB?

    Hi all,
    I get the error message when reading data from XML using JAXB.
    [org.xml.sax.SAXParseException: The entity name must immediately follow the '&' in the entity reference.]
         at javax.xml.bind.helpers.AbstractUnmarshallerImpl.createUnmarshalException
    (AbstractUnmarshallerImpl.java:315)
         at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.createUnmarshalException(UnmarshallerImpl.java:481)
         at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:199)
         at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:168)
         at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:137)
         at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:142)
    I don't find the reason, please help!
    Thanks in advance!

    The problem is sovled.

Maybe you are looking for

  • Using LPT to generate pulses

    hi.. im new to labview, im trying to generate clock , strobe and data signals ( data to be user defined ) using the wave form generator function in LabView 7.1..the data has a different time period as compared to the other pulses.. my end purpose is

  • Unable to get Liberty sample1 to work

    I am a new user to the Identity Server so please excuse me if I am doing something stupid! We are trying to use Federation Management and setting up Sample1 from the Liberty samples under /opt/SUNWam. We have 3 machines on a private lan with no DNS,

  • Isqlplussvc.exe encountered a problem and needed to close.

    Does anyone have any information on fixing this error. It is killing me. The situation is: I am running windows xp pro sp2 on a AMD 64bit box. It is 32bit windows. It has 1GB of RAM and 40 GB of hd. the release I am using is Oracle 10.2.01 db and cli

  • Display a TEXTFIELD only in sebsequent page and not on first page in adobe

    Hi Expert, I have a requirement in which i have to display a text field only on the subsequent pages and not on the first page in adobe form. Can u plz help me. Thanks Mahesh

  • Recent issues downloading RAW images to iPhoto from EOS 40D

    Hi, I've been using iPhoto to process RAW images from my EOS 40D for ages without any issues, but I'm now getting an error message saying it can't import the files from the camera as they are in an unknown format. I've reinstalled iPhoto, but no chan