XML validation with DTD in java 1.5 not supporting

Hi,
I am facing a problem regarding validation of xml file with DTD tag in it.
I have disabled the parser through setValidating(false) method.
xml file is not parsed in JRE 1.5.but it is parsed in JRE 1.6.
Why this is showing such a behavior?
I have used xerces 2.9.0,xml-api.jar and other jar regarding XML api but still it is giving error.
please help me.
please provide a jar file name or its issue resolution in jre 1.5 or 1.4.

thanks for your prompt reply.
I required that it should be completely disabled in jre 1.5(jdk1.5 or 1.4).
I am using DOM Parsing.I have currently disabled with follwowing method,
builderFactory.setValidating(false);
builderFactory.setFeature("http://xml.org/sax/features/validation",
     false);
     builderFactory.setFeature("http://apache.org/xml/features/nonvalidating/load-dtd-grammar", false);
     builderFactory.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd",false);
     builderFactory.setFeature("http://xml.org/sax/features/external-general-entities", false);
     builderFactory.setFeature("http://xml.org/sax/features/external-parameter-entities", false);
     factory.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);
in 1.6 it is working fine but I required that i have to disabled it.but it is giving a error in jre1.5.
Exception in thread "main" java.lang.AbstractMethodError: javax.xml.parsers.DocumentBuilderFactory.setFeature(Ljava/lang/String;Z)V
I just want to disable the parsing in jdk version 1.5 or 1.4
thanks in advance
anand

