Handling invalid datetime

I am learning and using dbxml 2.5.16 for a Django project involving xml feeds roughly structured like this:
<rss>
<channel>
<item>
<content></content>
<date></date>
</item>
</channel>
</rss>
I have to figure out a query string selecting item objects by date elements, comparing a year and/or month and/or day value to an integer value I provide by URl.
Problem is that date elements in my xml file are formatted like this:<date>Fri, 03 Aug 2012 11:56:58 GMT</date>
I would like to convert the date and do the comparison inside my querystring, without accessing the document.
Is it possible?
Or should I reformat all date elements using python's strptime() on the xml before I put it in my container?
What I have in mind is this sort of thing (obviously not working):
yrset = r"collection()/rss/channel/item[(time.strptime(pubDate,'%a %d %b %Y %H %M %S %Z').tm_year = year ) and enclosure/@url = key]"
my thanks
Renato

A little update: I actually got by with a simple query that performs a replace on month names, this might be enough. What is looking ugly now is that i prepare and execute a separate query for each month name. I could not come up with a less unseemly way to group a multiple replace.
I took a shot at replace-multi(xquery) and format-dateTime(xpath 2.0) but I couldn'get them to work.
Recursive function maybe?
I want to replace a set of node values , returning them with the right number representing the month value instead of a name substring, e.g. 08 instead of Aug.
Sorry for my poor English and skills, I'm taking my time to learn.

