Complains about " ?xml ....? " then validating against DTD

We are using Oracle's XML-parser (xmlparserv2.zip) to validate XML-files with DTD-files.
The problem we are getting is that it complains on the first row in the XML-file:
It doesn't work when:
     <?xml encoding="ISO-3242"?>
But it DOES (!??) work when we remove the "x":
     <?ml encoding="ISO-3242"?>
Can anyone explain this to me? The error message was something about "xml is a reserved..."

I think the problem is that <?xml encoding="..."> is not a valid as a XML declaration. It must include the attribute version="1.0" e.g. <?xml version="1.0" encoding....>. Otherwise it treats xml as a user defined name, and as the error indicates you cannot declare element names that have xml.
Hope this helps.

Similar Messages

  • XML validation against DTD.. Is it possible?

    Hello all,
    Sorry for what may be a trivial post, but I'll keep it short..
    According to the docs:
    "The Validate XML command will validate the XML against the schema defined in the XML file. This command on the context menu is disabled whenever an XML file does not have an XML namespace defined."
    I'm used to the XML editor retrieving a DTD from somewhere and validating it against that.. is it possible to do this in JDev?

    Unfortunately it's not. We only have support for validating against XML Schemas.
    Rob

  • How to disable validation against DTD while unmarshalling

    Hi All
    I am relatively new to XML and JAXB. I have a tool that needs to run offline, however the XML documents that are being read in are automatically being validated against the DTD even though I have specified unmarshaller.setValidating(false). How can I completely diable validation while offline? Here is my code:
    context = JAXBContext.newInstance("my.xmlobjects.package");
    Unmarshaller u = context.createUnmarshaller();
    u.setValidating(false);
    testLog = (TestLog) u.unmarshal(new File("/path/to/my/file.xml"));
    I've also tried a suggestion I saw on another forum (note that I know nothing about SAX, I've been trying to make sense of the documentation):
    SAXParserFactory parserFactory = SAXParserFactory.newInstance();
    parserFactory.setValidating(false);
    SAXParser saxParser = parserFactory.newSAXParser();
    XMLReader xmlReader = saxParser.getXMLReader();
    EntityResolver entityResolver = new EntityResolver()
    public InputSource resolveEntity (String publicId, String systemId)
    return null;
    xmlReader.setEntityResolver(entityResolver);
    InputSource source = new InputSource(new FileInputStream("/path/to/my/file.xml");
    SAXSource saxSource = new SAXSource(xmlReader, source);
    context = JAXBContext.newInstance("my.xmlobjects.package");
    Unmarshaller u = context.createUnmarshaller();
    u.setValidating(false);
    testLog = (TestLog) u.unmarshal(saxSource);
    Both of these work when connected, but fail when disconnected from the internet. Is there an Oracle specific property that needs to be set here?
    Thanks
    Jeff

    Well you can create non validating parser programatically .
    http://edocs.bea.com/wls/docs100/xml/programming.html#wp1069856
    i.e.
    SAXParserFactory spf = SAXParserFactory.newInstance();
    spf.setValidating(false);
    Hope this helps.

  • 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

  • Oracle XML Parser validation against XML Sxhema

    Hi,
    I am developing a program in C++ on Unix, that does parsing on an XML document. For parsing I am using "Oracle XML Parser" [using DOM API]. My question is, Can Oracle XML Parser validate xml document against an XML Schema file also? I have read in many tutorials that it can validate against DTD. Please clarify my question as early as possible?
    Regards,
    Raghuram.

    Hi Kulkarni,
    I think you are trying to retrieve the text of the parent element of book. For example if this is the xml element
    <bookdetails>
    <book>Harry Potter</book>
    <author>JK Rowling</author>
    <price>34.55</price>
    </book>
    </bookdetails>
    You must be trying to retrieving the text of bookdetails.
    Check XMLNode.getNodeName() to retrieve the name of the node.
    To get 'Harry Potter' as output you need to traverse till book and then use XMLNode.getText()
    You can check the 'getQuestions()' method in Survey Sample
    to know how to tranverse to any element of an XML using Java.
    The Survey Sample is located at
    http://otn.oracle.com/sample_code/tech/xml/survey/content.html
    Download the sample and unjar it. The location of Analyser.java is
    SurveySample\code\Survey\src\oracle\otnsamples\survey\business\Analyser.java
    Have a look at it.
    Regards,
    Anupama
    http://otn.oracle.com/sample_code/content.html

  • XML validation against DTD

    Hi,
    I have an application that receives XML from an external source. The XML received does not have the XML version and the doc type declaration lines. I want to validate the XML against a DTD.
    One dirty way of doing this is to open the XML received and prepend the XML versions and doctype lines to it. And then parse the XML. But is it the right way to do it?
    What I would like to know is that does the XML parser provide any API which can tell it to validate an XML document against a certain DTD.

    Yes, there is an API to do this. You have to do something like this:
    DocumentBuilderFactory dbf          =DocumentBuilderFactory.newInstance();
    dbf.setValidating(true);
    DocumentBuilder db = dbf.newDocumentBuilder();
    XMLErrors eh = new XMLErrors(frame);
    db.setErrorHandler(eh);
    Document doc = db.parse(f);
    (where f is the XML file)
    In this example, the class XMLErrors is used as the ErrorHandler. XMLErrors extends the DefaultHandler class and provides the user with information about the various error levels. A call to the over-ridden "error" method notifies the user (using a Dialog box) that the document doesn't meet the DTD.
    Hope this helps.

  • Node Insertion - ensure validity against DTD

    I want to create a new XML document, insert elements one by one. How do I ensure that the element is insertable according to DTD specified (i.e. it is valid to insert the new element to the XML document)?
    Thank you

    You can use class com.ibm.xml.parser.DTD to load your DTD and use the getAppendableElements method. Then you can check if an element is in the appendable elements,...

  • Validating against dtd

    Hi,
    I am trying to parse an xml against a dtd, using SAX parser. The validation is proper..but i want to parse the entire file even if there is a mismatch in the middle of the xml document.
    say if there is an error at one particular element, the parser throws an exception and quits..but i want the parser to continue with the rest of the document..
    how can i achieve this functionality..
    thanks & regards

    Hi,
    I had put the try catch block, the exception was getting caught and the program was exiting...later i used the ErrorHandler class to handle the exceptions..
    and it is working fine if there is a saxparseexception..
    But if there is some fatal error in the xml file, the parser throws the exception and quits. Is there any way to catch the fatal error and still proceed with the parsing.
    Thanks & regards

  • In-memonry xml document validation against schema with xerces

    Hello, there.
    I found that I can't use JAXP's javax.xml.validation package with jdk 1.4. (Am I wrong?)
    Anyway,
    I found that I can use xerces's DOMParser for the same purpose.
    But I can't find the way to validate my programmatically generate org.w3c.dom.Document against existing schema file.
    Can anybody help me?
    Thanks.

    Have you read Xerces documentation or SUN xml API, there is always a parser option (I suppose it's in the standard) to validate input while parsing.
    Look the API : http://java.sun.com/javase/6/docs/api/javax/xml/parsers/DocumentBuilderFactory.html#setValidating(boolean)

  • Flash is complaining about XML? Im using AS3 why are there XML errors? Unknown syntax errors.

    Sorry to keep spamming these forums with my stupid errors, but I am trying really hard to learn Flash/AS3 and when I have got to grips with it, I will return the love.
    I am a flash rookie trying to make a simple calculation device and I am getting a whole world of errors I have never seen before.
    My Code (I apologise but it may be my bad syntax):
    import flash.ui.Mouse;
    var Hnum:String;
    var PCnum:String;
    var calc:Number = 25;
    var Total:Number;
    num1.restrict = "0-9";
    num2.restrict = "0-9";
    Est_btn.addEventListener(MouseEvent.CLICK, calculate);
    function PartCount(event:MouseEvent):void{
        PCnum = num2.text;
        if (PCnum > 0 && < 10){
            parseInt(PCnum) * 10;
        or if (PCnum > 11 && < 20){
            parseInt(PCnum) * 5;
        or if (PCnum > 21){
            parseInt(PCnum) * 1;
    Est_btn.addEventListener(MouseEvent.CLICK, calculate);
    function calculate(event:MouseEvent):void{
        Hnum = num1.text;
        PCnum = num2.text;
        Total = parseInt(Hnum) * calc + parseInt(PCnum);
        Total.toString();
        Total_txt.text = String(Total);
    I had everything working when I was only calculating Hnum by 25. But when I try to intergrate  the if or statement everything goes wrong and I get these 5 errors.
    Scene 1, Layer 'Actions', Frame 1, Line 15
    1104: invalid xml name
    Scene 1, Layer 'Actions', Frame 1
    1084: Syntax error: expecting xmltagendend before end of program.
    Scene 1, Layer 'Actions', Frame 1
    1084: Syntax error: expecting rightparen before end of program.
    Scene 1, Layer 'Actions', Frame 1
    1084: Syntax error: expecting identifier before end of program.
    Scene 1, Layer 'Actions', Frame 1
    1084: Syntax error: expecting rightbrace before end of program.
    I dont understand what these errors are pointing out? Why XML? is it my variable names?
    Here is the code I had before the second function that worked fine:
    var Hnum:String;
    var PCnum:String;
    var calc:Number = 25;
    var Total:Number;
    num1.restrict = "0-9";
    num2.restrict = "0-9";
    Est_btn.addEventListener(MouseEvent.CLICK, calculate);
    function calculate(event:MouseEvent):void{
         Hnum = num1.text;
         PCnum = num2.text;
         Total = parseInt(Hnum) * calc;
         Total.toString();
         Total_txt.text = String(Total);
    Any help would be greatly appreciated! I will get the hang of this!
    MrB

    Thanks guys you were right it was parse problem with the var type.
    I have changed the code adding parseInt where necessary.
    I have also added the other functions. But now after it was working fine with just the one function it is doing the strangest thing.
    There are no errors, it is running fine but it is outputting the letter "a" instead of any numbers? Is this something to do with the strings? It is most odd.
    Any help would be greatly appreciated.
    Here is the new code:
    import flash.ui.Mouse;
    var Hnum:String;
    var PCnum:String;
    var PCcalc:Number;
    var Pmath:Number;
    var calc:Number = 25;
    var Total:Number;
    num1.restrict = "0-9";
    num2.restrict = "0-9";
    Est_btn.addEventListener(MouseEvent.CLICK, calculate);
    function PartCount(event:MouseEvent):void{
        if (parseInt(PCnum) > 0 && parseInt(PCnum)< 10){
            PCcalc == 1;
        if (parseInt(PCnum) > 11 && parseInt(PCnum)< 20){
            PCcalc == 2;
        if (parseInt(PCnum) > 21 && parseInt(PCnum)<200){
            PCcalc == 3;
    Est_btn.addEventListener(MouseEvent.CLICK, calculate);
    function PartCalc(event:MouseEvent):void{
        if (PCcalc == 1){
            Pmath * 10;
        if (PCcalc == 2){
            Pmath * 5;
        if (PCcalc == 3){
            Pmath * 1;
    Est_btn.addEventListener(MouseEvent.CLICK, calculate);
    function calculate(event:MouseEvent):void{
        Hnum = num1.text;
        PCnum = num2.text;
        Total = parseInt(Hnum) * calc + Pmath;
        Total.toString();
        Total_txt.text = String(Total);
    Thanks
    MrB

  • Regarding validating XML against DTD

    hello,
    In my project I am receiving xml via HTTP post request
    and this XML needs to be validated against a DTD in a remote server.
    e.g. assume the xml to be
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE PUSH SYSTEM "http:\\whatever:xx\whatever\sms.dtd">
    <PUSH ICP="Partenaire" ADM="UtilisateurChezPartenaire" VERSION="1.0">
    </PUSH>
    the java code uses Xerces parser
          DOMParser parser = new DOMParser();
          parser.setFeature("http://xml.org/sax/features/validation", true);
          parser.setProperty(
                             "http://apache.org/xml/properties/schema/external-noNamespaceSchemaLocation",
                             "http:\\whatever:xx\whatever\sms.dtd"");
          parser.parse("c://localcopy/sms.xml");this Works fine.
    But in some case I receive xml file without any !DOCTYPE declaration
    (but is still needs to be validated against the same DTD as its mentioned in the business rules)
    in such case how can the XML be validated against the DTD.
    am I extected to add the
    <!DOCTYPE PUSH SYSTEM "http:\\whatever:xx\whatever\sms.dtd">
    to every XML via some XSLT script or is there a direct way of
    validating a xml that has no DOCTYPE reference to a DTD
    (the assumption is the DTD location is known beforehand)

    ok, i managed to solve the problem my self, using Transformer makes the job easier.
    here is the code for anyone who might run into the same problem.#
         public void whatEver(){
              try{
                   DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
                   DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
                   Document xmlDocument = dBuilder.parse(new FileInputStream("c://a.xml"));
                   DOMSource source = new DOMSource(xmlDocument);
                   //StringWriter writer = new StringWriter();
                   StreamResult result = new StreamResult("c://a.xml");
                   TransformerFactory tf = TransformerFactory.newInstance();
                   Transformer transformer = tf.newTransformer();
                   transformer.setOutputProperty(OutputKeys.DOCTYPE_SYSTEM, "./transformations/Push_Gateway.dtd");
                   //TransformerFactory transformerFactory = TransformerFactory.newInstance();
                   //Transformer newtransformer = transformerFactory.newTransformer();
                   transformer.transform(source, result);
              catch(Exception e){
                   e.printStackTrace();
         }the above code reads the a.xml file and adds/removes the DOCTYPE as specified in the transformer.setOutputProperty method and the same xml file is updated, this way different DTD could be referenced by the same xml and validated. this saves the process of adding/removing DOCTYPE via xslt.

  • Xml schema validation problem

    Hi All
    How to tackle this xml schema validation problem
    i am using the sample code provided by ORacle technet for xml
    schema validation in the Oracle database(817).
    The sample code works perfectly fine.
    Sample as provided by http://otn.oracle.com/tech/xml/xdk_sample/archive/xdksample_093001.zip.
    It works fine for normal xml files validated against
    xml schema (xsd)
    but in this case my validation is failing . Can you let me know why
    I have this main schema
    Comany.xsd
    ===========
    <?xml version="1.0"?>
    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    targetNamespace="http://www.company.org"
    xmlns="http://www.company.org"
    elementFormDefault="qualified">
    <xsd:include schemaLocation="Person.xsd"/>
    <xsd:include schemaLocation="Product.xsd"/>
    <xsd:element name="Company">
    <xsd:complexType>
    <xsd:sequence>
    <xsd:element name="Person" type="PersonType" maxOccurs="unbounded"/>
    <xsd:element name="Product" type="ProductType" maxOccurs="unbounded"/>
    </xsd:sequence>
    </xsd:complexType>
    </xsd:element>
    </xsd:schema>
    ================
    which includes the following 2 schemas
    Product.xsd
    ============
    <?xml version="1.0"?>
    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    elementFormDefault="qualified">
    <xsd:complexType name="ProductType">
    <xsd:sequence>
    <xsd:element name="Type" type="xsd:string"/>
    </xsd:sequence>
    </xsd:complexType>
    </xsd:schema>
    ==============
    Person.xsd
    ===========
    <?xml version="1.0"?>
    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    elementFormDefault="qualified">
    <xsd:complexType name="PersonType">
    <xsd:sequence>
    <xsd:element name="Name" type="xsd:string"/>
    <xsd:element name="SSN" type="xsd:string"/>
    </xsd:sequence>
    </xsd:complexType>
    </xsd:schema>
    =================
    now when i try to validate a xml file against Company.xsd
    it throws an error saying unable to find Person.xsd.
    no protocol error
    Now where do i place these 2 schemas(.xsd files) Person & product
    so that the java schemavalidation program running inside Oracle
    database can locate these files
    Rgrds
    Sushant

    Hi Jinyu
    This is the java code loaded in the database using loadjava called by a wrapper oracle stored procedure
    import oracle.xml.parser.schema.*;
    import oracle.xml.parser.v2.*;
    import java.net.*;
    import java.io.*;
    import org.w3c.dom.*;
    import java.util.*;
    import oracle.sql.CHAR;
    import java.sql.SQLException;
    public class SchemaUtil
    public static String validation(CHAR xml, CHAR xsd)
    throws Exception
    //Build Schema Object
    XSDBuilder builder = new XSDBuilder();
    byte [] docbytes = xsd.getBytes();
    ByteArrayInputStream in = new ByteArrayInputStream(docbytes);
    XMLSchema schemadoc = (XMLSchema)builder.build(in,null);
    //Parse the input XML document with Schema Validation
    docbytes = xml.getBytes();
    in = new ByteArrayInputStream(docbytes);
    DOMParser dp = new DOMParser();
    // Set Schema Object for Validation
    dp.setXMLSchema(schemadoc);
    dp.setValidationMode(XMLParser.SCHEMA_VALIDATION);
    dp.setPreserveWhitespace (true);
    StringWriter sw = new StringWriter();
    dp.setErrorStream (new PrintWriter(sw));
    try
    dp.parse (in);
    sw.write("The input XML parsed without errors.\n");
    catch (XMLParseException pe)
    sw.write("Parser Exception: " + pe.getMessage());
    catch (Exception e)
    sw.write("NonParserException: " + e.getMessage());
    return sw.toString();
    This is the code i used initially for validating a xml file against single xml schema (.xsd) file
    In the above code could u tell how to specify the second schema validation code for the incoming xml.
    say i create another Schemadoc for the 2nd xml schema.
    something like this with another parameter(CHAR xsd1) passing to the method
    byte [] docbytes1 = xsd1.getBytes();
    ByteArrayInputStream in1 = new ByteArrayInputStream(docbytes1);
    XMLSchema schemadoc1 = (XMLSchema)builder.build(in1,null);
    DOMParser dp = new DOMParser();
    How to set for the 2nd xml schema validation in the above code or can i combine 2 xml schemas.
    How to go about it
    Rgrds
    Sushant

  • Question about XML validation against schema

    My question is probably a basic one about XML. I tried PurchaseOrder example from the book "J2EE Web Services" by Richard Monson-Haefel. A simplified version as followings -
    Address.xsd -
    <?xml version="1.0" encoding="UTF-8"?>
    <schema xmlns="http://www.w3.org/2001/XMLSchema"
    targetNamespace="http://xml.netbeans.org/schema/Address"
    xmlns:addr="http://xml.netbeans.org/schema/Address"
    elementFormDefault="qualified">
    <element name="address" type="addr:USAddress" />
    <complexType name="USAddress">
    <sequence>
    <element name="name" type="string" />
    <element name="street" type="string" />
    <element name="city" type="string" />
    <element name="state" type="string" />
    <element name="zip" type="string" />
    </sequence>
    </complexType>
    </schema>
    PurchaseOrder.xsd -
    <schema xmlns="http://www.w3.org/2001/XMLSchema"
    targetNamespace="http://xml.netbeans.org/schema/PurchaseOrder"
    xmlns:po="http://xml.netbeans.org/schema/PurchaseOrder"
    xmlns:ad="http://xml.netbeans.org/schema/Address"
    elementFormDefault="qualified">
    <import namespace="http://xml.netbeans.org/schema/Address" schemaLocation="Address.xsd" />
    <element name="purchaseOrder" type="po:PurchaseOrder" />
    <complexType name="PurchaseOrder">
    <sequence>
    <element name="accountName" type="string" />
    <element name="accountNumber" type="unsignedShort" />
    <element name="shipAddress" type="ad:USAddress" />
    <element name="total" type="float" />
    </sequence>
    <attribute name="orderDate" type="date" />
    </complexType>
    </schema>
    Then PurchaseOrder.xml is -
    <purchaseOrder orderDate="2007-12-12"
    xmlns='http://xml.netbeans.org/schema/PurchaseOrder'
    xmlns:addr="http://xml.netbeans.org/schema/Address"
    xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
    xsi:schemaLocation='http://xml.netbeans.org/schema/PurchaseOrder ../xsd/PurchaseOrder.xsd'>
    <accountName>Starwood</accountName>
    <accountNumber>220</accountNumber>
    <shipAddress>
    <name>Data Center</name>
    <street>1501 Washington St.</street>
    <city>Braintree</city>
    <state>MA</state>
    <zip>02148</zip>
    </shipAddress>
    <total>250</total>
    </purchaseOrder>
    Then I did a XML validation but have this error -
    cvc-complex-type.2.4.a: Invalid content was found starting with element 'name'. One of '{"http://xml.netbeans.org/schema/Address":name}' is expected. [19]
    It complains <name> tag in <shipAddrss> needs namespace of "http://xml.netbeans.org/schema/Address". Why?
    Is it possible to change XML so it does not need name space for elements inside <shipAddress>?
    Thanks

    Hi Madhura,
    see here my comparison of the web version against the local file version on my Windows box (which is itself not the fastest): It makes a factor 16 in difference!
    C:\Temp\xsdvalidator>java XsdValidator madhu.xsd madhu.xml
    cvc-pattern-valid: Value 'provamail.it' is not facet-valid with respect to patte
    rn '[^@]+@[^.]+[.].+' for type 'EmailType'.
    NOK - Validation error
    Elapsed time: 16353 ms
    C:\Temp\xsdvalidator>java XsdValidator madhu_local.xsd madhu.xml
    cvc-pattern-valid: Value 'provamail.it' is not facet-valid with respect to patte
    rn '[^@]+@[^.]+[.].+' for type 'EmailType'.
    NOK - Validation error
    Elapsed time: 994 ms
    Obviously, the w3c.org domain that you specified as ressource location is very slow - and, as the FAQ shows, this delay is intentional!
    The W3C servers are slow to return DTDs. Is the delay intentional?
    Yes. Due to various software systems downloading DTDs from our site millions of times a day (despite the caching directives of our servers), we have started to serve DTDs and schema (DTD, XSD, ENT, MOD, etc.) from our site with an artificial delay. Our goals in doing so are to bring more attention to our ongoing issues with excessive DTD traffic, and to protect the stability and response time of the rest of our site. We recommend HTTP caching or catalog files to improve performance.
    --> They don't want to have requests to their site from productive servers all around the world.
    Regards,
    Rüdiger

  • 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);

  • URGENT---Validating XML file against DTD

    I have a XML & DTD file.I want to validate that xml file against the specified DTD without using any editor.Through program how can i validate?Pl. help me.It's URGENT.

    >
    and i recieved ORA-31001: Invalid resource handle or path name "/testdtd.dtd"
    when the DBMS_XMLPARSER.parseClob( PARSER , v_xml ); is executed
    i removed the <!DOCTYPE family SYSTEM "testdtd.dtd"> from the XML file
    the procedures worked , but not sure if really validated against the DTD file>
    you have to load your DTD into XDB repository.
    <a href ="http://forums.oracle.com/forums/thread.jspa?threadID=416366">How do I use DTD's with XML DB ?
    Ants

Maybe you are looking for