Problem in JAXB for processing XML files

hello
I have been working on a project where i need to process data in XML format. the flow goes thus
I have 28 data elements that i need to represent as a XML so i compile the schema files and generate the class files for each of the tags and thus i can use the get and set methods to read and write to a XML file respectively(example getName and setName)......
Now the problem is that my coding is done if i change my xml file and add say 2 more tags how do i handle it in my code.........
1>Do i have recomplie the schema file and generate new class files every time the xml structure changes. can i avoid this recompiling process and use a one time genrated class files even if the xml structure changes.
2>Now i have hard coded the get and set methods for processing the xml file if i add new tags to my xml i wouldnt have the get set methods for the new tags in my code(say i add a new tag as Phone then i wouldnt have the codes getPhone and setPhone called in my code and this tage was added after the coding was done)........how do i handle this situation. Is is possible that i can get and set data without using these methods and use some sort of a dynamic way of getting and setting data.............
3>Any other approach available to meet the above requirements other than JAXB.
Please help for the above problem
Thank you

hi,
i had written a xml and schema to validate.
my xml would be
<output>
<table>
<row>
<column></column>
<column></column>
</row>
</table>
<document>
<properties>
</properties>
<contents>
</contents>
</document>
<table>
<row>
<column></column>
<column></column>
</row>
</table>
<document>
<properties>
</properties>
<contents>
</contents>
</document>
<table>
<row>
<column></column>
<column></column>
</row>
</table>
<document>
<properties>
</properties>
<contents>
</contents>
</document>
</output>
schema should validate : each table should contain atleast one row element and each row element should have atleast one column. similarly, each document should have atleast one properties and contents element.
if any of these things occur. for ex: if there is no row element in table, i need to delete the table tag. similary if there is no properties/content or both element in document it should delete the corresponding document from the xml.
i tried for table if there is no row element am getting the line number of the </table> tag, based on that am deleting the table element. if there is no properties tag and contents tag is there. am getting the line number for <contents>start tag, with which i could not able to delete the whole document.
can anybody plz help me out for this requirement

