DTD and XSD Validation for xml file

hi kindly reply to this mail guru'ssss
i am facing a problem in parising a xml file against dtd and xsd.
i have the dtd which contains only enitities that can be present in the xml file and the xsd file for validation against elements and attribute.
when DTD is present then it is throwing errors like the elements should be declared.
when i take out the doctype line and validate against schema its throwing the error that particular entity is not found or declared.
  public Vector validateSchema(String SchemaUrl, String XmlDocumentUrl)  
      SAXParser parser =new SAXParser();
     try{
         //parser.setNamespaceAware (true);     
         //parser.s
         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);
        // parser.setProperty("http://xml.org/sax/properties/declaration-handler", new DTDHandl());
         parser.setProperty("http://apache.org/xml/properties/schema/external-noNamespaceSchemaLocation",SchemaUrl);
        // parser.setFeature("http://xml.org/sax/features/namespace-prefixes", true);
        // System.out.println(parser.getDTDHandler());
        // UnparsedCache cache = new UnparsedCache();
       //  parser.setDTDHandler(cache);
         InputSource inputSource =new InputSource(new java.io.FileInputStream(new java.io.File(XmlDocumentUrl)));
       //  parser.setDTDHandler(new myDTDHandler());
         //parser.setEntityResolver(new CustomResolver());
     //  parser.setContentHandler(this);
         Validator handler=new Validator();
         parser.setErrorHandler(handler); 
         parser.parse(inputSource);
         if(handler.validationError==true)
           System.out.println("XML Document is not valid");
         else                  
           System.out.println("XML Document is valid");
         for(int i=0;i<ErrorLines.size();i++){
             System.out.println(ErrorLines.elementAt(i));
   }catch(java.io.IOException ioe){  
     System.out.println("IOException"+ioe.getMessage());   
   }catch (SAXParseException e) {
     System.out.println("SAXParseException "+e.getMessage());   
  }catch (SAXException e) {
     System.out.println("SAXException"+e.getMessage());   
     return ErrorLines;
what could be soln to this.

Hi
Venky_Ferrari.
Based on your description, your case related to XMLXSD, SO I will move your thread to
Data Platform Development > XML, System.Xml, MSXML and XmlLite      
forum for better support.
Best regards,
Kristin
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey.

Similar Messages

  • What is the best cheap/free search and replace software for .xml files?

    Transferring my iTunes library from PC to Mac I have reached the stage where I want to edit the .xml file from PC file paths to Mac ones - which would be the best preferrably free software to do this on?

    Perhaps my comment in your other thread will help.
    tt2
    PS I don't know about the Mac, but Notepad++ will probably do your search & replace on the PC if you have to edit the XML.
    Message was edited by: turingtest2

  • Package for xml file insersion

    hi every body
    if any body know the link for the package of xml file insersion into oracle database. and also parser for xml file then plz tell me.
    my email address is " [email protected] "

    hi every body
    if any body know the link for the package of xml file insersion into oracle database. and also parser for xml file then plz tell me.
    my email address is " [email protected] "

  • External dependency on remote dtd and xsd files

    The question bugs me for years, please help.
    Should we download external dtd and xsd files declared for web.xml and faces-config.xml and pack them in the war files to eliminate the external dependency.
    e.g.
    http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd
    http://java.sun.com/dtd/web-facesconfig_1_0.dtd
    Thanks

    Hi Srikanth,
    Have you done this?
    SAP HELP
    <i>You want to import an XSD document myMessage to the Integration Repository; this document references three other XSD documents myStr1, myStr2, and myStr3 by using the <include> statement. One option is to first import myMessage. The External References tab page then shows that three documents are referenced and that these documents are not yet in the Integration Repository.  Next, create further external definitions for myStr1, myStr2, and myStr3 in the same namespace and specify the source for each of these documents. If the source is not contained in the document itself, you will find it in the referencing document. If you refresh the display of the external definition for myMessage, the External References tab page shows that the documents have been found in the Integration Repository. You can then navigate to the other referenced external definitions in the Integration Repository by double clicking.</i>
    Also, try activating just in case you haven't.
    Regards
    Vijaya

  • 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.

  • TS1717 when trying to import cd the following message appears "the current encoder settings for bit rate and sample rate are not valid for this file"?

    Trying to import cd when this message appears "the current encoder settings for bit rate and sample rate are not valid for this file".  Any suggestions?

    Thanks so very much.  I chose MP3 and Download and it is working beautifully.  Have a wonderful day and it is so nice of you to get right back to me.  I'm trying to cut a DVD for my grandson's grad party and I got most of the photos and didn't have any music since I lost everything in a clean install.  Could hug you!

  • Urgent Requirement : XSD Validation for internal references

    Hi,
    I have a requirement , according to which....i have
    Invoice Date and Contract Date and XSD validations on these two fields are dependent.
    i.e, invoice date is required if contract date is absent .
    Contract date is required if invoice date is absent.
    How can we validate the xml file with this scenario using XSD.
    Thanks for the help....in advance.
    Regards,
    Aru

    Hi,
    The solution to the problem u gave works fine but validates like AND condition not OR.........
    Any other answers..........Thanks for ur reply......
    Aru

  • Newbie help please:  "Validation of XML file failed."

    Hopefully my question is short and easy.
    I'm a developer and haven't used FrameMaker before. However for unforeseen reasons, I've inherited our technical help documentation constructed in FrameMaker which I've never used. Unfortunately I'm under a very tight deadline and I'm attempting to update our already existing and fairly extensive application help files.
    However, I'm getting a "Validation of XML file failed" error for 90% of our .xml help docs. I opened our .book file in FrameMaker fairly easily, and can see all of our .xml files. However the variables already embedded in the documents aren't being recognized and seem to be causing the above error. I've located our variable definition files (xml) in the concepts folder, but FrameMaker doesn't seem to recognize them. Any suggestions on what I can check or how I can get FM to refer to the variable definitions? I'm working with a new installation of FM, is there some setup I overlooked?
    Many thanks,
    dana.

    Sheila and Rick,
    Thank you both so much for your offer of help. My apologies for not replying earlier. Other 'emergencies' and priorities at work took me in other directions. It turns out another solution has been found for the time being. But thank you again for your replies. They say a lot about this community and its support. :)
    Thanks again,
    dana.

  • Validating large xml files

    In our application we have a requirement to validate large xml file (around 40 mb) against a simple schema file.
    I have tried all options(Sax and Dom) mentioned in below article on sun site -
    http://java.sun.com/developer/EJTechTips/2005/tt1025.html
    but with all of these approches the validation process just hangs for hours.
    Even i am running my test case for this validation by allocating 1 GB memory to test case, on latest processor(core-2 duo) but still it just hangs and returns after a long duration.
    If needed i can provide sample test case, schema file and xml file.
    Please help me to know if its a problem with JAXP 1.3 Schema Validation Framework (SVF) to handle large files, or if there is any other efficient way of validating large xml file.
    Regards
    Rahul

    you may want to split the XML to 10MB each and parse the XML's separately or store in a database and read the XML using XQuery.
    I am sure there may be better ways to do this, will see experts opinions here.

  • How open and edit the coherence.xml file?

    How can I open and edit the coherence.xml file?
    I cannot find the coherence.xml file in the coherence.jar package.
    Thank you,
    June

    If you are intent on changing the coherence.xml file, then you could use the JAR command (that comes with Java) to extract the coherence.xml file from coherence.jar and the later repackage the coherence.jar file using the udpated coherence.xml file, e.g.:
    C:\java\opt\coherence-331\lib>jar -xvf coherence.jar tangosol-coherence.xmlextracted: tangosol-coherence.xml>
    Instead of using JAR, on Windows you can associate the .JAR, .WAR and .EAR extensions with WinZip and use it to access / modify the contents of JAR files.
    However, the suggested approach is as follows, and does not include any changes to the tangosol.jar file:
    The tangosol-coherence-override-dev.xml file can be found in the coherence.jar file. After editing this file (in this case to define a unique value for the port system-property value for the multicast listener), save the file and add it to the server's classpath. When the server is executed, the values in the tangosol-coherence-override-dev.xml file will override any corresponding settings in the tangosol-coherence.xml file.Peace,
    Cameron Purdy | Oracle Coherence

  • How to create xml file from Oracle and sending the same xml file to an url

    How to create xml file from Oracle and sending the same xml file to an url

    SQL/XML (XMLElement, XMLForest, XMLAgg, etc) and UTL_HTTP.
    Whether that works for you with the version of Oracle you have, your requirements, and needs is another story. A little detail goes a long way.

  • How to edit xml file particular value. and how to send xml file over ip address 192.168.2.10 using ftp

    how to edit xml file particular value. and how to send xml file over ip address 192.168.2.10 device using ftp through Ethernet

    Hello
    For using FTP function in LabVIEW, I recommend you to check this document: FTP Basics
    Also, take a look at FTP Browser.vi, which is available at the Example Finder.
    To edit a XML file, try to use VIs in XML palette. Maybe Write to XML.vi helps you.
    Post your current VI if possible.
    Regards
    Mondoni

  • Make DW default for XML files?

    I'm sure there's a way to do this that I'm missing, but I'd like to make DW my default app for XML files.  I know how this can be done on Windows (using "open with" and changing default), but I'm using Mac OSX.  I tried messing with the file types section of DW's preferences, but it didn't work.  Anyone know how to fix this?  Thanks.

    In the Mac Finder, select an XML file, and click More Info (or press Cmd+I - that's I, not a lowercase L) to bring up an Info panel. Expand the section that says Open With, and then select Dreamweaver from the pop-up menu (click Other, if it's not listed). Then click the Change All button to apply it to all XML files.

  • Generating XML from SQL queries and saving to a xml file?

    Hi there,
    I was wondering if somebody could help with regards to the following:
    Generating XML from SQL queries and saving to a xml file?
    We want to have a stored procedure(PL/SQL) that accepts an order number as an input parameter(the procedure
    is accessed by our software on the client machine).
    Using this order number we do a couple of SQL queries.
    My first question: What would be our best option to convert the result of the
    queries to xml?
    Second Question: Once the XML has been generated, how do we save that XML to a file?
    (The XML file is going to be saved on the file system of the server that
    the database is running on.)
    Now our procedure will also have a output parameter which returns the filename to us. eg. Order1001.xml
    Our software on the client machine will then ftp this XML file(based on the output parameter[filename]) to
    the client hard drive.
    Any information would be greatly appreciated.
    Thanking you,
    Francois

    Hi
    Here is an example of some code that i am using on Oracle 817.
    The create_file procedure is the one that creates the file.
    The orher procedures are utility procedures that can be used with any XML file.
    PROCEDURE create_file_with_root(po_xmldoc OUT xmldom.DOMDocument,
    pi_root_tag IN VARCHAR2,
                                            po_root_element OUT xmldom.domelement,
                                            po_root_node OUT xmldom.domnode,
                                            pi_doctype_url IN VARCHAR2) IS
    xmldoc xmldom.DOMDocument;
    root xmldom.domnode;
    root_node xmldom.domnode;
    root_element xmldom.domelement;
    record_node xmldom.domnode;
    newelenode xmldom.DOMNode;
    BEGIN
    xmldoc := xmldom.newDOMDocument;
    xmldom.setVersion(xmldoc, '1.0');
    xmldom.setDoctype(xmldoc, pi_root_tag, pi_doctype_url,'');
    -- Create the root --
    root := xmldom.makeNode(xmldoc);
    -- Create the root element in the file --
    create_element_and_append(xmldoc, pi_root_tag, root, root_element, root_node);
    po_xmldoc := xmldoc;
    po_root_node := root_node;
    po_root_element := root_element;
    END create_file_with_root;
    PROCEDURE create_element_and_append(pi_xmldoc IN OUT xmldom.DOMDocument,
    pi_element_name IN VARCHAR2,
                                            pi_parent_node IN xmldom.domnode,
                                            po_new_element OUT xmldom.domelement,
                                            po_new_node OUT xmldom.domnode) IS
    element xmldom.domelement;
    child_node xmldom.domnode;
    newelenode xmldom.DOMNode;
    BEGIN
    element := xmldom.createElement(pi_xmldoc, pi_element_name);
    child_node := xmldom.makeNode(element);
    -- Append the new node to the parent --
    newelenode := xmldom.appendchild(pi_parent_node, child_node);
    po_new_node := child_node;
    po_new_element := element;
    END create_element_and_append;
    FUNCTION create_text_element(pio_xmldoc IN OUT xmldom.DOMDocument, pi_element_name IN VARCHAR2,
    pi_element_data IN VARCHAR2, pi_parent_node IN xmldom.domnode) RETURN xmldom.domnode IS
    parent_node xmldom.domnode;                                   
    child_node xmldom.domnode;
    child_element xmldom.domelement;
    newelenode xmldom.DOMNode;
    textele xmldom.DOMText;
    compnode xmldom.DOMNode;
    BEGIN
    create_element_and_append(pio_xmldoc, pi_element_name, pi_parent_node, child_element, child_node);
    parent_node := child_node;
    -- Create a text node --
    textele := xmldom.createTextNode(pio_xmldoc, pi_element_data);
    child_node := xmldom.makeNode(textele);
    -- Link the text node to the new node --
    compnode := xmldom.appendChild(parent_node, child_node);
    RETURN newelenode;
    END create_text_element;
    PROCEDURE create_file IS
    xmldoc xmldom.DOMDocument;
    root_node xmldom.domnode;
    xml_doctype xmldom.DOMDocumentType;
    root_element xmldom.domelement;
    record_element xmldom.domelement;
    record_node xmldom.domnode;
    parent_node xmldom.domnode;
    child_node xmldom.domnode;
    newelenode xmldom.DOMNode;
    textele xmldom.DOMText;
    compnode xmldom.DOMNode;
    BEGIN
    xmldoc := xmldom.newDOMDocument;
    xmldom.setVersion(xmldoc, '1.0');
    create_file_with_root(xmldoc, 'root', root_element, root_node, 'test.dtd');
    xmldom.setAttribute(root_element, 'interface_type', 'EXCHANGE_RATES');
    -- Create the record element in the file --
    create_element_and_append(xmldoc, 'record', root_node, record_element, record_node);
    parent_node := create_text_element(xmldoc, 'title', 'Mr', record_node);
    parent_node := create_text_element(xmldoc, 'name', 'Joe', record_node);
    parent_node := create_text_element(xmldoc,'surname', 'Blogs', record_node);
    -- Create the record element in the file --
    create_element_and_append(xmldoc, 'record', root_node, record_element, record_node);
    parent_node := create_text_element(xmldoc, 'title', 'Mrs', record_node);
    parent_node := create_text_element(xmldoc, 'name', 'A', record_node);
    parent_node := create_text_element(xmldoc, 'surname', 'B', record_node);
    -- write the newly created dom document into the buffer assuming it is less than 32K
    xmldom.writeTofile(xmldoc, 'c:\laiki\willow_data\test.xml');
    EXCEPTION
    WHEN xmldom.INDEX_SIZE_ERR THEN
    RAISE_APPLICATION_ERROR(-20120, 'Index Size error');
    WHEN xmldom.DOMSTRING_SIZE_ERR THEN
    RAISE_APPLICATION_ERROR(-20120, 'String Size error');
    WHEN xmldom.HIERARCHY_REQUEST_ERR THEN
    RAISE_APPLICATION_ERROR(-20120, 'Hierarchy request error');
    WHEN xmldom.WRONG_DOCUMENT_ERR THEN
    RAISE_APPLICATION_ERROR(-20120, 'Wrong doc error');
    WHEN xmldom.INVALID_CHARACTER_ERR THEN
    RAISE_APPLICATION_ERROR(-20120, 'Invalid Char error');
    WHEN xmldom.NO_DATA_ALLOWED_ERR THEN
    RAISE_APPLICATION_ERROR(-20120, 'Nod data allowed error');
    WHEN xmldom.NO_MODIFICATION_ALLOWED_ERR THEN
    RAISE_APPLICATION_ERROR(-20120, 'No mod allowed error');
    WHEN xmldom.NOT_FOUND_ERR THEN
    RAISE_APPLICATION_ERROR(-20120, 'Not found error');
    WHEN xmldom.NOT_SUPPORTED_ERR THEN
    RAISE_APPLICATION_ERROR(-20120, 'Not supported error');
    WHEN xmldom.INUSE_ATTRIBUTE_ERR THEN
    RAISE_APPLICATION_ERROR(-20120, 'In use attr error');
    WHEN OTHERS THEN
    dbms_output.put_line('exception occured' || SQLCODE || SUBSTR(SQLERRM, 1, 100));
    END create_file;

  • Flash Pro CS6 BUG - inconsistent end of line for xml files in library saved in xfl - MESSES UP SVN

    When saving in XFL with Flash CS6 on Mac (it also happened in CS5.5), the generated xml files in library often have inconsistend end of line, which blocks SVN commits and I have to manually go in the files and make them consistent.
    The XML nodes themselves all have \r\l as end of line, while, within <[CDATA[]]>, they only have \r.
    We think this happens only when creating new library items on mac, on windows it doesn't happen.
    This slows us down incredibly when working on a team using svn.
    SVN doesn't upload files with inconsistend line ending.
    Line ending shoul be consistent within the same xml file to make svn operations smooth.
    Check an image of the bug:
    http://www.pippoflash.com/_test/flash_bug_eof.png
    you can see clearly the differences.
    thank you
    Filippo

    Thanks Filippo, I could see that now!
    While I was investigating this, I found that this is even happening on a file created and saved on just Windows. I was able to reproduce this using the following steps
    - Create a new AS3 file on Windows
    - Drag out a component to the stage say a Button component from the User Interface section of the Components panel
    - Convert the button component to a Movie Clip Symbol
    - Save the file as XFL and examine the Library XML files (the End of Line is just 'LF' in CDATA section whereas it is 'CR LF' everywhere else)
    Since you were saying 'Items created in windows have no problem', does that means, SVN can commit those without any issues for you? And do you face problem only when the file is Created and Saved on Mac(where the end of line is just LF every where) but Modified and Re-saved on Windows(where the end of line is inconsistent)? 
    Thanks!
    Mohan

Maybe you are looking for