Require to validate the xml

I have two requirements:
1. to Validate the xml to follow a predefined structure - this is done.
2. to validate the xml on basis of some conditions - this is to be done.
To eleborate, suppose i have a xml structure such as:
<books>
  <book>
      <author name = "abc" publisher="xyz"/>
      <title>something</title>
       <price>$2</price>
  </book>
  <book>
     <author name = "cde" publisher="uvw"/>
      <title>otherthing </title>
       <price>$2</price>
  </book>
</books>these data are to be uploaded to the database but before uploading the database i want to perform some validations on the data for ex. if the author name is "abc", then the publisher can only be "xyz".
Any idea how the validation on the data inside the can be performed.

Use a validating parser (any recent Xerces, for one) and switch on the validation feature. Very much vendor-specific, so look at the docs of your parser. Oh, you do have a schema for these documents, don't you?

Similar Messages

  • Validate the XML tag value and display the Binding data in XDP

    Hi,
    I am new to Adobe Life Cycle.... and i am working on the following requirement and XML file is enclosed...
    1. Need to validate the XML value of <pp> with condition
    2. Basing on the value of <pp>, need to display the <ct> values in text field
    If i simply bind, it takes the values from top of array and display..
    Please suggest how to restrict the binding values basing on the condition.
    Thanks
    Madhu

    Hi Paul,
    Thank you for quick respose.
    The solution which you have give me not excatly looking for.... working for the solution in alternative methods...
    Regards
    madhu

  • WARNING: Failed to validate the xml content

    Hi,
    We notice this error when we start the web logic admin console and also in many of Hyperion log files. There are many instances of this error and everything is pointing to different lines in this file “jps-config.xml”.
    WARNING: Failed to validate the xml content. cvc-complex-type.2.4.a: Invalid content was found starting with element 'serviceInstance'. One of '{"http://xmlns.oracle.com/oracleas/schema/11/jps-config-11_1.xsd":serviceInstance}' is expected.
    Location: line 378 column 91 of file:/D:/Oracle/Middleware/user_projects/domains/EPMSystem/config/fmwconfig/mbeans/../jps-config.xml.
    Oct 16, 2012 4:21:56 PM oracle.security.jps.internal.common.util.StrictValidationEventHandler handleEvent
    Any ideas?
    Regards,
    Ragav.
    Edited by: ragavhere on Oct 17, 2012 2:04 PM

    Hi,
    can you please provide more details on your application?
    Which version of ADF are you using and which server. Are you trying to deploy on GlassFish server?
    Which IDE are you using?
    Perhaps this will be useful:
    https://blogs.oracle.com/shay/entry/deploying_oracle_adf_applications_to
    Regards,
    Dimitrios.

  • How to validate the Xml File With Java

    Hi,
    Can pls tell me. I want to validate the XML File for the Some Mandartory TAG. if that if Tag null i want to generate error xml file with error and i want move another folder with java. pls help me as soon as possible

    Use a validating parser (any recent Xerces, for one) and switch on the validation feature. Very much vendor-specific, so look at the docs of your parser. Oh, you do have a schema for these documents, don't you?

  • Urgent Help required! - Storing the XML as String instead as a file

    Hi,
    I need urgent help on this.
    I have an XML file. I have used org.w3c.dom to build dom and manipulate the XML file.
    I have updated the values for some of the nodes and I have deleted some of the unwanted nodes.
    I am able to save the output of the DOM as another XML file using
    either transform class or XMLSerializer with OutputFormatter class.
    But my requirement is to save the output of the DOM into a String instead of a file.
    When I save it in String, I need to have the following XML decalration and DOCTYPE declration also with it.
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE Test SYSTEM "Test.dtd">
    Can anyone pls help me in this??
    Thanks in Advance. Expecting some inpputs pls....!
    Regards,
    Gayathri.

    hi,
    i think this is what u want
        public static String getXmlString(Document d) {
          StringWriter strResponse = null;
          try {
             OutputFormat format  = new OutputFormat(d);
             strResponse = new StringWriter();
             XMLSerializer serial = new XMLSerializer( strResponse, format );
             serial.asDOMSerializer();
             serial.serialize(d.getDocumentElement());
          catch (Exception e) {
            System.out.println(e.toString());
          return strResponse.toString();
    }HTH
    vasanth-ct

  • Not able to validate the xml document against DTD using SAX

    Hi ,
    i am not able to validate xml document against its DTD using SAX parser even after setting setValidating = true. even if the file is not correct according to DTD , it is not throwing any exception. what could be the reason.? please help..
    kranthi
    this is the code sample i used.
    SAXParserFactory factory = SAXParserFactory.newInstance();
    factory.setValidating(true);
         try {
    factory.newSAXParser().parse(new File("sample.xml"), handler);
         } catch (SAXException e) {
         e.printStackTrace();                         System.exit(2);
         } catch (ParserConfigurationException e) {
    e.printStackTrace();
    }

    Hi karthik
    Thanks for your response
    Actually iam a beginner in java coding hence struggling to come up with the things
    I tried putting your code and onserver side i see it is returning 09:12:17,234 INFO [STDOUT] [root: null]
    actually the same program i wrote in java
    and the same method i was calling from the main
    and it is working fine and the xml document is getting displayed one important thing to be noted here is that the factory.newDocumentBuilder().parse(new File(filename));is returing XmlDocument
    and the printing takes place
    but the in same method public static Document parseXMLFile(String filename, boolean b) in servlet
    the line factory.newDocumentBuilder().parse(new File(filename)); is returning DeferredDocumentImpl
    and this creating problem , had it returned XmlDocument
    i would have printed the elements one one
    but as it is returning deferredimpl
    iam unable to print the elements
    could you please tell me why factory.newDocumentBuilder().parse(new File(filename)); is returning DeferredDocumentImpl
    in servlets but in plain java pogram it is returing XmlDocument
    Thanks
    Bhanu

  • Where can i find ozxmlscene DOCTYPE to validate the XML Motion files i create

    Hi ,
    i'm creating Motion files to be inserted into FCP 7 TimeLine or Motion 3
    It works perfectly except sometimes the XML file i produce crash FCP or Motion
    (theses .motn files are allways made with the same methods by a php script that produces UTF-8 motn files)
    I checked the content of th files without finding any problem
    As a matter of fact i still haven't found the way to validate these xml files for i was unable to find th OZXMLSCENE DTD for it
    Could you help me please?
    Francis67

    The enabling part will have to be done with LiveCycle Reader Extensions, which is also available from Datalogics as the PDF Java Toolkit with Reader Extensions.
    If you can get all of your users to move to Reader 11 and don't use digital signatures, consider:
    1. Appligent's AppendPDF Pro, perhaps along with FDFMerge.
    2. Debenu's Quick PDF Library
    3. iText

  • Help require to get the XML output to design template- JDE

    Hi Friends,
    I am asking this question from JDE perspective.I want to design XMLP Template for R40572 Check Printing.
    When I upload an blank template and after attaching RD, When ever I initiate a check from P04572 Application.RThe Write Row exit will lead to check printing which in turn will call a batch R04571 and this batch will call R04572(Which I require the XML output) since it is the second report and we cant direct it to local server I am not able to get the XML output..
    Another think is since its running in server i think its not taking the RD modification we done in loacl because it always fires PDF .

    Hi,
    I assume you're Using XMPOSA for generating the files locally. What I suggest is, you set the application to run with the report definition by default. That way, even when it is called, it will be called along with the report definition. You can take the resultant XML file from P95630
    hope this helps,
    -Domnic

  • Error while validating the xml file

    Hello All,
    DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
    dbf.setValidating(false);
    DocumentBuilder db = dbf.newDocumentBuilder();
    doc = db.parse(new ByteArrayInputStream(xmlString.getBytes()));
    In this code even though I have set the validation of instance of DocumentBuilderFactory to false it still tries to validate the xml file using the dtd. How do I avoid the validation of the xml file by the dtd file ?.
    Is anybody having any suggestions for that ?.
    Help needed urgently.
    Thanks and regards,
    Sachin

    Thanks for the prompt help. Is there any other way instead of removing the DTD line ?. Because the xml is coming as a string and removing the dtd and then adding it will unneccesary hamper performance. Do you any other way in which even though I don't remove the line I get the output without removing the dtd line ?.
    thanks and regards,
    Sachin

  • Reading the xml file in customized table.

    Hi Experts ,
    I have a requirement to read the xml file in one "z" table . Can anyone let me know the exact steps .
    Thank you
    Ashutosh

    Hi Ashutosh,
    1. First read the file in BINARY MODE into an XSTRING.
    2. Then use the method create_istream_xstring to create the input stream
    3. Then you need to create the document tree and the parser
    4. Once your Document tree and your parser are created now can use the document tree to access individual elements.
    Some Class interfaces that maybe helpful to you are as follows: if_ixml_node, if_ixml_node_iterator, if_ixml_element....etc
    DATA:o_ixml                    TYPE REF TO if_ixml,
               o_streamfactory   TYPE REF TO if_ixml_stream_factory,
               o_istream              TYPE REF TO if_ixml_istream.
               o_parser               TYPE REF TO if_ixml_parser          
               o_document          TYPE REF TO if_ixml_document
    o_ixml = cl_ixml=>create( ).
    o_istream = o_streamfactory->create_istream_xstring( string = <give the xstring name here>).
    o_document = o_ixml->create_document( ).
    o_parser = o_ixml->create_parser( stream_factory = o_streamfactory
                                                                           istream = o_istream
                                                                       document = o_document ).
    You can make the final code as dynamic as possible to read into an internal table.
    Regards
    -Joe

  • How to edit the existing data in the XML file from java programming.

    Hi all
    i am able to create XML file with the sample data as below from java programming.
    i need sample code on how to edit the existing data in the XML file?
    for example
    <?xml version="1.0"?>
       <mydata>
               <data1>
                         <key1>467</key1>
                        <name1>Paul</name1>
                        <id1>123</id1>
              </data1>
              <data2>
                         <key2>467</key2>
                        <name2>Paul</name2>
                        <id2>123</id2>
              </data2>
        </mydata>
    i am able to insert the data in the XML.
    now i need sample code on how to modify the data in the above XML file from the java programming for only key2,name2,id2 tags only. the remaining tags data in the XML file i want to keep same data except for key2,name2,id2 which are i want to modify from java code
    Regards
    Sunil
    [points will be always rewardable]

    hi
    u need a parser or validate the xml file for to read the xml file from java coding u need for this
    xml4j.jar u can download this file  from here
    http://www.alphaworks.ibm.com/tech/xml4j
    or we can use the SAX(simple API for XML)
    some sample applications for this
    http://www.java-tips.org/java-se-tips/javax.xml.parsers/how-to-read-xml-file-in-java.html
    http://www.developertutorials.com/tutorials/java/read-xml-file-in-java-050611/page1.html
    http://www.xml-training-guide.com/e-xml44.html
    let me know u need any other info
    bvr

  • How to rename the XML file generated during payment run

    Hi,
    We have a requirement to rename the XML file during payment run, format some fields of XML file and upload it onto Application server with the new XML file name. All these activities need to be performed during payment run F110.
    Please let know if there is any User exit or Enahancement to achieve these functionalities.
    Thanks !
    Regards,
    Ravinder

    Hi,
    We have achieved the second functionality also i.e. populating the additional nodes or custom nodes of an extended tree.
    This is what we have done...
    We have copied the standard exit FM: DMEE_EXIT_TEMPLATE_EXTEND_ABA into a custom one and assigned it to each (custom) node in 'Source' tab. Line item text FPAYP-SGTXT will not be returned via this FM, so we fetched it explicitly from BSEG table using the input FPAYP-DOC2R (this field will have the company code, document number, fiscal year and item no, all concatenated).
    Thanks,
    /Ravinder

  • Ignoring the DOCTYPE element while parsing the xml

    I am using JAXB parser to read from and write into my xml file using java code. My xml file contains a DOCTYPE element pointing to a .dtd file which does not exist, due to which I get a FileNotFoundException when JAXB tries to read the xml file. Hence, after unmarshalling the xml file using jaxb, I use a SAXParser to get an XMLReader which removes this DOCTYPE element as given below -
    SAXParserFactory parserFactory = SAXParserFactory.newInstance();
    parserFactory.setValidating(false);
    XMLReader reader = parserFactory.newSAXParser().getXMLReader();
    reader.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);
    After making the required changes to the xml file and marshalling it back, I then use an XMLWriter to add the DOCTYPE element back to the xml file as given in the code snippet below -
    SAXReader saxReader = new SAXReader();
    Document document = saxReader.read(_file);
    document.addDocType(rootElement, publicUri, systemUri);
    XMLWriter output = new XMLWriter(new FileWriter( _file ));
    output.write( document );
    output.close();
    Right now I am using both, the JAXB parser to read from and write into the xml file and SAXParser/SAXRader just to delete/add the DOCTYPE element. I want to avoid using two different parsers in my class and want to know if JAXB provides any mechanism to delete and then add this element while parsing the xml file.

    Standard answer for this FAQ: set an EntityResolver on your parser that sends an empty string instead of the DTD. The API docs have an example that you could modify to do that.

  • Filtering the XMLs that get generated from IDOC

    Hi All,
    I have requirement to filter the XML files those get generated when a BP relationship is created. The required configuration has been done. The XMLs are getting generated, but I want to generate the XML is only if it is Contact Person Relationship.
    Can somebody tell me how I can achieve it?
    Regards,
    - Prasenjit

    I am using an extended version of CRMXIF_PARTNER_REL_SAVE IDOC and in TCODE we21, I created an XML File port. Can we filter the IDOCs from which the XML will be generated, so that we can select the IDOCs we want to generate the XML from?
    Regards,

  • How to validate the storage location in me21n?

    Hi,
    I am having the requirement to validate the storage location in me21n transaction
    whether the entered material is belongs to that storage location or not.
    is there any exit to this requirement?
    Helpful information is rewarded.
    Regards,
    Riaz.

    Hello Riaz,
    The BADI <b>ME_PROCESS_PO_CUST</b> would be very useful here. If you want to trigger your validation message after user entered the data then use method <b>PROCESS_ITEM</b>.
    I hope this helps.
    Best regards,

Maybe you are looking for

  • Sec_error_unknown_issuer for a certificate trusted by every other browser

    Dear Forum mebers, I completely gave up this, so I hope somebody may have seen this issue and could resolve it :) We have an intranet corporate site, based on Windows Server 2012 R2 IIS server. I built up a single, WS2012R2 Standalone Root Certificat

  • To set default value as blank  in drop down by index

    Hi Experts , I'm using Adaptive RFC model to get data from SAP and I've to create DropDownByIndex  and populate it with the data. I am getting data in the drop down but when my screen is displayed , I contains one of the values from the Drop down as

  • Photo transfer, SD to iPad

    I would like to know how to transfer photos from an SD card into my iPad.  I have the SD card in the appropriate camera connection kit reader, and that is attached to my iPad, but I don't see how to find and transfer the photos.

  • HT1338 MiniDVI port suddenly stopped working

    I first thought my external monitor or HDMI cable stopped working, but when I tried with my iMac, I realized it must be the port on the MacBookPro. I upgraded to Mountain Lion about a week ago and the external worked until this morning. Anyone else h

  • Help with my printing nightmare!

    Hello, I added an HP desject 3620 to my MB, but when I go to system preferences, then go to set up a printer, my printer shows there, but when I press + to add the printer , it doesn't show in the next window, so I can't add it. Any advices to that s