Similar Messages

  • PL/SQL procedure to process XML file

    I am just starting to work on xml, and we are using PL/SQL stored procedures to process xml file. I did find the sample code in the package (family.sql). This sample print out all element names and attributes. My questions are :
    (1) I tried to modify the code to print out the element values (or Node values). Here is the code:
    -- get all elements and values
    nl := xmlparser.getElementsByTagName(doc, '*');
    len := xmlparser.getLength(nl);
    -- loop through elements
    for i in 0..len-1 loop
    n := xmlparser.item(nl, i);
    dbms_output.put_line('NodeName: ' &#0124; &#0124; xmlparser.getNodeName(n) &#0124; &#0124; ' ');
    dbms_output.put_line('NodeValue: ' &#0124; &#0124; xmlparser.getNodeValue(n) &#0124; &#0124; ' ');
    end loop;
    However, it did not print out the values, although it did print out the name. what's wrong with it? how can I get the value?
    (2) I have the following xml file:
    <?xml version="1.0"?>
    <profile>
    <id>1</id>
    <name>Company</name>
    <des>master profile</desc>
    <subprofile>
    <subid>1</subid>
    <subname>group1</subname>
    <subdesc>group profile</subdesc>
    </subprofile>
    </profile>
    now, I'd like to print out all the children of the <subprofile> node, that is <subid>, <subname> and <subdesc>. Here is my code:
    -- get subprofile nodelist
    qnlist := xmlparser.getElementsByTagName(doc, 'subprofile');
    -- get length of the nodelist
    len := xmlparser.getLength(qnlist);
    -- loop through elements
    for i in 0..len-1 loop
    qnode := xmlparser.item(qnlist, i);
    qnnode := xmlparser.getFirstChild(qnode);
    qnchild := xmlparser.getFirstChild(qnnode);
    dbms_output.put_line(xmlparser.getNodeName(qnnode));
    dbms_output.put_line(xmlparser.getNodeValue(qnchild));
    LOOP
    if (xmlparser.isNULL(xmlparser.getNextSibling(qnnode))) then exit;
    END IF;
    qnnode := xmlparser.getNextSibling(qnnode);
    qnchild := xmlparser.getFirstChild(qnnode);
    dbms_output.put_line(xmlparser.getNodeName(qnnode));
    dbms_output.put_line(xmlparser.getNodeValue(qnchild));
    END LOOP;
    end loop;
    when I execute the procedure, I get the following output:
    #text
    I am not sure what's wrong with it. Basically, I didn't know the procedure to traverse the tree since here it's a little different from OO programming. Could someone give a sample code which demonstrate the procedure which can get a specific element's name and values? (for my exapmle, the name and value of the <subname>, or <subid>, <subdesc>).
    Also, is there a way to insert a part of xml file into a DB table? in my case, insert the subprofile into a table. I know the xmlgen package has a procedure to insert a xml file into a table, but not a part of xml. And can I insert a xml file into several tables instead of one table, using xmlgen package?
    looking forward to hearing from you. any suggestion and sample code would be helpful. thank you very much.
    null

    I sloved my first question: to get the Nodevalue, I need to use getFirstChild(n);
    But, I still didn't figure out the second
    problem. Actually, It works when I modified my xml file as following:
    <?xml version="1.0"?>
    <profile>
    <id>1</id>
    <name>Company</name>
    <des>master profile</desc>
    <subprofile><subid>1</subid><subname>group1</subname><subdesc>groupprofile</subdesc></subprofile>
    </profile>
    All the <subprofile>....</subprofile> must be in one line without any return. This is unbelievable! It suppose that xml does not matter new lines. I tested my code, it seems space is fine, but new line. Something must be wrong in my code.
    please give any suggestion. Thanks,
    Yudong
    null

  • Source Reformat menu item disabled for some XML files, but not all

    For some reason, the 'Reformat' option isn't available for some of my XML files (in Source menu it's disabled, in the right-click pop up menu it's not even there). For example in my META-INF folder it's enabled for .wsdl files but not .xml files. In the same project, it's enabled for all .xml files in the WEB-INF folder.
    Any idea what's going on?
    TIA

    Thanks to everyone for their response. But - it is NOT a copyright issue , it is NOT a DRM issue, it is not a Faber College double secret probation encoding issue.
    This is a simple .wmv file, that I have copied, burned, created a disk image, made a copy of and sent to the UK, Germany, Ireland and even New Jersey. It has been played on a MacBook Pro, a MacBook, a Dell whatever, a Sony stand alone DVD player, an LG DVD player. At least three nieces or nephews, and at least 2 canines have put it through ISO 9XXX rigors.
    The problem is that Apple Quick Time 7 Pro with Flip4Mac Pro "can't handle it"
    It opens fine, it plays fine --- but when I try to "output" it via the FILE menu - all of the options
    Share ...
    Export ...
    Export to Web ...
    are greyed out.
    I know nothing abour codecs and wrappers but I tihnk that this is the problem.
    What should I know about the file?
    Ffor example, years ago, all you needed to know about a Mac file was the "Creator" and the "Type" - both were 4 character codes. something like ADOB for Adobe and PMK2 for Pagemaker 2.0.
    Any help identifying the file and what I can use to get it onto my iPhone will be appreciated.
    Thank you.

  • XML publisher report not generating output for huge XML files

    Changed Depreciation Projections Report output type to XML.
    Defined a Data Definition and a new Data Template (RTF) for this report.
    Ran the Depreciation Projection Report to generate the XML output.
    Ran the XML Report Publisher report to generate teh PDF/Excel output of the above report.
    Output generated for smaller XML files. When XML size is big, the program is running for hours without generating the output.
    Teh RTF template is basically a matrix report in which the number of columns in the report is based on the number of periods the report is run for.
    The same is not working in the Desktop version also. The system is hanging when i try to view the preview pdf.
    The XML file size is approximately 33 MB.
    Please let me know if there is any way we can increase the memory size to see the output.
    Thanks,
    Ram.

    for publisher use Category: E-Business Suite

  • Unable to establish a for loop in custom rtf template for seeded xml file

    Hi Experts ,
    I am Unable to establish a for loop in custom rtf template for seeded xml file. i am using <?:for-each:G_BSALINE?> FORM FIELD .....<?:FOR-EACH?END> .AM i missing something?
    Please help.
    Thanks

    Hi,
    Need more information about your XML data structure; however based on the code you provided, the synax does not look right; you have some colon sign where it is not needed etc... You could use the following (although not quite sure if you want to use Form Filed to group by or just display), but look at the example provided below.
    <?for-each-group:G_BSALINE?> FORM FIELD .....<?end for-each-group?>
    Example code:
    <?for-each-group:G_INVOICE_NUM;./INV_TYPE?>
    xxxxxxxxxx
    <?end for-each-group?>
    Thanks!

  • Correct adapter to use for an XML file

    Hi,
    My current scenario for our business partner is that we are sending them an 850 and 856 then an XML file.
    For 850 and 856, we are using AS2 adapter. For the XML file, could I still use the same adapter?  Or I need to use File adapter instead?
    My scenario for the xml file is that an IDoc is converted to an XML file.  This XML file is then sent to the business partner.
    Please advise.
    Thanks very much.
    Regards,
    Lex

    Hi VJ,
    I just found out that I could also use the AS2 adapter to send the xml file to the trading partner.
    Thanks for your kind response.
    Regards,
    Lex

  • SQL*Loader problem - not efficient, parsing error for big xml files

    Hi Experts,
    First of all, I would like to store xml files in object relation way. Therefore I created a schema and a table for it (see above).
    I wants to propagate it (by using generated xml files), hence I created a control file for sql loader (see above).
    I have two problems for it.
    1, It takes a lot of time. It means I can upload a ~80MB file in 2 hours and a half.
    2, At bigger files, I got the following error messages (OCI-31011: XML parsing failed OCI-19202: Error occurred in XML processing LPX-00243: element attribute value must be enclosed in quotes). It is quite interesting because my xml file is generated and I could generated and uploaded the first and second half of the file.
    Can you help me to solve these problems?
    Thanks,
    Adam
    Control file
    UNRECOVERABLE
    LOAD DATA
    CHARACTERSET UTF8
    INFILE *
    APPEND
    INTO TABLE coll_xml_objrel
    XMLTYPE(xml)
    FIELDS
    ident constant 2
    ,file_name filler char(100)
    ,xml LOBFILE (file_name) TERMINATED BY EOF
    BEGINDATA
    generated1000x10000.xml
    Sql Loader command
    sqlldr.exe username/password@//localhost:1521/SID control='loader.ctl' log='loadr.log' direct=true
    Schema
    <?xml version="1.0" encoding="UTF-8"?>
    <schema targetNamespace="http://www.something.com/shema/simple_searches" elementFormDefault="qualified" xmlns="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://www.something.com/shema/simple_searches">
        <element name="searches" type="tns:searches_type"></element>
        <element name="search" type="tns:search_type"></element>
        <element name="results" type="tns:results_type"></element>
        <element name="result" type="tns:result_type"></element>
        <complexType name="searches_type">
            <sequence>
                <element ref="tns:search" maxOccurs="unbounded"></element>
            </sequence>
        </complexType>
        <complexType name="search_type">
            <sequence>
                <element ref="tns:results"></element>
            </sequence>
            <attribute ref="tns:id" use="required"></attribute>
            <attribute ref="tns:type" use="required"></attribute>
        </complexType>
        <complexType name="results_type">
            <sequence maxOccurs="unbounded">
                <element ref="tns:result"></element>
            </sequence>
        </complexType>
        <complexType name="result_type">
            <attribute ref="tns:id" use="required"></attribute>
        </complexType>
        <simpleType name="type_type">
            <restriction base="string">
                <enumeration value="value1"></enumeration>
                <enumeration value="value2"></enumeration>
            </restriction>
        </simpleType>
        <attribute name="type" type="tns:type_type"></attribute>
        <attribute name="id" type="string"></attribute>
    </schema>
    Create table
    create table coll_xml_objrel
    ident Number(20) primary key,
    xml xmltype)
    Xmltype column xml
    store as object relational
    xmlschema "http://www.something.com/schema/simple_searches.xsd"
    Element "searches";

    Hi Odie_63,
    Thanks for your answer.
    I will post this question in the XML DB forum too (edit: I realized that you have done it. Thanks for it).
    1, Version: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
    2, see above
    3, I have registered my schema with using dbms_xmlschema.registerSchema function.
    Cheers,
    Adam
    XML generator:
    import java.io.FileNotFoundException;
    import java.io.FileOutputStream;
    import javax.xml.stream.XMLOutputFactory;
    import javax.xml.stream.XMLStreamException;
    import javax.xml.stream.XMLStreamWriter;
    public class mainGenerator {
        public static void main(String[] args) throws FileNotFoundException, XMLStreamException {
            // TODO Auto-generated method stub
            final long numberOfSearches = 500;
            final long numberOfResults = 10000;
            XMLOutputFactory xof = XMLOutputFactory.newFactory();
            XMLStreamWriter writer = xof.createXMLStreamWriter(new FileOutputStream("C:\\Working\\generated500x10000.xml"));
            writer.writeStartDocument();
            writer.writeStartElement("tns","searches", "http://www.something.com/schema/simple_searches");
            writer.writeNamespace("tns", "http://www.something.com/schema/simple_searches");
            for (long i = 0; i < numberOfSearches; i++){
                Long help = new Long(i);
                writer.writeStartElement("tns","search", "http://www.something.com/schema/simple_searches);
                writer.writeAttribute("tns", "http://www.something.com/schema/simple_searches", "type", "value1");
                writer.writeAttribute("tns", "http://www.something.com/schema/simple_searches", "id", help.toString());
                writer.writeStartElement("tns","results", "http://www.something.com/schema/simple_searches");
                for (long j = 0; j < numberOfResults; j++){
                    writer.writeStartElement("tns","result", "http://www.something.com/schema/simple_searches");
                    Long helper = new Long(i*numberOfResults+j);
                    writer.writeAttribute("tns", "http://www.something.com/schema/simple_searches", "id", helper.toString());
                    writer.writeEndElement();
                writer.writeEndElement();
                writer.writeEndElement();
            writer.writeEndElement();
            writer.writeEndDocument();
            writer.close();
    registerSchema:
    begin
    dbms_xmlschema.registerSchema(
    'http://www.something.com/schema/simple_searches',
    '<?xml version="1.0" encoding="UTF-8"?>
    <schema targetNamespace="http://www.something.com/schema/simple_searches" elementFormDefault="qualified" xmlns="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://www.something.com/schema/simple_searches">
        <element name="searches" type="tns:searches_type"></element>
        <element name="search" type="tns:search_type"></element>
        <element name="results" type="tns:results_type"></element>
        <element name="result" type="tns:result_type"></element>
        <complexType name="searches_type">
            <sequence>
                <element ref="tns:search" maxOccurs="unbounded"></element>
            </sequence>
        </complexType>
        <complexType name="search_type">
            <sequence>
                <element ref="tns:results"></element>
            </sequence>
            <attribute ref="tns:id" use="required"></attribute>
            <attribute ref="tns:type" use="required"></attribute>
        </complexType>
        <complexType name="results_type">
            <sequence maxOccurs="unbounded">
                <element ref="tns:result"></element>
            </sequence>
        </complexType>
        <complexType name="result_type">
            <attribute ref="tns:id" use="required"></attribute>
        </complexType>
        <simpleType name="type_type">
            <restriction base="string">
                <enumeration value="value1"></enumeration>
                <enumeration value="value2"></enumeration>
            </restriction>
        </simpleType>
        <attribute name="type" type="tns:type_type"></attribute>
        <attribute name="id" type="string"></attribute>
    </schema>',
    TRUE, TRUE, FALSE, FALSE);
    end

  • Script for generating XML file ... problem with null values

    Greetings everyone,
    i come here with a question that troubles me for some time now. I have a script which i run from SQLPLUS every now and then to generate an XML file.
    Problem is that data which needs to be in XML is not allways <> NULL and i need to hide those tags that are empty </tag>.
    I will post below my script and if you could help me with it it would be really great!
    Thanks for reading!
    set long 20000000
    set long 20000000
    set linesize 32000
    SET ECHO OFF
    SET TRIMSPOOL on
    SET HEADING OFF
    SET PAGESIZE 50000
    SET VERIFY OFF
    SET FEEDBACK OFF
    SET TERMOUT OFF
    spool C:\test.xml
    set serveroutput on
    begin
      dbms_output.put_line('<?xml version="1.0" encoding="utf-8" ?>');
    end;
    SELECT
    XMLELEMENT("ReportRoot",XMLATTRIBUTES('http://www.w3.org/2001/XMLSchema-instance' as "xmlns:xsi", 'http://www.w3.org/2001/XMLSchema' as "xmlns:xsd" , '1.0' as "Version",sysdate as "CreationDate",to_char(sysdate,'hh:mm:ss') as "CreationTime",'1524544845' as "id"),
    XMLELEMENT("Porocila",XMLELEMENT("JOLY",(SELECT XMLAGG (XMLELEMENT("RefNrReport",replace('SON'||to_char(ref_ST,'00000'),' ',''))) from access_table_2 where ref_ST = &1),
    XMLELEMENT("ReportDate",sysdate),XMLELEMENT("Labeling",'545254450'),
    (SELECT XMLAGG     (XMLELEMENT("Reportf",
                                                                     XMLELEMENT("access",access),
                                                                     XMLELEMENT("date",date),
                                                                     XMLELEMENT("datep",datep),
                                                                     XMLELEMENT("ModificationInfo",'M'),XMLELEMENT("ModificationReason",modireason)))
                                                 from v_xml_test where id_dok = &1 and ind_print = '1'))))
      .extract('/*')
      from dual
         spool off
    exitNow lets pretend that XMLELEMENT("datep",datep), is sometimes NULL and i do not want to display it.

    may be
    with t as
    select sysdate datep from dual union all
    select null datep from dual
    select xmlagg(xmlelement("Reportf",
                             case when datep is not null then XMLELEMENT("datep", datep)
                             end
      from t

  • Is JAXB suitable for large XML files ?

    Hi,
    I have a very large XML file (~700 MB) (schema available). I need to unmarshall this into java objects and carry out some (business validation rules) on it.. These buisness rules may involve validating data from content objects that correspond to different sections of this large XML file.
    I am uncertain whether JAXB will help me here. (just started on it) Does JAXB build the entire content tree for the XML document during Unmarshaller.unmarshall ? Is there anyway of asking it to build content objects on demand as opposed to building the whole content tree immediately ?
    All help/suggestions appreciated.

    Forgot to add:
    after carrying out validation the data is put into some RDBMS tables.
    One approach would be to convert the XML files into SQL Loader compatible flat files (using a tool). Load these flat files into staging tables. Perform business validations on staging table data and then finally move the data into the main tables. All the validating logic could either be in stored procedures or java code.
    The above is very long-winded. It would be great if JAXB can handle very large XML files (without loading the whole XML file into memory) so that business validations can be done by java, without any intermediate format conversion.
    I hope the above is somewhat clear.

  • Need help processing XML files

    I'm fairly new to Java and have never worked with XML. I need to process several XML files and display them in a matrix for comparison and I'm not sure if I need to understand SAX, DOM or some other API. I'm not creating the files, I'm just parsing them to put into a table so they can be displayed for comparison. I could be processing up to several hundreds of files, so performance would also be an issue.
    I'm just looking for options and possible areas I can begin to look for help. Can anyone tell me which APIs would help me acheive my goal?
    Any help would be greatly appreciated.
    Thanks

    Thanks for the response Kev. I guess a better diescription of the problem would be to say that I want to display the attributes and values of the differnet files in a matrix.
    For example...
    Here are 2 sample xml files with the same tags and attributes.
    XML FILE A
    <tag1 name="Fred", country="ca">
    <tag2 group-name="Group 1">
    <tag3 color ="blue">
    </tag3>
    </tag2>
    </tag1>
    XML FILE B
    <tag1 name="Sue", country="us">
    <tag2 group-name="Group 2">
    <tag3 color="red">
    </tag3>
    </tag2>
    </tag1>
    I would like to have them displayed as follows...
    XML FILE A XML FILE B
    tag1 name           Fred Sue
    tag1 country           ca us
    tag2 group-name          Group 1 Group 2
    tag3 Color          Blue     Red
    HTML tags didn't work, so the matrix is bunched together, but I think you get the idea. My question is, which would be better to use SAX or DOM. I could be running this on as many as 50 or 60 files, so the matrix could get very large and performance could be an issue as multiple users could be doing this comparison at the same time.

  • Problem using saxparser(reading japanese xml file)

    Hi everybody,
    I hav a problem while reading japanese xml file.(UTF-8 charset)
    I have to read the file and process it.
    But in the characters function of the saxparser(defaulthandler) the japanese chatracters are not read properly and the program is
    displaying some junk values(????) instead of the actual japanese characters.
    I am also usind xsd validation.
    I am not able to where the characters manipulation is being done.
    Please help me as soon as possible .
    Thanks in advance,
    Charan.

    There are a couple of things probably going on.
    1) When I've done things using Unicode unusual characters, they do not print properly if you do System.out.println( ). If you have a Gui panel and can put them into a JTextArea or JEditorPane, they may show up properly if you have set the font for that object to one that can display the characters.
    2) Many people starting with SAX write their code assuming that the characters method is only called once for each element that has text content. This is incorrect. The characters method can be called many times, and it is your responsibility to catch all of the data. In 1.4 you can use a StringBuffer, or in 1.5 there is a StringBuilder. You use these to accumulate the data from all of the calls to charactrers() between the startElement and endElement.
    Each parser can decide how often it calls characters, so you have to be able to process data from several calls.
    Dave Patterson

  • Processing XML files that contain Special Characters

    Hello:
    Before I explain my problem I think I should briefly explain what I am trying to do. I have a JSP page that invokes a Java method (the code is attached). This java method takes in an XML file and an XSLT file. It parses the XSLT and also the XML file. If the parsing went through fine, it then processes the XML file and applies the XSLT to the XML file and returns a XMLDocumentFragment Object back to JSP and the JSP renders it.
    This mechanism works well. However off late I have encountered a few XML files containing characters such as &Ecirc (Capital E with circumflex accent). Whenever my Java method tries to parse/process this .xml file it gives me the following error.
    ORG.oclc.da.utilities.ifs.ReportException: An Error Occured While Parsing the Report: Missing entity 'Ecirc'.     at ORG.oclc.da.archive.userinterface.ReportHelper.retrieveReport(Unknown Source)     at /ViewReport.jsp._jspService(/ViewReport.jsp.java:87) (JSP page line 65)     at com.orionserver[Oracle9iAS (1.0.2.2) Containers for J2EE].http.OrionHttpJspPage.service(OrionHttpJspPage.java:54)     at com.evermind[Oracle9iAS (1.0.2.2) Containers for J2EE].server.http.HttpApplication.serviceJSP(HttpApplication.java:5458)     at com.evermind[Oracle9iAS (1.0.2.2) Containers for J2EE].server.http.JSPServlet.service(JSPServlet.java:31)     at com.evermind[Oracle9iAS (1.0.2.2) Containers for J2EE].server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:501)     at com.evermind[Oracle9iAS (1.0.2.2) Containers for J2EE].server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:170)     at com.evermind[Oracle9iAS (1.0.2.2) Containers for J2EE].server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:576)     at com.evermind[Oracle9iAS (1.0.2.2) Containers for J2EE].server.http.HttpRequestHandler.run(HttpRequestHandler.java:189)     at com.evermind[Oracle9iAS (1.0.2.2) Containers for J2EE].util.ThreadPoolThread.run(ThreadPoolThread.java:62)
    It seems like the Oracle Parser/XSLT Processor (oracle.xml.parser.v2.DOMParser) I am using is not able to handle special characters such &Ecirc. I was wondering if there is anyway around this problem.
    Attached is the Java Method that handles both the parsing and processing of the XML file.
    /** The method parses the Report Data and applies the Style Sheet to this data
    * @param The InputStream (Report Contents - .xml file), Name of the StyleSheet that needs to be applied
    * @return A sub-section of the report data (DOM DocumentFragment is returned)
    private XMLDocumentFragment parseReport(InputStream reportStream,String strStyleSheet) throws Exception
    DOMParser parser;
    XMLDocument xml, xsldoc, out;
    URL urlStyleSheet;
    //Get the URL for the Style Sheet
    urlStyleSheet = new URL(strStyleSheet);
    //Create an instance of the Dom Parser
    parser = new DOMParser();
    parser.setPreserveWhitespace(true);
    //Parse the XSL document and create a DOM Object
    parser.parse(urlStyleSheet);
    xsldoc = parser.getDocument();
    //Parse the report document (a .xml) and create a DOM Object
    parser.parse(reportStream);
    xml = parser.getDocument();
    // instantiate a stylesheet
    XSLStylesheet xsl = new XSLStylesheet(xsldoc, urlStyleSheet);
    XSLProcessor processor = new XSLProcessor();
    // display any warnings that may occur
    processor.showWarnings(true);
    // processor.setErrorStream(System.err);
    // Process XSL
    XMLDocumentFragment result = processor.processXSL(xsl, xml);
    return result;
    If you have any suggestions please let me know. If you need more information I will be to furnish it.
    thanks
    Mathangi

    Hello,
    I just had the same problem, you need to include the approprate entity sets so that the xsl parser will recognize them (and you won't
    get the "missing entity" error:
    if you already haven't you need to add a DOCTYPE processing instruction for your dtd, to the top of your xml files to be parsed, for ex.:
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "file:///mydir/mydtd.dtd">
    then in "mydtd.dtd", add references to these 3 entity sets (if you have a dtd - if not then create one just with these entries):
    <!ENTITY % HTMLlat1 PUBLIC
    "-//W3C//ENTITIES Latin 1 for XHTML//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml-lat1.ent">
    %HTMLlat1;
    <!ENTITY % HTMLspecial PUBLIC
    "-//W3C//ENTITIES Special for XHTML//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml-special.ent">
    %HTMLspecial;
    <!ENTITY % HTMLsymbol PUBLIC
    "-//W3C//ENTITIES Symbols for XHTML//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml-symbol.ent">
    %HTMLsymbol;
    Or, grab the ".ent" files from the www.w3.org site and put them on your server in the dtd dir, and change the "http:... reference, to
    "file:...", it will be faster to parse (that's what I did). FYI, "Ecirc" is in xhtml-lat1.ent.
    Also, after I did this,I developed another problem where my xsl parser and xmlmarkup tag-converting function converts certain
    html entities to their octal counterparts, and I don't want this and don't know how to stop it (I have a posting out for this also).
    Additionally, thanks for posting your parseReport method, it just so happens that I was looking for a way to do something like that,
    it should be helpful to me.
    -JK
    Hello:
    Before I explain my problem I think I should briefly explain what I am trying to do. I have a JSP page that invokes a Java method (the code is attached). This java method takes in an XML file and an XSLT file. It parses the XSLT and also the XML file. If the parsing went through fine, it then processes the XML file and applies the XSLT to the XML file and returns a XMLDocumentFragment Object back to JSP and the JSP renders it.
    This mechanism works well. However off late I have encountered a few XML files containing characters such as J (Capital E with circumflex accent). Whenever my Java method tries to parse/process this .xml file it gives me the following error.
    ORG.oclc.da.utilities.ifs.ReportException: An Error Occured While Parsing the Report: Missing entity 'Ecirc'.     at ORG.oclc.da.archive.userinterface.ReportHelper.retrieveReport(Unknown Source)     at /ViewReport.jsp._jspService(/ViewReport.jsp.java:87) (JSP page line 65)     at com.orionserver[Oracle9iAS (1.0.2.2) Containers for J2EE].http.OrionHttpJspPage.service(OrionHttpJspPage.java:54)     at com.evermind[Oracle9iAS (1.0.2.2) Containers for J2EE].server.http.HttpApplication.serviceJSP(HttpApplication.java:5458)     at com.evermind[Oracle9iAS (1.0.2.2) Containers for J2EE].server.http.JSPServlet.service(JSPServlet.java:31)     at com.evermind[Oracle9iAS (1.0.2.2) Containers for J2EE].server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:501)     at com.evermind[Oracle9iAS (1.0.2.2) Containers for J2EE].server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:170)     at com.evermind[Oracle9iAS (1.0.2.2) Containers for J2EE].server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:576)     at com.evermind[Oracle9iAS (1.0.2.2) Containers for J2EE].server.http.HttpRequestHandler.run(HttpRequestHandler.java:189)     at com.evermind[Oracle9iAS (1.0.2.2) Containers for J2EE].util.ThreadPoolThread.run(ThreadPoolThread.java:62)
    It seems like the Oracle Parser/XSLT Processor (oracle.xml.parser.v2.DOMParser) I am using is not able to handle special characters such J. I was wondering if there is anyway around this problem.
    Attached is the Java Method that handles both the parsing and processing of the XML file.
    /** The method parses the Report Data and applies the Style Sheet to this data
    * @param The InputStream (Report Contents - .xml file), Name of the StyleSheet that needs to be applied
    * @return A sub-section of the report data (DOM DocumentFragment is returned)
    private XMLDocumentFragment parseReport(InputStream reportStream,String strStyleSheet) throws Exception
    DOMParser parser;
    XMLDocument xml, xsldoc, out;
    URL urlStyleSheet;
    //Get the URL for the Style Sheet
    urlStyleSheet = new URL(strStyleSheet);
    //Create an instance of the Dom Parser
    parser = new DOMParser();
    parser.setPreserveWhitespace(true);
    //Parse the XSL document and create a DOM Object
    parser.parse(urlStyleSheet);
    xsldoc = parser.getDocument();
    //Parse the report document (a .xml) and create a DOM Object
    parser.parse(reportStream);
    xml = parser.getDocument();
    // instantiate a stylesheet
    XSLStylesheet xsl = new XSLStylesheet(xsldoc, urlStyleSheet);
    XSLProcessor processor = new XSLProcessor();
    // display any warnings that may occur
    processor.showWarnings(true);
    // processor.setErrorStream(System.err);
    // Process XSL
    XMLDocumentFragment result = processor.processXSL(xsl, xml);
    return result;
    If you have any suggestions please let me know. If you need more information I will be to furnish it.
    thanks
    Mathangi

  • Options for large XML file - downloading from the app hangs browser

    I am using 5.6.3 in EBS.
    My users want to create files that can be uploaded into another system. The system will take XML files so my original idea was to create a data definition and have the user simply save the xml output (using View XML option). A .rtf template is also required for a pdf output - a summary of what was sent in the extract. This idea worked fine until I got a large file (37+ MB) and the View XML crashed my browser. Other than moving the files to a directory on the server that my user has access to, is there any other way to get at that raw XML?
    Updated:
    I have been doing some more reading and I am wondering if both an etext template and a pdf template would have been the better solution. This way I could submit once with the etext template and republish same data with the pdf template. Has anyone tried this successfully? I am not sure though that this would eliminate my problem with the large files (100,000+ records) crashing the browser. When you use an etext template, how do you get at that file? Is it using the 'View Output' button on Request Form or do I have the option to send it somewhere directly (i.e. server or email)?
    Any tips would be appreciated.
    Edited by: Tam_11 on Jan 14, 2011 1:38 PM

    Hi,
    using etext, the text output will still be in the usual directory at $APPLCSF/$APPLOUT.
    The text output will be smaller than the XML output so I'd be surprised if it still crashes your browser so you shouldn't need to get the XML.
    What format is needed for the target system?
    Cheers
    Kofi

  • Problem in parsing a particular XML file.

    Hello, I have an XML file like this:
    <eGov_IT:Intestazione xmlns:eGov_IT="http://www.cnipa.it/schemas/2003/eGovIT/Busta1_0/" xmlns:SOAP_ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.cnipa.it/schemas/2003/eGovIT/Busta1_0/
    E:\Progetti\EchoPorte\sviluppo\WEBCON~1\WEB-INF\risorse\Messaggio.xsd">
    <eGov_IT:IntestazioneMessaggio xmlns:eGov_IT="http://www.cnipa.it/schemas/2003/eGovIT/Busta1_0/">
    <eGov_IT:Collaborazione>PortaDelegata_PortaDiDominio_0000001_2007-10-05_12:26</eGov_IT:Collaborazione>
    <eGov_IT:Identificatore>PortaDelegata_PortaDiDominio_0000002_2007-10-05_12:26</eGov_IT:Identificatore>
    </eGov_IT:IntestazioneMessaggio>
    As you can see there are 2 elements in which the values are really similar. In fact in the Schema we use they have to match the same regular expression; here's the extract from my schema.
    <xsd:element name="Collaborazione" type="IdentificatoreType"/>
    <xsd:element name="Identificatore" type="IdentificatoreType"/>
    <xsd:simpleType name="IdentificatoreType">
    <xsd:restriction base="xsd:string">
    <xsd:pattern value="[\w]+_[\w]+_\d{7}_\d{4}\-\d{2}\-\d{2}_\d{2}:\d{2}"/>
    </xsd:restriction>
    </xsd:simpleType>
    I can CORRECTLY validate this expression using this code:
    public void validate (String doc, String schema) throws SAXParseException, SAXException
    try
    SchemaFactory schemaFactory = SchemaFactory.newInstance( XMLConstants.W3C_XML_SCHEMA_NS_URI );
    Schema schemaXSD = schemaFactory.newSchema( new File ( schema ) );
    Validator validator = schemaXSD.newValidator();
    DocumentBuilderFactory.newInstance().newDocumentBuilder();
    ByteArrayInputStream baisDoc = new ByteArrayInputStream(doc.getBytes());
    Document document = parser.parse(baisDoc);
    validator.validate( new DOMSource( document ) );
    And, in case the validation fails, I correctly gain a SAXParseException.
    The problem is that I can't understand if, in this case, the error is in the "Collaborazione" element or in the "Identificatore" element, because I get the following detailed message from the Exception:
    "cvc-pattern-valid: Value '' is not facet-valid with respect to pattern '[\w]+_[\w]+_\d{7}_\d{4}\-\d{2}\-\d{2}_\d{2}:\d{2}' for type 'IdentificatoreType'."
    How can I get more detailed informations about this error?
    Thanks everybody,
    Cris

    Check here:
    http://forum.java.sun.com/thread.jspa?threadID=5223284
    This is the correct post with my problem.
    Thanks!
    Cristiano

  • Multiple xsd's for one xml file

    Hi Experts,
    My scenario is HTTP to IDoc. My client is sending me XML file as input. I have got 4 XSD's from that XML file. I imported them into PI with giving references by using new importing method with refenences. I have got 4 XSD's imported succesfully into PI with the references in external references tab.
    Tha problem is each XSD is creating multiple messages(splitted) in PI. I can't use any one message in mapping becuase no message has full message to map with the output. One message has reference to the other message.
    Please suggest me how to proceed...
    Thanks-
    Ramesh.

    There should be a Main XSD which will refer the other (4) XSDs....right now you seem to be importing the XSDs independently.
    If XSD1 is referring XSD2, XSD2 is referring XSD3 and so on.....then XSD1 will form your Main XSD and then each XSD will have a separate reference to the next XSD.....all the XSDs need to be imported in XI.
    For example, create Data-types DT1, DT2, DT3, DT4 and provide a reference between them....DT2 in DT1, DT3 in DT2, DT4 in DT3....ultimately DT1 will refer all the other strcutures.....I hope this is what you are looking for.

Maybe you are looking for

  • CAN we upload data periodically in LSMW?

    HI Expert,                  In LSMW , maintain object attributes step , there is periodic option if we select that option then  would the data transfer periodically?How does it differ from periodic in BDC? LSMW we can not schedule  updation write? we

  • How to use aggregator to create a single swf file from multiple files

    Hi everyone, I am working on the client's requirement where i have to create a SCROM 2004 based video. Its basically a PPT inside the captivate file. And it has around 175 slides in the file. Some of the slides have animations, voiceover. I am facing

  • IOS 4.2.1 Playlist problem

    Hi there. Haven't seen this elsewhere but I have found a bug in the iPod/iTunes software for iPad. Since upgrading to 4.2, I cannot see podcasts that I add to a new playlist. That is, if I make a new playlist and add only podcasts, when I tap that pl

  • IChat Video Conference

    Could someone tell me at what point video conferencing became available? What is the definitive program that allows it? Is it iLife 8? I have 8 machines within my office realm and only 4 of them have the ability to conference. Except for 2 of them, t

  • Exception  caught if error is  raised  in Service Error Handler

    Can any one help me on this? Im not able to understand the funda for the behaviour? Proxy Service A calls proxy service B using Publish action. In proxyservice B - service error handler, Im raising an error with customised message. Proxy service B ro