Parsing problem

Hi Guys,
Database version: 10g
Would anyone help me out?
how to parse this string 'Oct 08 2007 to Dec 14 2007 - Section 3'?
My code which does not work:
WITH T
AS
(SELECT 'Oct 08 2007 to Dec 14 2007 - Section 3' FROM dual)
          SELECT  REGEXP_SUBSTR(string,'[^t]+', 1, 2))   col1,
                      SUBSTR(REGEXP_SUBSTR(string,'to[^-]+', 1), 3))   col2
           FROM TI want -
Col1                        Col2
Oct 08 2007            Dec 14 2007Thanks

Hi,
You don't need regular expressions for that:
WITH     got_pos     AS
     SELECT     string
     ,     INSTR (string, ' to ')     AS to_pos
     ,     INSTR (string, '-')     AS hyphen_pos
     FROM     t
SELECT     SUBSTR ( string
            , 1
            , to_pos - 1
           )          AS col1
,     SUBSTR ( string
            , to_pos + 4
            , hyphen_pos - (to_pos + 5)
           )          AS col2
FROM     got_pos;But, if you want to use regular expressions:
SELECT     REGEXP_REPLACE ( string
                 , ' to .*'
                 )     AS col1
,     REGEXP_REPLACE ( string
                 , '.* to ([^-]+) -.*'
                 , '\1'
                 )     AS col2
FROM     t;Either of these will work (for what I think you want), even if the string contains things like 'Oct 8 2007 to December 14, 2007 - Section 3