Similar Messages

  • Invalid datetime format with odbc connection (VBA, Excel)

    Hello!
    I try to use QueryTable to extract data from the oracle-db.
    Source:
    sConn = "ODBC;DSN=" + odbc_dns + ";"
    Set oQt = tabelle.QueryTables.Add(Connection:=sConn, Destination:=tabelle.Range("a5"), sql:=sSql)
    oQt.Refresh
    As result I get this error message:
    "[Oracle][ODBC] Invalid datetime format"
    Is there any setting I need to do?
    regards
    Pietro

    Select to_char(entrydate,'dd/mm/yyyy) from usertable;Forgot the closing ' after yyyy.

  • Invalid datetime format (null) Elements 4 and 7

    I have about 20,000 photos in Elements 4 organizer (windows XP SP2). I am trying to get the catalog in shape to be converted to Elements 7 format--it will not convert at present, telling me the file has errors in which need to be fixed before conversion. In Elements 4 I've run "Recovery" which completes successfully (several times). I've tried "reconnect all files" which reports all files are connected.
    But I think I have found the problem. There is one file/photo with the same name (it is the same photo) both inside and outside of a version set. I do not know how or when this happened.
    Whenever I try to do any of the following I get the same error
    1. Delete either version of the file (i.e. inside or outside of the version set)
    2. Stack the outside file/photo with the 2 in the version set
    3. Convert the version set to individual photos
    The Error is
    The ODBC data source reported the following error
    "[Microsoft][ODBC Microsoft Access Driver] Invalid datetime format (null)"
    By the way, the metadata for this photo has a proper date. I have tried various tricks like deleted the file outside of Elements, adding it back with a reconnect, etc. No resolution.
    I am completely stumped. By the way, other than this, the Organizer seems to work OK (a bit slow sometimes, but that is relative. I was hoping 7 would be faster).
    Please advise.

    John
    Thanks for the tips. The following are the last several lines from the conversion log:
    created media a:107486 for file "J:/Album of Photos/2005 Photos/2005_04_22 Barcelona/133_3382_edited-1.jpg"
    created media a:107502 for file "J:/Album of Photos/2005 Photos/2005_04_22 Barcelona/133_338920050423.JPG"
    created media a:107518 for file "J:/Album of Photos/2005 Photos/2005_04_22 Barcelona/133_3387.JPG"
    created media a:107534 for file "J:/Album of Photos/2005 Photos/2005_04_22 Barcelona/133_3388.JPG"
    created media a:107550 for file "J:/Album of Photos/2005 Photos/2005_04_23 Barcelona/133_3386.JPG"
    The file 133_3386 is the problem file I noted. However the first instance in the log above has a 2005_04_22 date, which does not exist in the actual file.
    I don't have PSE5 and I don't know ACCESS. Does any of this make sense?
    Ralph

  • How to handle invalid images in "Image" report item?

    I have a report that displays images in Image item (MIMEType image/jpeg) in the table. Images are stored in the database.
    Some of the images are, however, not a valid jpeg files (not sure what they are but I saved them as files and they cannot be opened by any graphics editor). When report server tries to display such an image in the report whole report fails.
    Similarly, web application that tries to display them on the web page throws an exception. In web application we can catch that exception and show static "IMAGE IS INVALID" bitmap instead.
    Is there a way to handle/catch such errors in SSRS? The way it is now is not good because error message doesn't tell you anything specific about error.

    Enabling SSRS Remote errors
    http://technet.microsoft.com/en-us/library/aa337165.aspx
    http://www.sharepointjohn.com/sql-reporting-services-2008-r2-enable-remote-errors/
    Displaying custom error message
    http://social.msdn.microsoft.com/Forums/en-US/sqlreportingservices/thread/2b891541-836f-4d9d-89f3-d2340319f453/
    Best Regards,Uri Dimant SQL Server MVP,
    http://sqlblog.com/blogs/uri_dimant/
    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting:
    Large scale of database and data cleansing
    Remote DBA Services:
    Improves MS SQL Database Performance
    SQL Server Integration Services:
    Business Intelligence

  • How to handle invalid URLs in the requests

    Currently JSF ignores invalid characters in the request URLs like "|" or "<script>". These characters can be a security issue and can lead to "Cross site scripting" issue.
    I am trying to parse the request URLs and then redirect the user to the error page if the URL contains such invalid characters.
    Is there a better way of handling such characters in the URL?
    One way that i have thought of is to implement the PhaseListener and handle the URLs in the "Restore view" phase but the drawback in this
    implementation is that the controll will come to this listener during all the phases of the JSF life cycle. I just want the request to be handled only once and not during all the phases of JSF.

    Our application has too many customizations around the JSF framework and we have our own limitations extending the base "FacesServlet". It would be better if i can extend the listeners in the JSF framework.

  • How to handle Invalid characters(Square Box) in BI

    Hi All,
    Daily I am  getting Invalid character(Square Box) issue with 0Material description and material manufacture part number when the it is being loaded to targets.
    This data is being loaded to many data targets and daily they are being failed .
    I have checked the text in MARA Table and found that there also the square box is appearing in the description.But when i copy the text and past it in word document in the place of box it is appearing as space/Tab.
    Can you please help me how to handle this type of issue in BI .
    Thanks in advance

    Hi Binbi1,
       This eror is due to carriage returns which turns into a square box when transferring data, this can not be corrected through the RSKC, this is solved through an ABAP routine in the transformation rules, use this code:
    DATA i_text type c length 60.
    i_text = SOURCE_FIELDS-/BIC/ZMBS_FT1. "this is your material description field
    REPLACE ALL OCCURRENCES OF '#'
              IN i_text WITH ' '.
    REPLACE ALL OCCURRENCES OF '□'
              IN i_text WITH ' '.
    RESULT = i_text.
    I hope this help you....

  • Handling invalid Dates In query for Invalid dates in date column.

    Hi,
    I have a date column in my table. This column has corrupted data so the when i use any
    to_timestamp function or any other date calcualtions my query breaks with the error:
    ORA-01843: not a valid month.
    I am aware the data is the issue.
    But i want to handle this scenario by putting nulls in the output when ever an invalid date is encountered.
    I have done some research and found the custom function is_date() on net.
    But i am not suppose to create any new function but handle it with in my query.
    Help is appreciated to handle this scenario.

    Prasath wrote:
    Try this!!
    With Tab As(Select '12/01/2009' txt From dual)
    SELECT Decode(Length(Replace(Translate( txt
    , '0123456789/'
    , Null
    , to_date(txt,'mm/dd/yyyy')
    , NULL) As Validation_date
    FROM tab;
    Ok ...
    SQL> With Tab As(Select '12/01/2009' txt From dual)
      2      SELECT Decode(Length(Replace(Translate( txt
      3                                            , '0123456789/'
      4                                            , '#')
      5                                  ,'#'))
      6                   , Null
      7                   , to_date(txt,'mm/dd/yyyy')
      8                   , NULL) As Validation_date
      9       FROM tab;
    VALIDATIO
    01-DEC-09Not sure what that proves, especially in relation to the OP's problem.

  • Handle invalid character tab

    Hi,
    There are some invalid (tab) character coming from the source system. I want to convert this tab character to space.
    I do see the codes posted here in this link.
    My question is?
    1) The following code needs to be put in Uupdate rule?
    2) Can I have a code just to handle the tab character to space instead checking all the characters. Because in my case only the invalid (tab) character is coming in.
    Thanks.
    /people/sap.user72/blog/2006/07/23/invalid-characters-in-sap-bw-3x-myths-and-reality-part-2
    Something you really need in any system. Here is a completely compatible variant that also checks if the InfoObject allows lower case letters.
    DATA: l_d_length like sy-index,
    l_d_char type c,
    l_d_index type sy-index.
    l_d_length = strlen( result ).
    result = COMM_STRUCTURE-/BIC/ZZZ.
    DO l_d_length times.
    l_d_index = sy-index - 1.
    l_d_char = result+l_d_index(1).
    CALL FUNCTION 'RSKC_CHAVL_OF_IOBJ_CHECK'
    IMPORTING
    I_CHAVL = l_d_char
    I_IOBJNM = 'ZZZ'
    *" I_S_COB_PRO =
    *" I_T_COB_PRO_CMP =
    EXCEPTIONS
    CHAVL_NOT_ALLOWED = 1.
    IF SY-SUBRC <> 0.
    result+l_d_index(1) = ' '.
    ENDIF.
    ENDDO.

    Hi,
    1.     You can write the routine to replace invalid character in the update rule.
    2.     you can use the following code to replace only the TAB character:
    FIELD-SYMBOLS: <fs_x> TYPE x,
                   <fs_c> TYPE c.
    DATA:
    invchar(32) TYPE x VALUE ‘09209520’.
    RESULT = COMM_STRUCTURE-/BIC/FIELDNAME.
    ASSIGN invchar TO <fs_x> CASTING.
    ASSIGN <fs_x> TO <fs_c> CASTING.
    TRANSLATE RESULT USING <fs_c>.

  • Handle invalid html tag in the htmlText

    Hello,
    I"ve a <mx:text control which takes html text, it is a chat application, so, the client will simply concatinate the text comming through the network. But if the html text has invalid tags, it does not show the rest of the chat messages.
    I get something like
    <a href="http://google.com&quot;">http://google.com<a>
    here the red text is creating problems.
    P:S: you might want to say, handle it when sending from other client, but, we are dealing with legacy data, which has a lot of html format issues.

    Thanks for responding
    I understand that adding more HTML tags will change the font size. What I don't get is why it changed from one size to another by adding a HTML tag in the first place. I figured that it should have retained the same size it was without the tag when I added the tag. If I had added a font tag I would have excpected the font to change size but I added  a href.
    Sorry for the confusion.

  • Handling Invalid character.

    Hello All
    My message mapping is failing because of an invalid character and gives the following Exception
    com.sap.aii.utilxi.misc.api.BaseRuntimeException: Fatal Error: com.sap.engine.lib.xml.parser.ParserException: Invalid char #0x1a(:main:, row:1, col:1496905) at com.sap.aii.mappingtool.tf3.Transformer.checkParserException
    Upon Investigation i found that the "char #0x1a" is an EndOfFile(EOF) character and on the browser this character looks like ' ' . Is there a way by which i can just ignore this character  so that that mapping does not fail.
    Please suggest.
    regards
    Nilesh Taunk.

    Hi Taunk
    The following informatio may help you
    File Sender: Special Characters in File Names
    <b>o Q: I am trying to get the File Adapter to poll a file, which
    contains special characters (e.g., accented characters or umlauts)
    in its file name. However, irrespectively of the wildcard mask I
    specify in the File Adapter sender channel configuration, the file
    does not get picked up. Which configuration setting do I need to
    change to get my scenario working?</b>
    o A: Under certain operating system platforms, such as Solaris, the
    APIs used by the Java Runtime (JRE) are not Unicode-aware.
    Consequently, the JRE needs to be configured to correctly interpret
    the character set it receives from the operating system.
    This is configured through the "file.encoding" system property as
    well as the "LANG" environment variable.
            Make sure you set "file.encoding" to a character set (such as
    ISO-8859-1) that supports the special characters you would like to
    process. This system property can be configured by appending
    "-Dfile.encoding=<encoding>" to the Java VM parameters section of
    the SAP J2EE Config Tool.
    Additionally, you need to set the "LANG" environment variable to a
    locale that supports more than 7 bits, such as "de.ISO8859-1". The
    encoding you specify in the LANG environment variable needs to
    match the encoding set via "file.encoding".
    You can persistently configure the environment variable by setting
    it in the profile $HOME/.sapenv_$HOSTNAME.csh of the <sid>adm user:
    setenv LANG de.ISO8859-1
    Warm Regards,
    Vijay

  • Handle invalid xml character while serializing

    I have requirement where I need to serialize a document which contains a string like "ンᅧᅭ%ンᅨ &amp;". While serializing it throws the following exception
    java.io.IOException: The character ' ' is an invalid XML character
    Is there a way we can serialize this String as is with any workaround.
    StringWriter stringOut = new StringWriter();
      DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
      DocumentBuilder docBuilder = docFactory.newDocumentBuilder();
      Document doc = docBuilder.newDocument();
      Element rootElement = doc.createElement("company");
      doc.appendChild(rootElement);
      String xml = "ンᅧᅭ%ンᅨ &amp;";
      //String xml = "ンᅧᅭ%ンᅨ &amp;";
      Element junk = doc.createElement("replyToQ");
      junk.appendChild(doc.createCDATASection(xml));
      //junk.appendChild(doc.createTextNode(stripNonValidXMLCharacters(xml)));
      rootElement.appendChild(junk);
      //org.w3c.dom.Document doc = this.toDOM();
      //Serialize DOM
      OutputFormat format = new OutputFormat(doc,"UTF-8",true);
      format.setIndenting(false);
      format.setLineSeparator("");
      format.setPreserveSpace(true);
      format.setOmitXMLDeclaration(false);
      XMLSerializer serial = new XMLSerializer( stringOut, format );
      // As a DOM Serializer
      serial.asDOMSerializer();
      serial.serialize( doc.getDocumentElement() );

    As a guess because you are treating CDATA as meaning the same as 'binary' which it isn't.  The characters in CDATA still must be valid XML characters.
    If you want binary data then base64 encode it and put that in the document - and you won't need CDATA at all then, it will just be regular element text.

  • How to handle Invalid characters in BI 7.0

    Hi ,
    Due to lower case letters in ODS ,DTP got failed ,we have replaced with Upper case letters in PSA,but how to load failed request from PSA to data target thru DTP as here we don't get option to reconstruct the failed request from PSA.we have deletd failed request from ODs and again done DTP but it is again failing .
    Thanks in Advance ,
    Rashmi

    Hi Rashmi,
    Create Error DTP, the all error records will be in error Stack and correct records will be update to data target.
    you can modify all bad records in error stack and upload to data target.
    you can create  Error DTP, at the present DTP, (2nd tab, Update).
    Regards
    Daya Sagar

  • Handling Invalid(Hex) Characters Code for Unicode BI 7.0

    Hi All,
    I went through the beautiful weblog given by Eugene.. https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/4059. [original link is broken] [original link is broken] [original link is broken] [original link is broken] In the comments section of the weblog there is a code given by Dirk. I tried to use the code in my transformation logic and here how it looks.. I am using BI 7.0 and it is unicode system..
    ============================================================
    DATA: l_d_length like sy-index,
    l_d_char type c,
    l_d_index type sy-index.
    l_d_length = strlen( result ).
    RESULT = SOURCE_FIELDS-POO_TAG.
    DO l_d_length times.
    l_d_index = sy-index - 1.
    l_d_char = result+l_d_index(1).
    CALL FUNCTION 'RSKC_CHAVL_OF_IOBJ_CHECK'
    IMPORTING
    I_CHAVL = l_d_char
    I_IOBJNM = 'ZPOTSTFL'
    *" I_S_COB_PRO =
    *" I_T_COB_PRO_CMP =
    EXCEPTIONS
    CHAVL_NOT_ALLOWED = 1.
    IF SY-SUBRC <> 0.
    result+l_d_index(1) = ' '.
    ENDIF.
    ENDDO.
    ===========================================================
    I am using this to load from PSA to DSO, the info-object name is ZPOTSTFL(Length 3, No master, No text) and source field name is POO_TAG, since in the source the field is a free form text field and it has some hex characters ...we need to keep the free form (like $, lowercase letters, ###. etc..) but we need to eliminate the hex characters with space as it is affecting our load.
    I tried this code and it gives me syntax error. In the blog Pedro has suggested to declare some 30 char string and assign that string to info-object name... I don't know that much ABAP can somebody help me with the code??
    Regards,
    Nikhil

    Hello Dilip
    Out of three two of them are definitley possible. i.e
    1) CU&UC
    2) Upgrade first and then do Unicode Conversion ( 2 different downtimes)
    third option is possible with R3 but with BW you need to consult the master guide. ( i am not sure).
    you need to decide one of them based on your hardware sizing, database size, Downtime possible.
    I would suggest Make a copy of production server. and perform the upgrade and then perform unicode conversion. this whole activity will give you exact timing you need. and possible errors you will face during upgrade and unicode conversion.
    i hope this helps.
    Thanks
    Mona

  • Why does DB2 Data Flow Task query does not accept a date coming from a string or datetime variable in SSIS?

    I am trying to compare a DB2 date format to a date variable from SSIS. I have tried to set the variable as datetime and string. I have also casted the SQL date as date in the data flow task. I have tried a number of combinations of date formats, but no luck
    yet. Does anyone have any insights on how to set a date (without the time) variable and be able to use it in the data flow task SQL? It has to be an easy way to accomplish that. I get the following error below:
    An invalid datetime format was detected; that is, an invalid string representation or value was specified. SQLSTATE=22007".
    Thanks!

    Hi Marcel,
    Based on my research, in DB2, we use the following function to convert a string value to a date value:
    Date(To_Date(‘String’, ‘DD/MM/YYYY’))
    So, you can set the variable type to String in the package, and try the following query:
    ACCOUNT_DATE  BETWEEN  '11/30/2013' AND  Date(To_Date(?, ‘DD/MM/YYYY’))
    References:
    http://stackoverflow.com/questions/4852139/converting-a-string-to-a-date-in-db2
    http://www.dbforums.com/db2/1678158-how-convert-string-time.html
    Regards,
    Mike Yin
    TechNet Community Support

  • Numeric control error handling

    Hi all,
    I have two question about numeric control.
    1) "How to handle invalid inputs?"
    Let say, I have one numeric control that can only accept 0 to +inf (Range). So negative input will be invalid data input. Whenever I typed the negative value on it, this control automatically changed back to default (min) value. What I want is that. Is there anyway to detect invalid user input? So that I can program whenever user input negative number, it will automatically change back to previous valid input (not default value).
    2) "How to assign the dynamic range of numeric control?"
    I used property node to assign the range but my problem is that. I assigned min 0.1, max 1.2 and increment 0.1 but I cant able to select 1.2 or sometime 0.1 by using increment/decrement arrow. Maybe because of floating points? And also I want to do when user input overrange value (eg.1.3) by typing, the value should go back to previous valid input.
    Any idea? Thanks

    You can choose how LV will react on entries exceeding a limit. The default is, that LV coerces the value to the limit. But you can also ignore the limit and the user can enter any value.
    Nevertheless, if you ignore the limits, you always have to check in your software for invalid values!
    Regarding 2) i couldn't reproduce what you described. Maybe you should post a little example....
    For the 2nd part of your question, please see my answer above...
    hope this helps,
    Norbert
    CEO: What exactly is stopping us from doing this?
    Expert: Geometry
    Marketing Manager: Just ignore it.

Maybe you are looking for

  • Jabber and Voicemail Access

    Hello, I've configured CUCM and IM&P v9.1 and jabber client 9.2(1), the  chat and the calls work fine but when I try to log in Phone Accounts -> Voicemail I get an error about the credentials, I have all integrated with Active Directory and the user

  • Guide software for the Quantum series

     does know when the updates will match legacy STB guide. (VMS and IPC) is not up to date with the older boxes. i do not like this Quantum channel guide at all. it is very slow going through the channels also the new update back in october on my old 7

  • Why can I no longer open the App store on my MacBook pro

    Why can I no longer open the App store on my MacBook pro

  • ContentConvertion at Receiver CC

    Hi Experts, I am new to XI, I am trying out this scenario, I stuck at CC at Reciver Could any one suggest me the reciver communication channel for Content convertion for the below xml file? please disucss Content Convertion paramenters only! <?xml ve

  • HT1975 i lost my iphone how do I find it

    how do I use the location services to locate my phone when I've lost it?