Validate XML record-by-record

Hi,
Our process receives XML files on a daily basis and the files are processed through Java.
If a record in XML fails to validate against the XSD (i.e. schema validation error), the whole file gets rejected. The file gets loaded only after that record is corrected. That is the limitation of Java.
But now we will now be processing the XML files through PL/SQL.
I wanted to know whether the XML can be validated against the XSD record-by-record? Is it possible that only the record that fails to validate is rejected while the remaining records get loaded into the database?
If so, could you please also suggest the correct approach?
Thanks in advance.

It should be possible but it will take some work because you only want/need to validate the XML starting from a given node against a XSD. Here's my thoughts on what it should take. I'm not sure what your XSD(s) look like so I'll make the following assumptions:
Assumption:
A XSD exists that can validate a single Customer.
A XSD exists that can validate a single Program.
The XML is syntactically valid to allow being created as a DOMDocument or XMLType
You would need to load the full XML file into a DOMDocument or XMLType, both will work fine for parsing. I would lean towards XMLType as you can use XPaths to pull info from the XML. You will then need to pull out the Programs and Customers from main XML. For each Program/Customer, pull out the individual Program/Customer and validate that against the XSD. If it passes validation, continue processing that Program/Customer. If it fails validation, go on to the next Program/Customer and repeat the process.
As I said, this approach only works if the XML is syntactically valid. If you can't load the file, you can't attempt to load the 99 Programs when the 1 Program is way off. If the XML is only invalid per the schema, then you can process as many Programs/Customers that are individually valid.
Hope this helps. I'm sure other methods exist but this is what I could think of.