Similar Messages

  • WIJ 20002 xml Parser Problem - Rich Client

    Hi,
    I have a problem with the rich client on a new installation:
    Business Objects Enterprise XI 3.1 SP3 on Windows 2008 Standard.
    If I connect with the rich client "import document"is disabled.
    if I try to create a new document from the rich client it returns the error below (I used the rich client on two workstations):
    WIJ 20002
    Version: null
    Analisi dello stack:
    java.lang.RuntimeException: java.lang.RuntimeException: XML parser problem:
    XMLJaxpParser.parse(): Element type "ABOUT_Patentnumbers" must be followed by either attribute specification, ">" or "/>".
    at com.businessobjects.wp.xml.jaxp.XMLJaxpParser.parse (Unknown Source)
    at.com.businessobjects.webi.richclient.XMLviaOccaRC.getServerConfiguration (Unknown Source)
    Have you any solution?

    The fixpack 3.5 client resolves the problem.

  • Report query parsing problem

    I didn't find any report of this problem...
    Using APEX 3.0.1.00.07, I have a report of type "SQL Query (PL/SQL function body returning SQL query)" with the "Use Generic Column Names (parse query at runtime only)" radio button selected.
    When the region source contains the string "ORDER BY" in any form that I've tried (even in a comment), attempting to save the region fails with "Your query can't include an "ORDER BY" clause when having column heading sorting enabled."
    I do indeed have column sorting enabled on certain columns, but I don't see how that is relevant under these circumstances since the query produced at runtime does not have an ORDER BY clause.
    Am I overlooking something or is this a parsing problem?
    Rodney

    Rodney,
    It's just checking for order by being included in your query, and if so and you have column heading sorting enabled, it's raising this error because you can't have both (even if it's commented out).
    Regards,
    Marc

  • SAX parser problem in JDK1.5

    I have parse the xml file using SAX in jdk1.5 environment. During the parsing, it missed the some text content.
    for example
    <employeeid>
    <empid>1001</empid>
    <empid>1002</empid>
    </employeeid>
    If i have parse the above xml file using SAX in jdk1.5 environment. The output is
    1001
    100
    during the parsing , SAX parser misses digit of 2.
    if i have parse the above xml file using SAX in jdk1.4 environment , it is working fine.
    what is the problem in jdk1.5
    please help
    bala

    What I expect the problem to be was discussed recently in a topic titled "SAX Parser Problems" that was started on March 14 at 6:59 AM by JackoBS.
    Read that and see if it fixes your problem. If so, it is not a JDK1.5 problem, but a user error.
    Dave Patterson

  • Parsing Problems? ImageIcon and BufferedImage

    Hi to everyone
    Could I ask if I will to send ImageIcon with BufferedImage as its arguement. Then what should I receieve from the server? ImageIcon only or ImageIcon with BufferedImage as its arugement?
    Any help will be appreciated. Thank You.

    I am sending ImageIcon over to the server, hence the server will receive as ImageIcon.
    However, when I want to pass the ImageIcon which being parse to Image, this step is ok. Lastly when I want to parse the Image to BufferedImage image, I am encountering parsing problems, hence could u advise me further.
    The error message "Receiving failed: java.lang.ClassCastException"
    Any help will be appreciated. Thank You.
         public void getImage()
              //Object input = null;
            Image images = null;
              try{
                   imgIcon = (ImageIcon)oin.readObject();
                   System.out.println("Icon Width: "+imgIcon.getIconWidth());
                   while((images = imgIcon.getImage()) != null)
                        System.out.println("Images Width: "+Image.getWidth(images));
                        BufferedImage bimage = (BufferedImage)images; // PROBLEM LIES HERE
                        System.out.println("Bimage Width: "+bimage.getWidth());
                        ImageServerConnection.writeImage(bimage, "happy.jpg");
                        //String fname = "joalicia";
                        //create an new folder to store those sent images.
                        //File f = new File ("c:\\Sweet", fname);
                        //create(f);
              }catch(Exception e){
                   System.err.println("Receiving failed: "+ e);
         }

  • XML parsing problem

    Hi, my problem is :
    In my Application i want to parse an XML file with DOM parser. The problem is that in my Project "MyProject -> Project Properties -> Libraries and Classpath"
    I have included some 15 libraries which are useful for my Application: ADF Faces Runtime 11, ADF Web Runtime and etc.
    Problems are causing the libraries: BC4J Runtime,ADF Model Runtime, MDS Runtime Dependencies
    because when added my source which is parsing an XML file stops working.The source code is:
    DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
    DocumentBuilder db = dbf.newDocumentBuilder();
    File file =
    new File("C:\\Documents and Settings\\ilia\\Desktop\\begin.xml");
    Document doc = db.parse(file);
    Element root = doc.getDocumentElement();
    NodeList dots = root.getElementsByTagName("w:t");
    Element firstDot = (Element)dots.item(0);
    String textValue = firstDot.getFirstChild().getNodeValue();
    I use DOM because i need to change some values in the XML file, but its not working neither for reading nor for writing.When debugging I see that it gets the root of the xml but " firstDot.getFirstChild().getNodeValue() " returns null and it breaks with NullPointerException. And that's only when the libraries mentioned above are added to the project. Without them it works just fine !
    I don't know, it's like when added the parser validates my xml against some schema and returns null.
    The xml file is very simple MS Word Document saved as .xml .But I don't think that's the problem.
    Thanks in advance !
    iliya

    Hi all,
    I found the solution to my problem.The right way to parse and change an XML file with DOM parser using the Oracle XML Parser v2 should look like this:
    JXDocumentBuilderFactory factory =
    (JXDocumentBuilderFactory)JXDocumentBuilderFactory.newInstance();
    JXDocumentBuilder documentBuilder =
    (JXDocumentBuilder)factory.newDocumentBuilder();
    File file = new File("c:/Documents and Settings/ilia/Desktop/begin.xml");
    InputStream input =
    new FileInputStream(file);
    XMLDocument xmlDocument = (XMLDocument)(documentBuilder.parse(input));
    System.out.println("Encoding: " + xmlDocument.getEncoding());
    System.out.println("Version: " + xmlDocument.getVersion());
    NodeList namespaceNodeList =
    xmlDocument.getElementsByTagNameNS("http://schemas.microsoft.com/office/word/2003/wordml","t");
    XMLElement namespaceElement17 = (XMLElement)namespaceNodeList.item(17);
    namespaceElement17.getFirstChild().setNodeValue("someString");

  • XML Parsing - problem with a value of an element if starting with space

    Hi Experts,
    I need your valuable guidence to get out of a problem in parsing an XML file.
    An XML file is read into xstring variable and it is processed to be split into the corresponding itab.
    Please find the code below
    types: begin of ty-itab,
                field(4096),
              end of ty-itab.
    Data:
    g_ixml                       TYPE REF TO if_ixml,
    g_ixmldocument               TYPE REF TO if_ixml_document,
    g_ixmlstreamfactory          TYPE REF TO if_ixml_stream_factory,
    g_ixmlstream                 TYPE REF TO if_ixml_istream,
    g_ixmlparser              TYPE REF TO if_ixml_parser,
    g_ixmlnodemainlist        TYPE REF TO if_ixml_node_list,
    g_ixmlnodelistmainelement TYPE REF TO if_ixml_node_list,
    g_sxmldata                TYPE string,
    g_ixmlnode                TYPE REF TO if_ixml_node.
      DATA: wa_xmltab TYPE xstring,
                itab type table of ty-itab.
    OPEN DATASET l_file IN BINARY MODE FOR INPUT MESSAGE v_msg.
    READ DATASET l_file INTO wa_xmltab.
    PERFORM f_create_xmltable USING wa_xmltab
                                  CHANGING v_msg.
    IF NOT v_msg IS INITIAL.
          msg = v_msg.
          EXIT.
        ELSE.
          itab[] = it_xmldata[].
        ENDIF.
    CLOSE DATASET l_file.
    Subroutine to convert xstring to char type ITAB.
    FORM f_create_xmltable USING  value(pi_inputxmlstring) TYPE xstring
                           CHANGING v_msg.
    *-- create the main factory
      g_ixml = cl_ixml=>create( ).
    *-- create the initial document
      g_ixmldocument = g_ixml->create_document( ).
    *-- create the stream factory
      g_ixmlstreamfactory = g_ixml->create_stream_factory( ).
    *create input stream
      g_ixmlstream = g_ixmlstreamfactory->create_istream_xstring( string =
    pi_inputxmlstring ).
    *-- create the parser
      g_ixmlparser = g_ixml->create_parser( stream_factory =
    g_ixmlstreamfactory
                                      istream        = g_ixmlstream
                                      document       = g_ixmldocument ).
    *-- parse the stream
      IF g_ixmlparser->parse( ) NE 0.
    *if parser cannot be created then give error exit
        IF g_ixmlparser->num_errors( ) NE 0.
          EXIT.
        ENDIF.
      ENDIF.
    *-- we don't need the stream any more, so let's close it...
      CALL METHOD g_ixmlstream->close( ).
      CLEAR g_ixmlstream.
    *get the number of main nodes of the XML document
      g_ixmlnodemainlist = g_ixmldocument->get_children( ).
    *set number of elemtns
      g_inummainelements = 0.
      g_imainelementsctr = 0.
      g_inummainelements = g_ixmlnodemainlist->get_length( ).
      g_ifirstlevelctr = 0.
    *loop through the document till all have nodes have been covered.
      WHILE g_ifirstlevelctr LT g_inummainelements.
    *get the first node
        g_ixmlnode = g_ixmlnodemainlist->get_item( g_ifirstlevelctr ).
    *check the type of node
        g_isnodeelement = g_ixmlnode->get_type( ).
    *if node is not of type Element then continue
    *because we have got to read only text from element nodes.
        IF g_isnodeelement NE c_nodeelement.
          g_ifirstlevelctr = g_ifirstlevelctr + 1.
          CONTINUE.
        ENDIF.
    *get nodes of the element just found.
        g_ixmlnodelistmainelement = g_ixmlnode->get_children( ).
    *get number of children of main element
        g_inumchildelements = g_ixmlnodelistmainelement->get_length( ).
    *loop trhough the number of children
        WHILE g_imainelementsctr LT g_inumchildelements.
          g_ixmlnodemainelement = g_ixmlnodelistmainelement->get_item(
        g_imainelementsctr ).
    *get type of node
          g_isnodeelement = g_ixmlnodemainelement->get_type( ).
          IF g_isnodeelement NE c_nodeelement.
            g_imainelementsctr = g_imainelementsctr + 1.
            CONTINUE.
          ENDIF.
    *get name of the node.
          g_selementvalue = g_ixmlnodemainelement->get_name( ).
    *get children of node
          g_childnodelist = g_ixmlnodemainelement->get_children( ).
          g_inumchildren =  g_childnodelist->get_length( ).
          g_ichildelementcounter = 0.
    *while there are number of children of node.loop through
          WHILE g_ichildelementcounter LT g_inumchildren.
    *get the child node
            g_childnode = g_childnodelist->get_item(
    g_ichildelementcounter ).
    *check the type of node
            g_isnodeelement = g_childnode->get_type( ).
    *if node is not of element type continue
            IF g_isnodeelement NE c_nodeelement.
              g_ichildelementcounter = g_ichildelementcounter + 1.
              CONTINUE.
            ENDIF.
    *otherwise get element name
            g_selementname = g_childnode->get_name( ).
    *get value stored in this node.
            g_selementvalue = g_childnode->get_value( ).
            g_numelem = g_inumchildren - 1.
            IF g_ichildelementcounter EQ g_numelem.
              CONCATENATE: g_slinedata g_selementvalue
                      INTO g_slinedata.
            ELSE.
    *      store the value of noide in delimiter ~ line
    *      Check for Invalid characters in file
                IF g_selementvalue CA '&'.
                  REPLACE ALL OCCURRENCES OF '&amp;' IN g_selementvalue WITH
                endif.
    *if value contains delimiter then error
                IF g_selementvalue CA '~'.             
                  V_MSG = text-003.
                  EXIT.
                ELSE.
                  CONCATENATE: g_slinedata g_selementvalue '~'  .
                  INTO g_slinedata.
                ENDIF.
            ENDIF.
    *continue
            g_ichildelementcounter = g_ichildelementcounter + 1.
          ENDWHILE.
          g_ichildelementcounter = 0.
    *increment the main element counter by one to go to the next node
          g_imainelementsctr = g_imainelementsctr  + 1.
    *move the current delimiter line creted to internal table to be given
    *back to the calling program
          MOVE g_slinedata TO wa_xmldata-data.
          APPEND wa_xmldata TO it_xmldata.
          MOVE '' TO g_slinedata.
          MOVE '' TO wa_xmldata-data.
        ENDWHILE.
    *increment counter to move to hte next node.
        g_ifirstlevelctr = g_ifirstlevelctr + 1.
        g_imainelementsctr = 0.
      ENDWHILE.
    ENDFORM.                    "f_create_xmltable
    XML structure
    <?xml version="1.0" encoding="utf-8"?>
    <ABCInbound xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="C:\XYZSchema\ABCInbound.xsd">
    <HH>
    <RecordType>HH</RecordType>
    <Source>ABC</Source>
    <Destination>XYZ</Destination>
    <TimeStamp>20050909220546</TimeStamp>
    </HH>
    <BH>
    <RecordType>BH</RecordType>
    <DocType>AB</DocType>
    <Reference>2205516125</Reference>
    <DocumentDate>20080909</DocumentDate>
    <PostingDate></PostingDate>
    <CompanyCode>ABC</CompanyCode>
    <Currency>INR</Currency>
    <ExchangeRate>1.0000</ExchangeRate>
    <Park></Park>
    <ItemNumber>2</ItemNumber>
    </BH>
    <BL>
    <RecordType>BL</RecordType>
    <Reference>2205516125</Reference>
    <RefLineItem>1</RefLineItem>
    <AcctType>K</AcctType>
    <DrCrIndicator>H</DrCrIndicator>
    <Account>01000003</Account>
    <Amount>364.00</Amount>
    <VendorName-1>TOM &amp; JERRY IS MY</VendorName-1>
    <VendorName-2> NAME TO BE PAID</VendorName-2>
    <VendorName-3>1987566Z</VendorName-3>
    <VendorName-4>22</VendorName-4>
    <Street>UCX STREET</Street>
    <City>ROAD 4</City>
    <PostalCode>515004</PostalCode>
    <Country>IND</Country>
    <ContactPerson></ContactPerson>
    <AlternatePayeeCode></AlternatePayeeCode>
    <AlternatePayeeName-1></AlternatePayeeName-1>
    <AlternatePayeeName-2></AlternatePayeeName-2>
    <AlternatePayeeName-3></AlternatePayeeName-3>
    <PaymentTerms></PaymentTerms>
    <BaselineDate></BaselineDate>
    <PaymentMethods></PaymentMethods>
    <Allocation></Allocation>
    <LineItemText>item text</LineItemText>
    <TaxCode></TaxCode>
    <TaxAmount>0.00</TaxAmount>
    <WHTaxCode></WHTaxCode>
    <WHTaxbase>0.00</WHTaxbase>
    <Fund></Fund>
    <FundCenter></FundCenter>
    <CostCenter></CostCenter>
    <InternalOrder></InternalOrder>
    <TaxAutomatically></TaxAutomatically>
    <SpecialGLIndicator></SpecialGLIndicator>
    </BL>
    <TT>
    <RecordType>TT</RecordType>
    <TotalRecords>1</TotalRecords>
    <TotalValue>222</TotalValue>
    </TT>
    </ABCInbound>
    when the above xml file is read and populated into ITAB, for element vendorname-2 which has a space in first position , that space is ignored.
    This is being used for a FB01 posting and vendor is paid based on Name1+Name2 printed on cheque and due to the space ignoring problem, the vendor name is displayed wrongly thus causing problems.
    I appreciate if someone could guide me thru and help me in solving this problem.
    How to preserve the leading or trailing space.
    g_selementvalue = g_childnode->get_value( ).
    when i check g_selementvalue, space is ignored.
    i will be greateful if someone could guide me through.
    Regards,
    Simha
    Edited by: Simha on Dec 11, 2008 10:49 AM

    0.02: A C C E P T: Request="NEXT"
    0.06: Fetch session state from database
    0.08: ...Check session ... owner
    0.08: ...Metadata: Fetch Page, Computation, Process, and Branch
    0.08: Session: Fetch session header information
    0.08: ...Metadata: Fetch page attributes for application ..., page 330
    0.08: ...Validate item page affinity.
    0.08: ...Validate hidden_protected items.
    0.08: ...Check authorization security schemes
    0.08: Session State: Save form items and p_arg_values
    0.08: ...Session State: Save "P330_PROJECT" - saving same value: ""
    0.09: ...Session State: Saved Item "P330_SHUTTLE" New Value=""
    0.09: Processing point: ON_SUBMIT_BEFORE_COMPUTATION
    0.09: Branch point: BEFORE_COMPUTATION
    0.09: Computation point: AFTER_SUBMIT
    0.09: Tabs: Perform Branching for Tab Requests
    0.09: Branch point: BEFORE_VALIDATION
    0.09: ...Evaluating Branch: BEFORE_VALIDATION type: "REDIRECT_URL" button: 12904321314585385 branch: (Unconditional)
    0.09: Perform validations:
    0.09: ...Item Not Null Validation: P330_SHUTTLE
    0.09: ...Validation did NOT pass
    This is from debugging, what does the point "0.09: ...Session State: Saved Item "P330_SHUTTLE" New Value="" "
    mean ? I think it means, that the Shuttle somehow sets itself to null ?! but i dont understand why...
    There is no computation or anything that deletes the shuttle, the page is quite small, there is not much more than the shuttle and the validations and computations to give default value and transforming the shuttle items into a collection to continue working with the IDs.
    I dont check whats the problem
    Edited by: user12154443 on 21.07.2010 09:47

  • XML Parser Problem

    am using XML parser for PL/SQL in Oracle9i Enterprise Edition Release 9.0.1.1.1
    When i run the sample xml program, i get error which is as follows. While compiling no errors. But while executing it reports error as given below.
    SQL> execute domsample('c:\xml', 'family.xml', 'errors.txt');
    begin domsample('c:\xml', 'family.xml', 'errors.txt'); end;
    ORA-20100: Error occurred while parsing: No such file or directory
    ORA-06512: at "COMMODITYBACKCONNECT.XMLPARSER", line 22
    ORA-06512: at "COMMODITYBACKCONNECT.XMLPARSER", line 79
    ORA-06512: at "COMMODITYBACKCONNECT.DOMSAMPLE", line 80
    ORA-06512: at line 1
    What need to be done to rectify the above problem.
    when i do the following validation check
    SQL>
    SQL> select substr(dbms_java.longname(object_name),1,30) as class, status
    2 from all_objects
    3 where object_type = 'JAVA CLASS'
    4 and object_name = dbms_java.shortname('oracle/xml/parser/v2/DOMParser')
    5 ;
    CLASS STATUS
    oracle/xml/parser/v2/DOMParser VALID
    oracle/xml/parser/v2/DOMParser VALID
    Please advice to how remove the following error:
    ORA-20100: Error occurred while parsing: No such file or directory

    Found the solution on metalink. There is a file under /$ORACLE_HOME/javavm/install/init_security.sql
    which needs to be run under username where you are installing xml parser.
    This step is not in readme.txt file provided as a part of download from the OTN website.

  • Sax parser problem

    hi,
    i am assuming the problem is with sax parser but i cant be sure. I am parsing a xml file (about 1.4MB) with some data in it. the parser i have created reads the xml file correctly for the most part but when at some point the
    "public void characters(char buf[], int offset, int len) throws SAXException"
    function stops working correctly....i.e it doesnt fully read read the data between the "<start>" and "</start>" element. say it reads about 100 id's correctly---for 101 ID it does this. This is just an example. Since, the problem might be with how :
    "public void characters(char buf[], int offset, int len) throws SAXException"
    function is reading the data i was wondering if anybody else had encountered this problem or please let me know if i need to change something in the code: here's a part of the code :
    Bascially i have created three classes to enter data into three mysql tables and as i parse the data i fill up the columns by matching the column header with the tagName.
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.SQLException;
    import java.sql.*;
    import java.io.*;
    import java.util.ArrayList;
    import java.lang.Object;
    import org.xml.sax.*;
    import org.xml.sax.helpers.DefaultHandler;
    import java.util.*;
    import javax.xml.parsers.SAXParserFactory;
    import javax.xml.parsers.ParserConfigurationException;
    import javax.xml.parsers.SAXParser;
    public class Echo03 extends DefaultHandler
    StringBuffer textBuffer;
    int issuedValue, prodValue;
    OrdHeader header = new OrdHeader();
    OrdDetail detail = new OrdDetail();
    Member memInfo = new Member();
    //new addition to store the dynamic value of the products
    TestOrdheader prod = new TestOrdheader();
    int counter;
    String tag, newTag;
    SetValue setVal = new SetValue();
    String test;
    public static void main(String argv[])
    if (argv.length != 1) {
    System.err.println("Usage: cmd filename");
    System.exit(1);
    // Use an instance of ourselves as the SAX event handler
    DefaultHandler handler = new Echo03();
    // Use the default (non-validating) parser
    SAXParserFactory factory = SAXParserFactory.newInstance();
    try {
    // Set up output stream
    out = new OutputStreamWriter(System.out, "UTF8");
    // Parse the input
    SAXParser saxParser = factory.newSAXParser();
    saxParser.parse( new File(argv[0]), handler);
    } catch (Throwable t) {
    t.printStackTrace();
    System.exit(0);
    static private Writer out;
    private String indentString = " "; // Amount to indent
    private int indentLevel = 0;
    //===========================================================
    // SAX DocumentHandler methods
    //===========================================================
    public void startDocument()
    throws SAXException
    nl();
    nl();
    emit("START DOCUMENT");
    nl();
    emit("<?xml version='1.0' encoding='UTF-8'?>");
    header.assign();
    public void endDocument()
    throws SAXException
    nl(); emit("END DOCUMENT");
    try {
    nl();
    out.flush();
    } catch (IOException e) {
    throw new SAXException("I/O error", e);
    public void startElement(String namespaceURI,
    String lName, // local name
    String qName, // qualified name
    Attributes attrs)
    throws SAXException
    indentLevel++;
    nl(); //emit("ELEMENT: ");
    String eName = lName; // element name
    if ("".equals(eName)) eName = qName; // namespaceAware = false
    if (qName.equals("Billing")){
    issuedValue = 1;
    }else if (qName.equals("Shipping")){
    issuedValue = 2;
    }else if (qName.equals("ShippingTotal")){
    issuedValue = 3;
    //check to see if "Product" is the name of the element thats coming next
    if (qName.equals("Product")){
    if (issuedValue != 3){
    prodValue = 1;
    prod.addCounter();
    }else{
    prodValue = 0;
    tag = eName;
    if (attrs != null) {
    for (int i = 0; i < attrs.getLength(); i++) {
    String aName = attrs.getLocalName(i); // Attr name
    if ("".equals(aName)) aName = attrs.getQName(i);
    nl();
    emit(" ATTR: ");
    emit(aName);
    emit("\t\"");
    emit(attrs.getValue(i));
    emit("\"");
    if (attrs.getLength() > 0) nl();
    public void endElement(String namespaceURI,
    String sName, // simple name
    String qName // qualified name
    throws SAXException
    nl();
    String eName = sName; // element name
    if ("".equals(eName)){
    eName = qName; // not namespaceAware
    if ("Order".equals(eName)){          
    //enter into database
         databaseEnter();
    textBuffer = null;
    indentLevel--;
    public void characters(char buf[], int offset, int len)
    throws SAXException
    nl();
    try {
    String s = new String(buf, offset, len);
    if (!s.trim().equals("")){
    settag(tag, s);
    s = null;
    }catch (NullPointerException E){
    System.out.println("Null pointer Exception:"+E);
    //===========================================================
    // Utility Methods ...
    //===========================================================
    // Wrap I/O exceptions in SAX exceptions, to
    // suit handler signature requirements
    private void emit(String s)
    throws SAXException
    try {
    out.write(s);
    out.flush();
    } catch (IOException e) {
    throw new SAXException("I/O error", e);
    // Start a new line
    // and indent the next line appropriately
    private void nl()
    throws SAXException
    String lineEnd = System.getProperty("line.separator");
    try {
    out.write(lineEnd);
    for (int i=0; i < indentLevel; i++) out.write(indentString);
    } catch (IOException e) {
    throw new SAXException("I/O error", e);
    ===================================================================
    ///User defined methods
    ===================================================================
    private String strsplit(String splitstr){
    String delimiter = new String("=");
    String[] value = splitstr.split(delimiter);
    value[1] = value[1].replace(':', ' ');
    return value[1];
    public void settag(String tag, String s){         
    String pp_transid = null, pp_respmsg = null,pp_authid = null, pp_avs = null, pp_avszip = null;
    if ((tag.equals("OrderDate")) || (tag.equals("OrderProcessingInfo"))){
    if (tag.equals("OrderDate")){
    StringTokenizer st = new StringTokenizer(s);
    String orddate = st.nextToken();
    String ordtime = st.nextToken();
    header.put("ordDate", orddate);
    header.put("ordTime", ordtime);
    }else if (tag.equals("OrderProcessingInfo")){
    StringTokenizer st1 = new StringTokenizer(s);
    int tokenCount = 1;
    while (tokenCount <= st1.countTokens()){
    switch(tokenCount){
    case 1:
    String extra = st1.nextToken();
    break;
    case 2:
    String Opp_transid = st1.nextToken();
    pp_transid = strsplit(Opp_transid);
    break;
    case 3:
    String Opp_respmsg = st1.nextToken();
    pp_respmsg = strsplit(Opp_respmsg);
    break;
    case 4:
    String Opp_authid = st1.nextToken();
    pp_authid = strsplit(Opp_authid);
    break;
    case 5:
    String Opp_avs = st1.nextToken();
    pp_avs = strsplit(Opp_avs);
    break;
    case 6:
    String Opp_avszip = st1.nextToken();
    pp_avszip = strsplit(Opp_avszip);
    break;
    tokenCount++;
    header.put("pp_transid", pp_transid);
    header.put("pp_respmsg", pp_respmsg);
    header.put("pp_authid", pp_authid);
    header.put("pp_avs", pp_avs);
    header.put("pp_avszip", pp_avszip);
    }else{
    newTag = new String(setVal.set_name(tag, issuedValue));
    header.put(newTag, s);
    //detail.put(newTag, s);
    prod.put(newTag, s);
    memInfo.put(newTag,s);
    //Check to see-- if we should add this product to the database or not
    boolean check = prod.checkValid(newTag, prodValue);
    if (check){
    prod.addValues(s);
    setVal.clearMod();
    ==================================================================
    Here's the error that i get:
    java.util.NoSuchElementException
    at org.apache.crimson.parser.Parser2.parseInternal(Parser2.java:691)
    at org.apache.crimson.parser.Parser2.parse(Parser2.java:337)
    at org.apache.crimson.parser.XMLReaderImpl.parse(XMLReaderImpl.java:448)
    at javax.xml.parsers.SAXParser.parse(SAXParser.java:345)
    at javax.xml.parsers.SAXParser.parse(SAXParser.java:281)
    at Echo03.main(Echo03.java:47)

    I haven't gone through your code but I also had a similar error....and the exception in my was because of an "&" instead of the entity reference & in one of the element values. I use a non-validating parser but if you use a validating one then this might not be the reason for your exception.

  • Camera Raw Photoshop CS2 & Bridge Parsing Problem

    I am having an issue with Photoshop CS2. I am trying to work on a .tiff file that I have used the HDR automate tool from. The HDR renders files in 32-bit and therefor I render back to 16-bit once I have compressed the files and save as a .tiff file.
    I then use bridge to try and open the .tiff file and the camera raw file is shaded grey. I also have tried opening in PS CS2 and this message comes up when I try and force Camera Raw to Open..."Could not complete your request because the file-format module cannot parse the file".
    PS will open the tiff file on a compressed version and not in the Camera Raw Function.
    I have read numerous posts on this kind of problem and people say to update your camera raw plu-in and I have done that and am having the same problem.
    Any suggestions I would very much appreciate it.

    Hi Patrick,
    You need CR 4.x and Ps CS3 in order to open non-camera raw TIFFs.

  • Faces-config.xml XML parser problem ???

    I'm taking below error message when I was opening faces-config.xml file with diagram view, what's the exact solution of this problem???
    Message
    BME-99100: An error has been reported from the XML parser
    Cause
    The parse has reported the following error:
    <Line 24, Column 2>: XML-20201: (Fatal Error) Expected name instead of <.
    Action
    Thanks for all...
    Message was edited by:
    user559176

    I looked very well, there was'nt any error on line 24 about "<", I think if the size of faces-confic.xml file increased JDeveloper XML Parser cannot parse with high file size, what're other solutions?

  • Parsing problem in Camera Raw

    "Unable to save the raw conversion settings.  There was an error parsing the file."
    This  error message has begun to appear frequently when after working on  old (3-4 yrs old) jpeg files.  No problem opening the files, but clicking "Done" brings up the error message (and, of course, the changes are not saved.)  Some files in a folder are fine; others  get this error.  I see no obvious difference between the files. I've tried making a duplicate of the file and working on that.  Sometimes that works, but usually not.
    Is  there some way to fix this problem when it occurs?  I'd appreciate any  ideas.  (Using Photoshop CS5 and Windows 7.)

    First, let me say that you might get more direct answers by posting into the Camera Raw forum:
    http://forums.adobe.com/community/cameraraw
    They may ask you for a file with which to reproduce the problem.
    Out of curiosity, did you open these JPEG files at some point in the past using an older version of Camera Raw?  Assuming you did, keep in mind that Camera Raw writes metadata back into JPEG files when you open them, even if you never direct the software to save back to the original JPEG file.  Put simply, an "original" JPEG file is no longer original after Camera Raw has been used on it.  Yes, it's hard to believe.
    If I'm on the right track here, it sounds as though not only did it write data back into the file, but now perhaps the new version can't quite make sense of what the older version wrote.
    I have an open thread in the Camera Raw forum in which I am requesting that this behavior (writing data back to the input file) be made optional.  Please feel free to add to it if that's what's happened to you.
    http://forums.adobe.com/thread/848551?tstart=0
    -Noel

  • Parsing Problem in different platform

    Hi~ Can anyone help me?? I have problem parsing a html page to xml using tagsoup. The parsed xml file look file in Windows XP Professional environment (i.e. only one <head> and <body> tags). But when I execute the code in Windows Server 2003 Enterprise x64 Edition, the parsed xml file will contain multiples <head> and <body> tags. Anyone know what's went wrong?

    First, let me say that you might get more direct answers by posting into the Camera Raw forum:
    http://forums.adobe.com/community/cameraraw
    They may ask you for a file with which to reproduce the problem.
    Out of curiosity, did you open these JPEG files at some point in the past using an older version of Camera Raw?  Assuming you did, keep in mind that Camera Raw writes metadata back into JPEG files when you open them, even if you never direct the software to save back to the original JPEG file.  Put simply, an "original" JPEG file is no longer original after Camera Raw has been used on it.  Yes, it's hard to believe.
    If I'm on the right track here, it sounds as though not only did it write data back into the file, but now perhaps the new version can't quite make sense of what the older version wrote.
    I have an open thread in the Camera Raw forum in which I am requesting that this behavior (writing data back to the input file) be made optional.  Please feel free to add to it if that's what's happened to you.
    http://forums.adobe.com/thread/848551?tstart=0
    -Noel

  • XML parsing problems with Oracle XML parser for PL/SQL

    I am using the Oracle XML parser for PL/SQL to transform XML into HTML usign XSL. The parser gives me sporadic errors trying to parse various XML documents. For the same XML source, the XMLPARSER will parse without errors one day and the next day will give me errors such as "invalid char in text", "Expected ';'.", or even Java null pointer exceptions.
    I have verified that the XML sources are well formed, so I am pretty certain that the problems I am having are bugs in the XMLPARSER.
    Is there going to be a XML parser for PL/SQL version 2 that will fix these bugs? If so, when??? If not, is there anything else I could do to fix these problems?
    Thanks!

    You can use the latest version.

  • DOM: parsing problem, inputstream

    Hi,
    We are developing a simple server that translates a XML query to a SQL query, sends that SQL query to the database, translates the result to a XML resultset and sends it back to the connecting client.
    We are using DOM to interpret the XML in order to build the XML query, since DOM builds a tree (that we use as a buffer), instead of SAX that has to be interpreted realtime.
    Our problem is as follows: the inputstream of the socket act as the input stream for DOM. No exception occures, but at the point when we call domParser.parse();, the thread hangs. When we close the connection, the local output (at the server) is done; the thread continues.
    We assume that the following causes the problem: the inputstream is used to read the XML from. But when the XML is sent over the stream, the stream is not closed. Somehow the parser still expects something. When the clientconnection is closed, the stream is closed and the thread can continue; the parser know that the input is ended.
    Do you know how to solve this? We cannot just close the connection, because we need to receive the result. Does the parser expects some end indicator? For the inputstream for the parser we use a BufferedReader (otherwise we are getting a NullPointerException).
    Thanks! And cheers,
    Jeroen Oosterlaar

    personaly, for doing a similar stuff, on the server I accumulate the XML lines received over the socket, until I bump into a pre-defined stop line, then I send the accumulated XML data to the parser.
    but it might not be the most elegant solution!

  • DOM Parsing problems... (newbie in trouble)

    I am trying to get a DOM Parser contruct a DOM Object from an XML file... I am having trouble getting the code validate against my XML Schema: <p>
    <?xml version="1.0" encoding="UTF-8"?> <
    <!-- edited with XML Spy v4.4 U (http://www.xmlspy.com) by Fedro E. Ponce de Leon Luengas (ASI Consulores, S.A. de C.V.) -->
    <xs:schema targetNamespace="http://palaciohierro.com.mx/mde/expe" xmlns="http://palaciohierro.com.mx/mde/expe" xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <xs:element name="existencia-peticion" type="epType">
    <xs:annotation>
    <xs:documentation>Peticion de existencias para la Mesa de Eventos Web</xs:documentation>
    </xs:annotation>
    </xs:element>
    <xs:complexType name="epType">
    <xs:annotation>
    <xs:documentation>peticion de existencia</xs:documentation>
    </xs:annotation>
    <xs:sequence>
    <xs:element name="articulo" type="articuloType" maxOccurs="unbounded"/>
    </xs:sequence>
    </xs:complexType>
    <xs:complexType name="articuloType">
    <xs:annotation>
    <xs:documentation>articulo</xs:documentation>
    </xs:annotation>
    <xs:attribute name="id_articulo" type="IdentifierType" use="required"/>
    <xs:attribute name="sku" type="skuType" use="required"/>
    </xs:complexType>
    <xs:simpleType name="IdentifierType">
    <xs:annotation>
    <xs:documentation>identificador</xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:long">
    <xs:minInclusive value="0"/>
    <xs:maxInclusive value="999999999999999999"/>
    <xs:totalDigits value="22"/>
    <xs:fractionDigits value="0"/>
    </xs:restriction>
    </xs:simpleType>
    <xs:simpleType name="skuType">
    <xs:annotation>
    <xs:documentation>sku</xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:string">
    <xs:minLength value="11"/>
    <xs:maxLength value="20"/>
    <xs:pattern value="\d{11,20}"/>
    </xs:restriction>
    </xs:simpleType>
    </xs:schema>
    taking this sample XML file:
    <?xml version="1.0" encoding="UTF-8"?>
    <!--Sample XML file generated by XML Spy v4.4 U (http://www.xmlspy.com)-->
    <expe:existencia-peticion xmlns:expe="http://palaciohierro.com.mx/mde/expe" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://palaciohierro.com.mx/mde/expe
    C:\oracle\Oracle9iDS\jdev\mywork\testCompra\MesaEventos\src\ph\mesaeventos\schema\existencia-peticion.xsd">
    <articulo id_articulo="450" sku="12245110021"/>
    <articulo id_articulo="15" sku="45421213223"/>
    <articulo id_articulo="12" sku="121131231858"/>
    <articulo id_articulo="74" sku="4101031234545"/>
    <articulo id_articulo="871" sku="022324563212"/>
    </expe:existencia-peticion>
    with the following code:
    public Document getDOM( String existenciapeticionXML ) throws Exception
    // Obtain parser instance and parse the document
    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
    factory.setValidating( true );
    factory.setNamespaceAware( true );
    DocumentBuilder builder = factory.newDocumentBuilder();
    byte buf[] = existenciapeticionXML.getBytes();
    ByteArrayInputStream stream = new ByteArrayInputStream( buf );
    Document doc = builder.parse( stream );
    return doc;
    I am getting the following Exception:
    oracle.xml.parser.v2.XMLParseException: Element 'expe:existencia-peticion' used but not declared.
    void oracle.xml.parser.v2.XMLError.flushErrors()
    XMLError.java:145
    void oracle.xml.parser.v2.NonValidatingParser.parseDocument()
    NonValidatingParser.java:263
    void oracle.xml.parser.v2.XMLParser.parse(org.xml.sax.InputSource)
    XMLParser.java:141
    org.w3c.dom.Document oracle.xml.jaxp.JXDocumentBuilder.parse(org.xml.sax.InputSource)
    JXDocumentBuilder.java:96
    org.w3c.dom.Document javax.xml.parsers.DocumentBuilder.parse(java.io.InputStream)
    DocumentBuilder.java:119
    org.w3c.dom.Document ph.mesaeventos.mesa.xml.ExistenciaPeticionDOM.getDOM(java.lang.String)
    ExistenciaPeticionDOM.java:26
    void ph.mesaeventos.mesa.xml.Test.main(java.lang.String[])
    Test.java:38
    What am I doing wrong? I am clueless... please help!
    Thanks,

    I finally managed to make it work.... well quite!
    Having an XML Doc like this:
    <?xml version="1.0"?>
    <existencia-peticion xmlns = "http://palaciohierro.com.mx/mde/expe">
    <articulo id_articulo="10" sku="00000000010"></articulo>
    <articulo id_articulo="11" sku="00000000011"></articulo>
    <articulo id_articulo="12" sku="00000000012"></articulo>
    <articulo id_articulo="13" sku="00000000013"></articulo>
    </existencia-peticion>
    with an schema like:
    <?xml version="1.0" encoding="UTF-8"?>
    <schema targetNamespace="http://palaciohierro.com.mx/mde/expe"
    xmlns="http://www.w3.org/2001/XMLSchema"
    xmlns:expe="http://palaciohierro.com.mx/mde/expe"
    elementFormDefault="qualified">
    <annotation>
    <documentation xml:lang="es">
    Esquema de peticion de existencias para la Mesa de Eventos Web
    Copyright 2002 palaciodehierro.com.mx. Todos los derechos reservados.
    </documentation>
    </annotation>
    <element name="existencia-peticion" type="expe:epType">
    <unique name="id_articulo">
    <selector xpath="expe:articulo"/>
    <field xpath="@id_articulo"/>
    </unique>
    <unique name="sku">
    <selector xpath="expe:articulo"/>
    <field xpath="@sku"/>
    </unique>
    </element>
    <complexType name="epType">
    <annotation>
    <documentation>peticion de existencias</documentation>
    </annotation>
    <sequence>
    <element name="articulo" type="expe:articuloType" maxOccurs="unbounded"/>
    </sequence>
    </complexType>
    <complexType name="articuloType">
    <annotation>
    <documentation>articulo</documentation>
    </annotation>
    <attribute name="id_articulo" type="expe:IdentifierType" use="required"/>
    <attribute name="sku" type="expe:skuType" use="required"/>
    </complexType>
    <simpleType name="IdentifierType">
    <annotation>
    <documentation>identificador</documentation>
    </annotation>
    <restriction base="long">
    <minInclusive value="0"/>
    <maxInclusive value="999999999999999999"/>
    <totalDigits value="18"/>
    <fractionDigits value="0"/>
    </restriction>
    </simpleType>
    <simpleType name="skuType">
    <annotation>
    <documentation>sku</documentation>
    </annotation>
    <restriction base="string">
    <minLength value="11"/>
    <maxLength value="20"/>
    <pattern value="\d{11,20}"/>
    </restriction>
    </simpleType>
    </schema>
    and with the following class:
    public class XMLValidator
    // Instancia singleton
    private static XMLValidator validator = new XMLValidator();
    * Constructor privado
    private XMLValidator()
    * Mitodo para acceder a la instancia Singleton de XMLValidator
    * @regresa <b>XMLValidator</b> La instancia de esta clase
    public static XMLValidator getValidator()
    return validator;
    public boolean validaEsquema( String docXML, String esquema ) throws Exception
    // Establece el URL correcto para el documento de esquema
    XSDBuilder builder = new XSDBuilder();
    URL url = createURL( esquema );
    // Construye el objecto del Schema XML
    try
    XMLSchema schemadoc = (XMLSchema)builder.build( url );
    // Valida el documento XML procesandolo contra el esquema
    return validate( docXML, schemadoc );
    catch( XMLParseException e )
    throw new Exception( "Error al analizar el documento XML: " + e.getMessage() );
    catch( Exception e )
    throw new Exception( "No es posible validar con el esquema: " + e.getMessage() );
    private static boolean validate(String docXML, XMLSchema schemadoc) throws Exception
    boolean isValid = false;
    // Crea un objeto Parser DOM de XML
    DOMParser dp = new DOMParser();
    // Establece el objeto Schema XML para la validacion
    dp.setXMLSchema( schemadoc );
    dp.setValidationMode( XMLParser.SCHEMA_VALIDATION );
    dp.setPreserveWhitespace( true );
    // Establece la salida de errores
    dp.setErrorStream( System.out );
    // Recupera los datos del documento XML en un objeto InputStream
    byte[] docbytes = docXML.getBytes();
    ByteArrayInputStream in = new ByteArrayInputStream( docbytes );
    // Parsea el documento y validalo contra el esquema
    try
    dp.parse( in );
    isValid = true;
    catch( Exception e )
    // Devuelve el documento XML DOM construido durante el parseo
    return isValid;
    I am able to validate when invoking with the XML and schemas in the parameters...
    Problem is that I have to include the attribute xmlns = "http://palaciohierro.com.mx/mde/expe" in my XML doc.
    What I really need is to be able to validate de XML doc against a stablished schema, when the XML doc does not include the
    xmlns attribute.

Maybe you are looking for