Similar Messages

  • XML validation with DTD

    Hi Team,
    I want to validate the XML content with DTD refered in the XML. I have problem now is my DTD are present in a jar file. How do I need to set systemid to the input source so that it works.
    <!DOCTYPE test SYSTEM "test.dtd">
    SAXParserFactory factory = SAXParserFactory.newInstance();
    factory.setValidating(true);
    factory.setNamespaceAware(true);
    inputSource.setSystemId("path");
    SAXParser parser = factory.newSAXParser();
    XMLReader reader = parser.getXMLReader();
    reader.setErrorHandler(new XmlValidationErrorHandler());
    reader.parse(inputSource);
    Regards
    Richard

    i believe the best way to handle that would be to set the EntityResolver on the XMLReader to your own implementation which loads the DTD from the jar.

  • XML Validation with DTD... Urgent

    Hi all,
    I am using java 1.4
    I have to validate the XML file with the external DTD.
    Can anyone give me the code for that.
    DTD should be external.
    Thanks,
    Vinayak.

    If you are using Solaris , it has xml validation tool "xmllint", using this you can validate your xml against DTD.
    try with "xmllint --help " to see all the option.
    Message was edited by:
    sasrivas

  • XML validation with DTD stored in String object

    Does anyone know if this is plausible......
    I am trying to validate some XML with a DTD... easy enough, right? The catch is that the dtd is NOT stored in a file somewhere and is also not declared in the XML to be validated. It is stored in a String object (as is the XML file to be validated).
    To clarify - I want to do something like this... but not sure how to incorporate the DTD.
    String dtd = // dtd definition here
    String xml = // xml text here (no URI at the top)
    SAXParserFactory factory = SAXParserFactory.newInstance();
    SAXParser parser = factory.newSAXParser();
    DefaultHandler handler = new DefaultHandler();  // DTD handler??
    parser.parse(new InputSource(new StringReader(xml.toString())), handler);any help would be greatly appreciated.
    thanks in advance,
    Terrance

    I guess it makes the most sense to make the dtd local to the xml. Therefore I would only have one string with both the xml contents and dtd contents. That is how I am going to approach this unless I hear something different.

  • XML Validation with XSD in java mapping

    Hi experts,
    I have created an interface to send differents messages between bussines system, the bussiness system receiver is put in the message, to get this value I have a configuration file indicating the path of this field for each message type. In a java mapping I transform the message sent in this structure:
    <document>
    <message>HERE THE MESSAGE AS STRING</message>
    <parameters>
    <sender>HERE SENDER BUSSINESS SYSTEM</sender>
    <receiver>HERE RECEIVER BUSSINESS SYSTEM</receiver>
    </parameters>
    </document>
    the messaging interface works fine, but now I have to validate the XML vs XSD. I need doing in a java mapping because the messaging interface send the message and a email to sender in error case.
    To do this validation I have implemented two java mappings that works fine in my local, the first way is with class Validator of java 5, but my system PI 7.1 return an error with this class. The second way is with SAX parse:
    String schema = "XXXXXxsd";
    DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
    docBuilderFactory.setNamespaceAware(true);
    docBuilderFactory.setValidating(true);
    docBuilderFactory.setAttribute("http://java.sun.com/xml/jaxp/properties/schemaLanguage","http://www.w3.org/2001/XMLSchema");
    InputStream is = this.getClass().getClassLoader().getResourceAsStream(schema);
    docBuilderFactory.setAttribute("http://java.sun.com/xml/jaxp/properties/schemaSource",is);
    in my local works fine but in PI always return OK never fail.
    For this moment the schema is hardcoded to do proofs, in the future will be loaded from my configuration file.
    Any idea?
    Thanks in advance
    Jose

    hi Jose,
    PI 7.1 has a built in feature available called XML vaidations ..
    your source xml can be validated against a XSD placed at a specific location on the PI server..
    validation can be performed at adapter/integration engine
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/d06dff94-9913-2b10-6f82-9717d9f83df1?quicklink=index&overridelayout=true

  • Convert XML file into DTD using Java

    Hi All,
    I want to do convert the xml file into DTD using Java.
    I read the DOM package but didnt get clear idea.
    Anyone of you have an idea please share the coding with me.
    Any suggestions greatly appreciated.
    Thanks
    Veera

    Hi All,
    I want to do convert the xml file into DTD using Java.
    I read the DOM package but didnt get clear idea.
    Anyone of you have an idea please share the coding with me.
    Any suggestions greatly appreciated.
    Thanks
    Veera

  • XML Validation with multiple XSD files (referenced)

    Hello,
    I know that XML validation with version 7.1 is possible now. However I was provided with a set of XSD files that have references to each other and need to be placed in a hierachical file system order so that references can be resolved.
    An element <xsl:include schemaLocation="../../baseSchemas/baseSchema.xsd" /> is used for example. How can I handle that for XSD validation in PI? Can I create the same folder structure or do I need to put all XSD files in one directory and change the import manually?
    But most important question: Is it possible it all to use more than one XSD for schema validation?

    Dear Florian,
    I had encountered such case in a project.
    I was given 3 files. One main file and 2 others called Schema1.xsd and Schema2.xsd.
    This happens because your data type is not in single namespace, but is being referred across namespaces and software components.
    I am assuming that you have read the How to Guide for XML validations on PI 7.1
    Best way to do this quickly is as follows.
    1. Enable XML validation at adapter engine in the sender agreement.
    2. Post a message using HTTP post. (http://sappihttpclient.codeplex.com)
    3. Check communication channel in runtime workbench. There will be an error saying which is missing at what path.
    4. Create the path mentioned and place the file at that path.
    5. Repeat steps 2,3,4 for all the files.
    When you are done with this, you will get a proper validation error in case XML file is not correct. And remember to generate XSD from message type and not data type.
    Regards,
    Vikas
    Edited by: Vikas Aggarwal on Sep 2, 2009 8:45 PM
    Edited by: Vikas Aggarwal on Sep 2, 2009 8:48 PM

  • Org.xml.sax.SAXParseException: The encoding "ISO8859-1" is not supported.

    Please help. I am trying to parse an XMl document using de DOMParser:
    try {
    DOMParser parser = new DOMParser();
    parser.parse("myFile.xml");
    document = parser.getDocument();     
    } catch (SAXException e) {
    System.err.println (e);
    } catch (IOException e) {
    System.err.println (e);
    I use the encouding "ISO8859-1" in myFile.xml:
    <?xml version='1.0' encoding='ISO8859-1' ?>
    But if I execute my program I get the following error:
    org.xml.sax.SAXParseException: The encoding "ISO8859-1" is not supported.
    How I can I resolve that?
    Many thanks!
    Yassin

    The Java API documentation (the bit about character encodings) mentions "ISO-8859-1" but not "ISO8859-1". Try that instead?

  • I just got a new ipod 5 and when I plugged in the charging cord that came with it, it says it is not supported, and may not charge. It worked the first few times, but now it won't charge at all.

    I just got a new ipod 5 and when I plugged in the charging cord that came with it, it says it is not supported, and may not charge. It worked the first few times, but now it won't charge at all.

    - See:      
    iPod touch: Hardware troubleshooting
    iPhone and iPod touch: Charging the battery
    - Try another cable. Some 5G iPods were shipped with Lightning cable that were either initially defective or failed after short use.
    - Try another charging source
    - Inspect the dock connector on the iPod for bent or missing contacts, foreign material, corroded contacts, broken, missing or cracked plastic.
    - Make an appointment at the Genius Bar of an Apple store. The cable as well as the iPod, is covered by the warranty.
    Apple Retail Store - Genius Bar                          

  • "URL's with the type "file." are not supported"

    "URL's with the type "file." are not supported" Can anyone tell me how to remove this message?
    I installed Lion and I see a lot of people have the same problem.
    Help

    Not a nice answer!
    Posting "Check the 'More like this' area" and not simply providing the answer is a great way to make these groups worthless. Hence, for a while, all I would get is versions of this same arrogant message.
    Here's the answer so someone else doesn't get locked into the same loop I did:
    I just solved my problem, which was the same perplexing message that kept popping up.  It happened to be a Time Machine issue.  When I installed Lion, apparently the Time Machine had been turned on by the installer because it kept searching for the Apple.com server, to which I'm not subscribed.  Prior to the installation I had always backed up to an external HD; not Apple's online service.  Searching Apple Support Forums, I found "Troubleshooting Time Machine' and followed the instructions to "reset Time Machine".  Now things are back to normal.  I hope this is of some help.

  • Validating generated XML file with DTD

    Hello all,
    my requirement is to test the XML file with its DTD.
    we are creating an XML file, before writing it on the application server , we need to test it with its DTD.
    i found one method set_validating in the interface if_ixml_parser , for validating XML file, but not getting an idea how to use it, like how to link the DTD to XML etc.
    if i try to use the above method am getting the following error:
    Unable to retrieve the external entity 'd:\dtdfile.dtd'.
    where 'd:\dtdfile.dtd' is the path of the DTD file included in the Doctype of the XML file.
    Please help me to solve this.
    Thx in advance.

    Hello,
    Did you find your answer ?
    I know how to validate an XML file an internal DTD, but not an external one... If you know, can you pelase advice ?
    If you didn't found yet, you need to use method get_reason() to get the description of the error.
    best regards,
    Gilles.

  • XML Validation with Java

    I have created a XML file with dom4j and the file confirmed to be valid when I read the file with Internet Explorer, a online XML validator and a free XML editor called "CookTop". However, when I attemp to read the XML file during the execution of an ant task I always get the XML parsing exception that one of my tag is not closed. I have even wrapped that test inside the tag as CDATA but that does not help as well. Do any one know what's happening? Here's my environment:
    JDK: 1.4.2_05
    Xerces: 2.6.2
    Ant: 1.5.3
    Thanks so much in advance.
    I've been pumping my head into the wall for hours : p

    Can i know where to download the CookTop?or CookTop2?

  • XML Validation with External XSD

    Hi
    I have a xml file having DTD declaration, but my requirment is to validate this xml file with External XSD not with DTD which is declared inside the file.
    on executing java code below it is looking for DTD. how to supress validating against dtd.
    SAXParserFactory factory = SAXParserFactory.newInstance();
                   factory.setValidating(false);
                   factory.setNamespaceAware(true);
                   SchemaFactory schemaFactory =
                       SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema");
                   factory.setSchema(schemaFactory.newSchema(
                       new Source[] {new StreamSource("C:\\vittal\\Project\\received\\development-1\\da_xsd\\daAuthoring.xsd")}));
                   SAXParser parser = factory.newSAXParser();
                   XMLReader reader = parser.getXMLReader();
                   reader.setErrorHandler(new LogErrorHandler());
                   reader.parse(new InputSource("C:\\vittal\\Project\\received\\A-ADD\\DAContentExamples_2\\SampleGuidance_1.xml"));error i am getting is License file saxon-license.lic not found. Running in non-schema-aware mode
    java.io.FileNotFoundException: C:\vittal\Project\received\A-ADD\DAContentExamples_2\daAuthoring.dtd (The system cannot find the file specified)

    Hi
    I have a xml file having DTD declaration, but my requirment is to validate this xml file with External XSD not with DTD which is declared inside the file.
    on executing java code below it is looking for DTD. how to supress validating against dtd.
    SAXParserFactory factory = SAXParserFactory.newInstance();
                   factory.setValidating(false);
                   factory.setNamespaceAware(true);
                   SchemaFactory schemaFactory =
                       SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema");
                   factory.setSchema(schemaFactory.newSchema(
                       new Source[] {new StreamSource("C:\\vittal\\Project\\received\\development-1\\da_xsd\\daAuthoring.xsd")}));
                   SAXParser parser = factory.newSAXParser();
                   XMLReader reader = parser.getXMLReader();
                   reader.setErrorHandler(new LogErrorHandler());
                   reader.parse(new InputSource("C:\\vittal\\Project\\received\\A-ADD\\DAContentExamples_2\\SampleGuidance_1.xml"));error i am getting is License file saxon-license.lic not found. Running in non-schema-aware mode
    java.io.FileNotFoundException: C:\vittal\Project\received\A-ADD\DAContentExamples_2\daAuthoring.dtd (The system cannot find the file specified)

  • XML Validation with no connection to the internet

    Hi,
    I'm trying to validate a ml instance document against a xml schema, using the javax.xml.validation.Validator.validate() method. This works fine as long as I have an internet connection, but not when I disconnect from the internet it fails.
    I've detected, using a network sniffer, that this is due to the fact that the validation process tries to fetch the XMLSchema.dtd and datatypes.dtd from w3.org. Is there any way to avoid this by prestoring these somewhere? So that the internet connection is not needed?
    I need to be able to do validation without a connection to the internet since the environment where my application is deployed does not have such a connection.
    Ray

    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

  • Xerces2_6_2 validating with dtd and schema.. please help

    Hi I am having trouble validating an xml document using xerces2_6_2
    I have a DTD that containes only entity references, and a schema that is used to ensure the xml is valid.
    I get this error.
    Element type "my root tag" must be declared!
    It seems to expect all validation grammer to be in the dtd. I have sucessfully validated with xml spy and oxygen,(oxygen uses xerces too).
    This is a real pain I really would lie to take advantage of using schemas, I know I could just use entity references in this form and not have a dtd but this is really not acceptable.
    I have tried out all the xerces specific properties and features but this has not worked either.
    Perhaps I should implement a validator? Does anyone have any ideas?
    thanks

    My solution, I thought to take, wasn't the right way, but I have found following thread within the forum
    http://forum.java.sun.com/thread.jspa?forumID=34&threadID=527461
    The problem you have described points to a dtd error. Considering the thread above, it would make sense. It is a presumption, but perhaps that is because of the new Xerces version. I would try with an older one.
    Sorry, that I could help you along.

Maybe you are looking for

  • Third Party sale error

    Dear Gurus, The below error does not allow me to save the P.Order. I am configuring the standard third party sales schenario where the Item category is TAS and Schedule Line Cate. used  is CS. The material type I used is Trading Goods. I created a sa

  • 1TB LaCie won't connect w/ thunderbolt cable

    Whats up people :C

  • 16:9 and 4:30 ratios...

    Hello - I've seen posts on this subject, but nothing that's specifically answered my question - still fairly new to FCP, (I'm using FCP Studio), I'm cutting a dance video and noticed that the Side Angle Camera shows up fitting in the canvas window at

  • Problem with LR_tokens in LrExportSession in 2.7

    Hi, I'm having trouble getting the rename-on-export feature working on LR2.7, Windows x64 . Not tried on any other configurations except LR3.2, where it works fine. I'm manually creating an LrExportSession from a menu, and passing the following items

  • Quiz results page appears blank

    I have built a module consisting of 122 slides and is 10.8mb in filesize. Everything appears fine and work perfectly my end however when I have sent it out for review the past couple of times, my colleauge revewing it can see "a blank screen after th