Similar Messages

  • Message Mapping from flat XML to a Record structure

    Hi All,
    We have a scenario in which the input message is a PDF document. we are following below the blog to convert PDF to XML format which uses <b>PDF box utitlity</b>.
    /people/sap.user72/blog/2005/07/31/xi-read-data-from-pdf-file-in-sender-adapter
    We are able to convert the PDF doc to a flat XML file.
    Now we have the following queries...
    what are the different ways to map the flat XML to our record structure?
    Do we have any utitlity in PDF box to do that?
    Regards,
    Rakesh.

    Hi Rakesh,
    You have Graphical mapping, Java mapping, ABAP mapping and XSLT mapping. The choice depends on the scenario and what target result you require.
    <b>Message mapping using graphical mapping editor:</b>
    http://help.sap.com/saphelp_nw04/helpdata/en/49/1ebc6111ea2f45a9946c702b685299/frameset.htm
    <b>XSLT mapping:</b>
    http://help.sap.com/saphelp_nw04/helpdata/en/73/f61eea1741453eb8f794e150067930/frameset.htm
    <b>Java Mapping:</b>
    http://help.sap.com/saphelp_nw04/helpdata/en/e2/e13fcd80fe47768df001a558ed10b6/frameset.htm
    <b>ABAP mapping:</b>
    http://help.sap.com/saphelp_nw04/helpdata/en/ba/e18b1a0fc14f1faf884ae50cece51b/frameset.htm
    As said earlier, graphical mapping is the simplest and quite a few built in options are available with it, explore it and see which is suitable for your scenario.
    Regards,
    Chandra

  • Cannot open muse file Error Assert: "Corrupt XML in database record U1 class MuseSite"

    I cannot open the .muse file.  The site was saved as a .muse the saved as html and uploaded to web.  Customer has a change and the .muse file will not open.  The error I get is Error Assert: "Corrupt XML in database record U1 class MuseSite".  How can this be fixed? What happened? Please help. I took the html version to DreamWeaver but it is very discombobulated on the design screen and strange coding on the code view.  Please help, customer needs this change asap.
    The error from the muse log is : 
    Build 8: Sun Jun 9 12:23:11 2013 UTC: Assert: Corrupt XML in database record U1 class MuseSite-DataBase/createPersistFromDataBaseRecord+DataBase/instantiate+DataBase/getRootPe rsist+DocumentConversion$/runConversion+DataBase/open+MuseSite$/openSite+NativeOpenProvide r/openThisFile+MuseImportManager/processFile+MuseImportManager/selectMultipleFilesHandler+ end stack
    Build 8: Sun Jun 9 12:23:11 2013 UTC: EXCEPTION:TypeError: Error #1095: XML parser failure: Unterminated attribute.-DataBase/createPersistFromDataBaseRecord+DataBase/instantiate+DataBase/getRoot Persist+DocumentConversion$/runConversion+DataBase/open+MuseSite$/openSite+NativeOpenProvi der/openThisFile+MuseImportManager/processFile+MuseImportManager/selectMultipleFilesHandle r+end stack

    I sent you the file and the info concerning where the file was stored via email.  I am posting that info here as well.
    You Asked:
    The object that's reporting as damaged is a very important one. We may, or may not, be able to repair the file.
    Was the file stored in a shared folder (i.e. Dropbox, Creative Cloud Files, Box, etc.)? No
    Was it stored on a file server that was accessed from two separate copies of Muse? No
    The file was stored  on my personal Network Storage unit utilizing  an Intellinet NAS with 2 1.5TB drives in a raid array. The file was created on  a Mac Pro v 10.6.8
      Model Name:    Mac Pro
      Model Identifier:    MacPro4,1
      Processor Name:    Quad-Core Intel Xeon
      Processor Speed:    2.66 GHz
      Number Of Processors:    1
      Total Number Of Cores:    4
      L2 Cache (per core):    256 KB
      L3 Cache:    8 MB
      Memory:    8 GB
      Processor Interconnect Speed:    4.8 GT/s

  • I am having problems syncing recently recorded songs to my iPod. I am using an ion program to record vinyl records to iTunes. The songs are in the iTune library and will play on the computer. When I try to sync they show up but do not play. help

    I am using an ion piece of equipment to record vinyl reccords to my iMac and in turn save them in iTunes. I have recorded many records this way and have never had a problem until yesterday. I recorded three songs from records to iTunes and was successful as they are on the song list and will play on the iMac. When I tried to sync them to my iPod they showed up on the menu but would not play. The iPod just skipped over the new guys. Am I doing something wrong or has my ion program flipped out? Any help would be appreciated by this old man. Thankyou

    This might sound weird, but here's an idea which worked for me re music that was newly added to itunes and showed up in my ipod but wouldn't play - I simply played the tracks in itunes first, just a second of time or so will do it, not the whole track, then connect the ipod and sync again and this time they played - hope this helps.

  • What do I need to hook up a turntable directly to the iPhone 5s in order to record vinyl records?

    What do I need in order to hook up a turntable directly to the iPhone 5s in order to record vinyl records?

    A preamplifier with an RIAA equalised input for a turntable, preferably a USB one,

  • Process multi-record & multi-record-format files using ESB & File Adapter

    I am looking to process/parse an in-bound file with the following make-up and to load into a database table using the File Adapter, ESB and DB Adapter.
    File Make-Up:
    - each line in the file is a record
    - each record is made up of 12 fields
    - there are multiple record types denoted by the first field in the line
    - record types may or may not have common fields
    - where there are common fields, the field may be in different columns
    - each record is to be inserted into a database table
    Sample File:
    3,,"03-0243-0188132-00",.20,26,075,"","000000006026","","","22/04/08",03 1303
    3,,"03-0243-0188132-00",20.00,26,075,"","","","","22/04/08",03 0579
    5,,"03-0243-0188132-00",99.60,,,"OPENING BALA",,,"ACME GROUP","22/04/08",
    6,,"03-0243-0188132-00",99.60,,,"CLOSING BALA",,,"ACME GROUP","22/04/08",
    8,,"03-0243-0188132-00",-346119.05,16,000,"DEBITS",,,,"22/04/08",
    8,,"03-0243-0188132-00",346119.05,349,050,"CREDITS",,,,"22/04/08",
    9,,"03-0243-0188132-00",-346119.05,16,000,"DEBITS",,,,"22/04/08",
    9,,"03-0243-0188132-00",346119.05,349,050,"CREDITS",,,,"22/04/08",
    Record Types and corresponding format:
    3, Corp ID, A/C Number, Trans Amt, Serial Number, Trans Code, Particulars, Analysis Code, Reference, Other Party Name, Transaction Date, Originating Bank
    5, Corp ID, A/C Number, Opening Balance, Serial Number, Trans Code, Particulars, Analysis Code, Reference, Other Party Name, Transaction Date, Originating Bank
    6, Corp ID, A/C Number, Closing Balance, Serial Number, Trans Code, Particulars, Analysis Code, Reference, Other Party Name, Transaction Date, Originating Bank
    8, Corp ID, A/C Number, Amount, Number, 000, “DEBITS”, Analysis Code, Reference, Other Party Name, Transaction Date, Originating Bank
    8, Corp ID, A/C Number, Amount, Number, 050, “CREDITS”, Analysis Code, Reference, Other Party Name, Transaction Date, Originating Bank
    9, Corp ID, A/C Number, Amount, Number, 000, “DEBITS”, Analysis Code, Reference, Other Party Name, Transaction Date, Originating Bank
    9, Corp ID, A/C Number, Amount, Number, 050, “CREDITS”, Analysis Code, Reference, Other Party Name, Transaction Date, Originating Bank
    Please note that record types 8 and 9 have 2 fixed fields.
    I have tried playing around with the File Adapter and the ESB but not having much luck. Can someone provide any suggestions on how I can handle this?

    James,
    Thanks for your prompt response. I have come across your post previously.
    Please excuse my in-experience (very new to SOA and Oracle SOA Suite) but i have not understood how your post regarding the manual creation of an XSD will assist with my problem. Could you possibly further elaborate on the overall approach i should be taking?
    Regards,
    Simon

  • How to validate xml file with XSD schema ??  in JDK1.4.2

    How to validate xml file with XSD schema ?? in JDK1.4.2
    i dont want to use new Xerec Jar ...
    Suggest option ...

    Please do not double-post. http://forum.java.sun.com/thread.jspa?threadID=5134447&tstart=0
    Then use Stax (Woodstock) or Saxon.
    - Saish

  • How to validate XML Digital Signature with XML DB (o PL/SQL) in Oracle 11g

    Hi,
    Do you know if there is possibility to validate XML Digital Signature using XML DB (or PL/SQL) in Oracle 11g?
    Let say I have CLOB/XMLType containing Digitally Signed XML, and I want to validate, that thsi is proper signature. I also have public key of signer (I could store it in CLOB or file or Oracle wallet).
    Is it possible to do?
    If there is need to install additional component - then which one?
    Regards,
    Paweł

    Hi,
    this is what i got from someone...
    but the links he gave are not opening up...
    u have to place a picture there and have to load the digital signatures as Jpegs on to the server to OA top
    and have to refer them in the XML for dynamically get the signature on the reports
    when u select the properties of the picture placed in the XML template,
    there will be one tab with "URL"... in that u have to give the path for that jpegs
    Pls refer the following documents for enabling digital signature on pdf documents.
    http://iasdocs.us.oracle.com/iasdl/bi_ee/doc/bi.1013/e12187/T421739T481159.htm#5013638    (refer section 'Adding or Designating a Field for Digital Signature'
    http://iasdocs.us.oracle.com/iasdl/bi_ee/doc/bi.1013/e12188/T421739T475591.htm#5013688
    (Implementing a Digital Signature
    Is the BI Publisher installed on your instance of version 10.1.3.4 or higher?
    Pls procure a digital signature as soon as possible. The process can take time. OR we could use any certificate that you already might have OR generate a certificate using Oracle Certificate Authority for demo.

  • Validate XML is disabled

    Hi,
    I have a simple XML file with a internal DTD. I want to validate the XML file against this internal DTD. Following is the XML file with the internal DTD. Can you please let me know, why is the Validate XML disabled.
    <?xml version='1.0' encoding='windows-1252'?>
    <!DOCTYPE name_details [
    <!ELEMENT name_details (first_name, middle_name, last_name, e_num)>
    <!ELEMENT first_name (#PCDATA) >
    <!ELEMENT middle_name (#PCDATA)>
    <!ELEMENT last_name (#PCDATA)>
    <!ELEMENT e_num (#PCDATA)>
    ]>
    <name_details>
    <first_name>fn=John</first_name>
    <middle_name>mi=Smith</middle_name>
    <last_name>ln=Putt</last_name>
    <emp_number>e_num=988-987-898</emp_number>
    </name_details>
    Thanks
    kiran

    "The Validate XML command will validate the XML against a schema registered with JDeveloper defined in the XML file. To register a schema with JDeveloper choose Tools> Preferences> XML Schemas. This command on the context menu is disabled whenever an XML file does not have an XML namespace defined. "

  • Validate XML using XSD (XML Schema)

    Hi experts.
    Is there any way in ABAP to validate XML file against specified XSD file?
    I found only possibility to validate against DTD, but no XSD. As far as I know this is only possible in Java, or is a part of XI. Is it doable without Java or XI (on NetWeaver 2004s)?
    Help appreciated (and rewarded).
    Regards, Frantisek.

    Hello
    Perhaps you missed this link: [How to Perform XML Validations in SAP NetWeaver Process Integration 7.1|https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/d06dff94-9913-2b10-6f82-9717d9f83df1]
    Regards
      Uwe

  • Validate XML with Schema?

    So, according to Adobe...
    quote:
    Dreamweaver CS3 continues to support not only the creation
    and editing of XML and XSL files, but it also allows you to import
    DTDs and schemas and to validate XML documents.
    Does anyone know how to accomplish this task? Adobe's
    documentation on this topic seems be less current than their
    marketing material.
    I mean, I'm assuming from the way this is worded it means
    that you can "import DTDs and schemas and ... validate XML
    documents"
    with said schemas. Or is this just some shifty marketing
    trickery which really means you can import (i.e., open) a DTD or
    schema, and, as a completely unrelated task, you can "validate"
    your XML file - to the extent that Dreamweaver will tell you if you
    forgot to close a tag?

    I tried to move all the xml, class and xsd files in the same folder and it still didn't work...
    And I can't hard coded the xsd file on the document... so the only way is to set the xsd location inside the java codes... here's what I have:
    static final String JAXP_SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
    static final String W3C_XML_SCHEMA = "http://www.w3.org/2001/XMLSchema";
    static final String JAXP_SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource";
    File xsdFile = new File("schema.xsd");
    saxParser.setProperty(JAXP_SCHEMA_LANGUAGE, W3C_XML_SCHEMA);
    saxParser.setProperty(JAXP_SCHEMA_SOURCE, xsdFile);
    Please help... thx.

  • Validate XML against  one DTD

    Hello
    I have several XML files and into this XML files there is not th DTD call.
    i have another file, the DTD.
    There is any method or code example for, without modify the XML files for including the DTD call, validate the XML againts one DTD?
    thanks

    Alice (guest) wrote:
    : Hi! I have obtained the v2 parser for java and the one for
    plsql.
    : I want to validate xml documents against a DTD file provided
    by
    : another program. I can't find any sample code that does setDTD
    : for validation.
    : Can you tell me how it can be done, please?
    : Thanks in advance!
    The method to set the DTD is setDoctype().
    Stub code follows:
    // Test using InputSource
    parser = new DOMParser();
    parser.setErrorStream(System.out);
    parser.showWarnings(true);
    FileReader r = new FileReader(args[0]);
    InputSource inSource = new InputSource(r);
    inSource.setSystemId(createURL(args[0]).toString());
    parser.parseDTD(inSource, args[1]);
    dtd = (DTD)parser.getDoctype();
    r = new FileReader(args[2]);
    inSource = new InputSource(r);
    inSource.setSystemId(createURL(args[2]).toString());
    parser.setDoctype(dtd);
    parser.setValidationMode(true);
    parser.parse(inSource);
    doc = (XMLDocument)parser.getDocument();
    doc.print(new PrintWriter(System.out));
    Oracle XML Team
    http://technet.oracle.com
    Oracle Technology Network
    null

  • Validate  XML against  XML Shema while marshalling/Unmarshalling in JAXB?.

    Hi,
    Can i validate XML documents against XML Shema when i marshall/unmarshall the same using JAXB API?.
    Thanks

    Well, it is weird, but, the code below works when validating the NonEmptyString type:
    XmlSchemaSet schemaSet = new XmlSchemaSet();
    schemaSet.Add(null, "LogConfig.xsd");
    XDocument doc1 = XDocument.Load("LogConfig.xml");
    doc1.Validate(schemaSet, new ValidationEventHandler(ValidationCallBack), false);
    However, if I leave the <LogName> empty it does not valid the values set on xsd fixed attribute, 
    The solution?
    Well, I'm validating the same xml twice, the code above and the code on my first question.

  • CS6 stamp tool doesn't work with action / record ( tool record is enabled ) other tools works

    CS6 stamp tool doesn't work with action / record ( tool record is enabled ) other tools works

    At one time tool  recording was not possible and if you install Adobe Scriptlistener Plug-in Adobe will disable tool recording its never an option.
    I use and record actions all the time and was looking forward to tool recording when Adobe announced it.  However I found what they delivered was  of very limited value because of the restrictions. I do not care that Adobe disables tool recording on my machine.
    The amount of data that gets reordered seems also vary between machines.  I found that Action recorded on fast machine are not usable on slow machine.  Fast machine recorder too much data.
    Documents you use such action on must also have the same size and resolution as the document you recorded the action on. Quite a restriction.
    You problem may also be foxed in CC 2014 sett here Photoshop CS6 - Recording the clone tool in an action gives incorrect results on replay.

  • HOW TO USE isSchemaValid() in oracle 9i to validate XML against XSD

    Hi
    I am trying to validate xml file against xsd in oracle 9i.The steps are as follows:
    *1.Created directory for xml and xsd file location:*
    CREATE or replace DIRECTORY XML_DATA AS 'D:\prod\sample xml and xsd;
    *2.Register the schema*
    DECLARE
    bf5 BFILE;
    BEGIN
    -- Register the schema
    dbms_lob.filecloseall;
    bf5 := BFILENAME('XML_DATA','xml1.xsd');
    DBMS_XMLSCHEMA.registerSchema('http://www.example.com/schemas/ipo.xsd',bf5,TRUE, TRUE, FALSE,TRUE,TRUE);
    -- dbms_lob.fileclose(bf5);
    END;
    *3.creatibg table to store xml files*
    CREATE TABLE po_tab2 (id NUMBER,xmlcol SYS.XMLType) ;
    *4.Inserting xml file into the table and validating that file with xml schema*
    declare
    aa clob:=' ';
    b varchar2(4000);
    c xmltype;
    begin
    dbms_lob.filecloseall;
    aa:= GETCLOBDOCUMENT('XML_DATA','example.XML','WE8MSWIN1252');
    INSERT INTO po_tab2 (ID, XMLCOL)
    VALUES
    (104,sys.XMLType.createXML(aa));
    commit;
    --c:=sys.xmltype.createXml(aa);
    c:=xmltype(aa);
    b:=VerifyXML(c,'http://www.example.com/schemas/ipo.xsd');
    dbms_output.put_line(b);
    end;
    _5.VerifyXML function is:_
    create or replace
    function VerifyXML( xml xmltype, xmlSchema varchar2 ) return varchar2 AUTHID DEFINER is
    xmlURL varchar2(4000);
    begin
    select
    s.qual_schema_url into xmlURL
    from user_xml_schemas s
    where s.schema_url = xmlSchema;
    if xml.isSchemaValid(xmlURL,'ManageRolloutRegionNotification') =1 then
    return( 'Valid. The supplied XML complies with XSD '||xmlURL );
    else
    -- return null;
    return(sqlcode|| 'Failed. The supplied XML does not comply with XSD '||xmlURL );
    end if;
    exception when others then
    return(sqlcode);
    end;
    _6.PROBLEM:_
    the problem is the function is always returning 'Failed ' status even though I am giving the correct file.. Is there any method to find the reason for failure. These codes are working fine oracle 11g. currently i am working in 9i version 9.2.0.1.0. I

    Oracle 9iR2 is not supported anymore.
    Oracle 9.2.0.8 is in sustained support.
    Oracle 9.2.0.1 is not supported at all.
    Upgrade to 11gR2.
    Sybrand Bakker
    Senior Oracle DBA

Maybe you are looking for

  • Unable to reformat G4, or to reinstall OS X.3o

    My daughter gave me her PowerBook G4 to fix. It quit totally last November, would not even turn on. A few days ago it did finally turn on, but repeatedly said "You need to reboot your computer." Eventually it turned off so she was able to retrieve so

  • Has anyone got iSight working when a firewire drive is connected?

    I have tried numerous drives but they all stop iSight working. For sure I would not have bought it had I known this. It will work if I disconnect all drives. Irony is that the internal is so slow that I run off a firewire.

  • INSTALLING BOOTCAMP ON MACBOOK PRO???

    hello i bought the new macbook pro 15inch yesterday...it seems she needs windows xp for work and i need to installl it tonight...thus the BEST replies that come ASAP will recieve answer points... i downloaded the ASSISTANT to my desktop. i ran the in

  • How to start for the following Irradiance format?

    http://www.solar-repository.sg/index.php/meteorological-data/live-data.html If i want the table like the Global Irradiance. How do i start? Solved! Go to Solution.

  • Searching in History is incredibly good!

    I had not discovered that if you discover things on the web, often you will need them three weeks later. In Safari Settings, I set my Remove objects from History at Manual. Before I had not discovered that I can search for something in the History (d