Xpath and date constructors

I have an XML structure similar to this:
<documentFiles>
     <documentFile name="1000">
          <documentDate>2005-05-20</documentDateXML>
          <documentNumber>12345</documentNumber>
          <messageTypeIdentifier>ABCD</messageTypeIdentifier>
     </documentFile>
     <documentFile name="1001">
          <documentDate>2005-05-24</documentDateXML>
          <documentNumber>3456</documentNumber>
          <messageTypeIdentifier>DEFG</messageTypeIdentifier>
     </documentFile>
                     etc...
<documentFiles>Using Xpath i would like to select all documentFile elements where the documentDate is bigger than some other date. I have tried a few simple things that don't work such as:
DocumentBuilder db = DocumentBuilderFactory.newInstance().newDocumentBuilder();
doc = db.parse(new FileInputStream(someFileName));
String xPathExpr= "/documentFiles/documentFile[xs:date(documentDateXML) > xs:date(\"2005-05-21\")]";
NodeIterator ni  = XPathAPI.selectNodeIterator(doc, xPathExpr);I'm obviously not familiar with how to call these date constructors (xs:date()). How do I specify that I want to use the constructors in the http://www.w3.org/2001/XMLSchema-datatypes namespace?
Thanks

String xPathExpr= "/documentFiles/documentFile[xs:date(documentDateXML) > xs:date(\"2005-05-21\")]";should of course be
String xPathExpr= "/documentFiles/documentFile[xs:date(documentDate) > xs:date(\"2005-05-21\")]";

Similar Messages

  • XPath and dom4j xs:date() conversion exception

    Hey all Java folks
    I'm having a hard time deadling with XPath and date datatype using dom4J and seeking for guidance :)
    Let say I have the following XML header:
    <site:Blog xmlns:site="http://xml.netbeans.org/schema/blog" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:fn="http://www.w3.org/2005/xpath-functions" xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:schemaLocation="http://xml.netbeans.org/schema/blog blog.xsd">and this expression :
    site:Blog//site:Entry[@date=xs:date('2007-09-07')]In XMLSpy I do get correct results but in my java code all I get is this exception:
    org.dom4j.XPathException: Exception occurred evaluting XPath: /site:Blog//site:Entry[@date=xs:date("2007-09-07")] Exception: No Such Function xs:date
    at org.dom4j.xpath.DefaultXPath.handleJaxenException(DefaultXPath.java:374)
    at org.dom4j.xpath.DefaultXPath.selectNodes(DefaultXPath.java:134)
    at org.dom4j.tree.AbstractNode.selectNodes(AbstractNode.java:166)
    at com.mor.blogengine.util.xpath.SearchEngine.getEntriesforDate(SearchEngine.java:142)
    at com.mor.blogengine.util.xpath.SearchEngineTest.testGetEntriesforDate(SearchEngineTest.java:120)Does anyone has a clue of why it works perfectly outside of JAVA but not within my code ?
    Any enlightenment is welcome! :)
    Laurent

    String xPathExpr= "/documentFiles/documentFile[xs:date(documentDateXML) > xs:date(\"2005-05-21\")]";should of course be
    String xPathExpr= "/documentFiles/documentFile[xs:date(documentDate) > xs:date(\"2005-05-21\")]";

  • Xpath and Get XML Document Data

    Good Morning,
    I have just recently gotten involved in a project that requires communicating with some web services (axis2). We have existing scripts that handle this already, but they were built when we weren't on axis2 so now the XML output from the web service call is slightly different and i am no longer able to use the same xpath statement in the Get XML Document Data step.
    I am receiving either null values or a prefix namespace error. I am new to xpath and have been reading as best i can from http://www.w3schools.com/xpath/ to try and understand how to write my statements to pull out the data i want correctly.
    I have read that sometimes the editor has problems if the XML contains namespace declarations, etc.
    Below is an example XML output where I'd like to be able to read the value in the ax211:success. My xpath gets prefix namespace errors as it doesn't recognize ax211.
    Xpath: /descendant::ns:validateCertificationResponse/child::ns:return/child::ax211:success
    Perhaps my xpath statement is just incorrect and wouldn't retrieve what i expect it to....
    Any advice is appreciated.
    Thanks,
    Kevin

    Hi,
    well, it appears that text() is automatically appended to the XPath query for some reason in UCCX, this is why you actually see the text node within the ax211:success element. This //*[local-name()="success"] select the whole node, not its first child (which is actually the first element, which also happens to be a text).
    Anyway,
    // - anywhere
    * - any node
    And within this "everything" you actually search with the condition within the angular brackets.
    G.

  • Data type and Data object

    Hi Friends,
            What is the difference between Data type and Data object?
    Best Regards,
    VRV Singh

    hi
    good
    Each ABAP program define its own data types using the statement.
    TYPES dtype TYPE type ...
    and declare its own variables or instance attributes of classes using the statement
    DATA var {TYPE type} ...
    Within the program or a class, you can also define local data types and variables within procedures. Local variables in procedures obscure identically-named variables in the main program or class.
    When creating data types and data objects, there are a number of naming convention that also apply for other local program definitions, such as procedures. These are described in detail in the keyword documentation.
    The Additions TYPE and LIKE
    The additions TYPE type and LIKE dobj are used in various ABAP statements. The additions can have various meanings, depending on the syntax and context.
    ·        Definition of local types in a program
    ·        Declaration of data objects
    ·        Dynamic creation of data objects
    ·        Specification of the type of formal parameters in subroutines
    ·        Specification of the type of formal parameters in methods
    ·        Specification of the type of field symbols
    Constructing New Data Types
    The TYPE addition allows you to construct new data types in the TYPES, DATA; CONSTANTS; and STATICSstatements. In the TYPES statement, these are local data types in the program. In the other statements, they are attributes of new data objects, meaning that the newly defined data types are not free-standing. Rather, they are linked to database objects.This means that you can refer to them using the LIKEaddition, but not using TYPE.
    To construct new data types, the addition TYPE can be used with the following type constructors:
    ·        Construction of reference types
    REF TO type|dobj
    ·        Construction of structured data types
    BEGIN OF struc_type.
    END OF struc_type.
    ·        Construction of table types
    tabkind OF linetype
    These data types only exist during the runtime of the ABAP program.
    Referring to Known Data Types or Data Objects
    Using the additions TYPE or LIKE in the TYPESstatement, local data types in a program can be referred to known data types or data objects. This is mainly the case with user-defined elementary data types. If you declare variables using the additions TYPE type or LIKE dobj with statement DATA, the data type of var is already fully defined before the declaration is made.
    The known types or data that are referred to must be visible at the point where the data type or variable is declared.
    A known data type can be any of the following:
    ·        A predefined ABAP type to which you refer using the TYPE addition
    ·        An existing local data type in the program to which you refer using the TYPE addition
    ·        The data type of a local data object in the program to which you refer using the LIKE addition
    ·        A data type in the ABAP Dictionary to which you refer using the TYPE addition. To ensure compatibility with earlier releases, it is still possible to use the LIKE addition to refer to database tables and flat structures in the ABAP Dictionary. However, you should use the TYPE addition in new programs.
    The LIKE addition takes its technical attributes from a visible data object. As a rule, you can use LIKE to refer to any object that has been declared using DATA or a similar statement, and is visible in the current context.  The data object only has to have been declared. It is irrelevant whether the data object already exists in memory when you make the LIKE reference.
    ·        In principle, the local data objects in the same program are visible. As with local data types, there is a difference between local data objects in procedures and global data objects. Data objects defined in a procedure obscure other objects with the same name that are declared in the global declarations of the program.
    ·        You can also refer to the data objects of other visible ABAP programs. These might be, for example, the visible attributes of global classes in class pools. If a global class cl_lobal has a public instance attribute or static attribute attr, you can refer to it as follows in any ABAP program:
    DATA dref TYPE REF TO cl_global.
    DATA:  f1 LIKE cl_global=>attr,
           f2 LIKE dref->attr.
    You can access the technical properties of an instance attribute using the class name and a reference variable without first having to create an object. The properties of the attributes of a class are not instance-specific and belong to the static properties of the class.
    http://help.sap.com/saphelp_nw2004s/helpdata/en/fc/eb2ff3358411d1829f0000e829fbfe/content.htm
    thanks
    mrutyun^

  • XPath and XQuery

    Hi all,
    What's the difference between the XPath and XQuery, can XPath has better performance than XQuery?
    Regards,
    Jane

    shree wrote:
    1.Can you differentiate these XSLT, XPath and XQuery.XSL stands for EXtensible Stylesheet Language, and is a style sheet language for XML documents. XSLT stands for XSL Transformations.
    XQuery is to XML what SQL is to database tables. XQuery was designed to query XML data.
    XPath is used to navigate through elements and attributes in an XML document. XPath is a major element in W3C's XSLT standard - and XQuery and XPointer are both built on XPath expressions.
    http://www.w3schools.com/xsl/default.asp
    http://www.w3schools.com/xquery/default.asp
    http://www.w3schools.com/xpath/default.asp
    Cheers,
    Vlad

  • XSLT, XPath and XQuery

    Hi,
    1.Can you differentiate these XSLT, XPath and XQuery.
    2.How Do I Force a Rollback in a BPEL Flow.
    Thanks in advance

    shree wrote:
    1.Can you differentiate these XSLT, XPath and XQuery.XSL stands for EXtensible Stylesheet Language, and is a style sheet language for XML documents. XSLT stands for XSL Transformations.
    XQuery is to XML what SQL is to database tables. XQuery was designed to query XML data.
    XPath is used to navigate through elements and attributes in an XML document. XPath is a major element in W3C's XSLT standard - and XQuery and XPointer are both built on XPath expressions.
    http://www.w3schools.com/xsl/default.asp
    http://www.w3schools.com/xquery/default.asp
    http://www.w3schools.com/xpath/default.asp
    Cheers,
    Vlad

  • [svn:osmf:] 14372: PARB changes: Remove metadata from MediaContainer and LayoutTargetSprite constructors.

    Revision: 14372
    Revision: 14372
    Author:   [email protected]
    Date:     2010-02-23 15:17:18 -0800 (Tue, 23 Feb 2010)
    Log Message:
    PARB changes: Remove metadata from MediaContainer and LayoutTargetSprite constructors.  Instead, metadata is set on LayoutTargetSprite via a non-public setter used by the framework.  Update a bunch of ASDocs, make some enum classes final, remove elementIDs from sample apps (since they rely on metadata, and we want to keep samples focused on the public API).
    Modified Paths:
        osmf/trunk/apps/samples/framework/MediaContainerSample/MediaContainerSample.as
        osmf/trunk/apps/samples/framework/NestedMediaContainersSample/NestedMediaContainersSample .as
        osmf/trunk/apps/samples/framework/OSMFPlayer/src/OSMFPlayer.as
        osmf/trunk/framework/OSMF/org/osmf/containers/IMediaContainer.as
        osmf/trunk/framework/OSMF/org/osmf/containers/MediaContainer.as
        osmf/trunk/framework/OSMF/org/osmf/elements/compositeClasses/CompositeDisplayObjectTrait. as
        osmf/trunk/framework/OSMF/org/osmf/layout/HorizontalAlign.as
        osmf/trunk/framework/OSMF/org/osmf/layout/ILayoutTarget.as
        osmf/trunk/framework/OSMF/org/osmf/layout/LayoutMode.as
        osmf/trunk/framework/OSMF/org/osmf/layout/LayoutTargetSprite.as
        osmf/trunk/framework/OSMF/org/osmf/layout/VerticalAlign.as
        osmf/trunk/framework/OSMFTest/org/osmf/containers/TestMediaContainer.as
        osmf/trunk/framework/OSMFTest/org/osmf/layout/TestLayoutRenderer.as
        osmf/trunk/framework/OSMFTest/org/osmf/layout/TestMediaElementLayoutTarget.as

  • Constructor and Class constructor

    Hi all
    Can any one explain me the functionality about Constructor and class constructor??
    As well as normal methods, which you call using CALL METHOD, there are two special methods
    called CONSTRUCTOR and CLASS_CONSTRUCTOR, which are automatically called when you
    create an object (CONSTRUCTOR) or when you first access the components of a class
    (CLASS_CONSTRUCTOR)
    I have read the above mentioned document from SAP Documents but i found it bit difficult to understand can any one please help me on this??
    Thanks and Regards,
    Arun Joseph

    Hi,
    Constructor
    Implicitly, each class has an instance constructor method with the reserved name constructor and a static constructor method with the reserved name class_constructor.
    The instance constructor is executed each time you create an object (instance) with the CREATE OBJECT statement, while the class constructor is executed exactly once before you first access a class.
    The constructors are always present. However, to implement a constructor you must declare it explicitly with the METHODS or CLASS-METHODS statements. An instance constructor can have IMPORTING parameters and exceptions. You must pass all non-optional parameters when creating an object. Static constructors have no parameters.
    Class Constructor
    The static constructor is always called CLASS_CONSTRUCTER, and is called autmatically before the clas is first accessed, that is before any of the following actions are executed:
    Creating an instance using CREATE_OBJECT
    Adressing a static attribute using ->
    Calling a ststic attribute using CALL METHOD
    Registering a static event handler
    Registering an evetm handler method for a static event
    The static constructor cannot be called explicitly.
    For better understanding check the following code:
    REPORT  z_constructor.
          CLASS cl1 DEFINITION
    CLASS cl1 DEFINITION.
      PUBLIC SECTION.
        METHODS:
          add,
          constructor IMPORTING v1 TYPE i
                                v2 TYPE i,
          display.
        CLASS-METHODS:
         class_constructor.
      PRIVATE SECTION.
        DATA:
        w_var1   TYPE i,
        w_var2   TYPE i,
        w_var3   TYPE i,
        w_result TYPE i.
    ENDCLASS.                    "cl1 DEFINITION
          CLASS cl1 IMPLEMENTATION
    CLASS cl1 IMPLEMENTATION.
      METHOD constructor.
        w_var1 = v1.
        w_var2 = v2.
      ENDMETHOD.                    "constructor
      METHOD class_constructor.
        WRITE:
        / 'Tihs is a class or static constructor.'.
      ENDMETHOD.                    "class_constructor
      METHOD add.
        w_result = w_var1 + w_var2.
      ENDMETHOD.                    "add
      METHOD display.
        WRITE:
        /'The result is =  ',w_result.
      ENDMETHOD.                    "display
    endclass.
    " Main program----
    data:
      ref1 type ref to cl1.
    parameters:
      w_var1 type i,
      w_var2 type i.
      start-of-selection.
      create object ref1 exporting v1 = w_var1
                                  v2 = w_var2.
       ref1->add( ).
       ref1->d isplay( ).
    Regards,
    Anirban Bhattacharjee

  • Date() constructor using problem

    Hi,
    I want to use deprecated java date class.
    When I run:
    Date d1 = new Date(108,2,19); System.out.print(d1.getDate()+�/�+d1.getMonth()+�/�+d1.getYear());
    I get 19/2/108. But I expect to get the year 2008 like written in
    http://java.sun.com/j2se/1.4.2/docs/api/java/util/Date.html#Date(int,%20int,%20int)
    My question is: how can I get the year 2008 with deprecated date class?
    I mean give 108 in constructor and get 2008.
    Thanks in advance Arshavski Alex.

    Of course, you could always create your own simplified version if you really wanted a simple way of working with Dates....
    public class SimpleDate {
        Calendar cal = Calendar.getInstance();
        public SimpleDate(int year, int month, int day) {
            setYear(year);
            setMonth(month);
            setDay(day);
        public Date getDate() {
            return cal.getTime();
        public void setDay(int day) {
            //TODO: do some checking here to make sure day is valid then set date on cal
            //something like cal.set(Calendar.DAY_OF_MONTH, day);
        public int getDay() {
            return cal.get(Calendar.DAY_OF_MONTH);
        public void setMonth(int month) {
            //TODO: do some checking here to make sure month is valid then set date on cal
        public int getMonth() {
            return cal.get(Calendar.MONTH);
        public void setYear(int year) {
            //TODO: do some checking here to make sure year is valid then set date on cal
        public int getYear() {
            return cal.get(Calendar.YEAR);
    }In the end though, as the previous posts suggests, it is probably more than worth while to spend the time needed to learn to use Calendar and Dates correctly.
    Also, you may want to look at the lenient property in Calendar to understand why dates sometimes give unexpected answers. This is especially true if you are going to be converting from Strings or ints to dates (even if you are using (Simple)DateFormat as suggested).
    Edited by: brwhen002 on 2008/03/01 01:59

  • System.currentTimeMillis() and Date()

    Hi,everybody
    What is the difference beetween System.currentTimeMillis() and Date()?
    Regards,
    Michael

    Michael,
    System.currentTimeMillis()  -- current date represented as number of milliseconds after/before Jan 1, 1970
    java.util.Date -- object that encapsulates date, when constructor called without arguments then it's current date. Note that almost all methods of this class are deprecated while it was designed only for Grigorian calendar. To get specific day/month/year from java.util.Date use java.util.Calendar.
    Valery Silaev
    SaM Solutions
    http://www.sam-solutions.net

  • DSO - What key fields and data fields in dso

    Hi experts,
    I need to create a dso in between the cube and 2 data sources(2lis_11_vaitm, 2lis_12_vcscl) to stage the data. My question is: what key fields and data fields to choose for the dso? is there a standard dso to copy? please explain in detail the model to set up, whether to connect both the ds's to dso and then to cube or one ds to dso and the other to the cube. more details will help.

    Check this for standard DSO:
    http://help.sap.com/saphelp_nw04/helpdata/en/43/fcdc387f34384f94c3227baf3837a8/content.htm
    Thanks...
    Shambhu

  • Reading MS Project column names and data on the fly from a selected View

    Hi guys,
    I have several views on my project file (MSPROJECT 2010) and I want to build a macro so that;
    1. User can select any view ( Views can have diffrent columns and the user may add new columns as well)
    2. User runs the Macro and all the coulmns along with the tasks displayed in the view will be written to a excel file. ( I don't want to build several macro's for each view, I'm thinking of a common method which would work for any selected view)
    The problem I'm facing is that how will i read the column names and data for a particular view on the fly without hard coding them inside the vba code ?
    The solution needs to work on a master schedule as well.
    Appreciate your feedback.

    Just to get you started the following code writes the field name and data for the active task to the Immediate window.
    Sub CopyData()
    Dim fld As TableField
    For Each fld In ActiveProject.TaskTables(ActiveProject.CurrentTable).TableFields
    If fld.Field >= 0 Then
    Debug.Print Application.FieldConstantToFieldName(fld.Field), ActiveCell.Task.GetField(fld.Field)
    End If
    Next fld
    End Sub
    Rod Gill
    Author of the one and only Project VBA Book
    www.project-systems.co.nz

  • Pdf portfolio source file name and date in file details

    Is it possible to import the source file name and extension as well as the source file created date in the portfolio file details?  Need to document source to portfolio in working with 3rd parties that will only have the original source.  Need to document what was converted into pdf as not all files in a directory will successfully convert to pdf.  Sometimes need to convert 100's of files.  Manual entry is inefficient.  the file names and modified dates are displayed on the Combine Files dialog.  is there a way to capture the detail on that page?

    I don't need the detail of when the pdf was added to the portfolio.  I
    need know which dwg or jpg or word file was converted and the original
    created date of that file for control of information.
    That is impossible; sorry. For some *very specific* types of conversion to PDF the pdfx:SourceModified XMP tag will be set to show the last-modification date of the source file (for example DOCX files converted using MS Word), but there will never be a human-readable record of the source filename or its creation date unless you have manually added them as document XMP properties after conversion (this is what the "Custom Properties" dialog is for). To embed source data automatically would raise no end of privacy and security problems for customers, who most certainly do NOT want their recipients seeing details of internal documents.
    Without writing a plugin there's no access to the internal workflow of the Combine Files dialog, so you cannot use a script to read the names and dates of the files *before* conversion and store them automatically in the new PDF Portfolio's Fields array.

  • Who worked with ICS' Model 4896 GPIB? I can not count the data from the module. Can prompt as it to make. It is desirable with examples (data read-out from the module and data transmission between channels. It is in advance grateful.

    I can not count the data from the module. Can prompt as it to make. It is desirable with examples (data read-out from the module and data transmission between channels. It is in advance grateful.

    Hello. Most of the engineers in developer exchange are more familiar
    with NI products. Contacting ICS for technical support is a better
    course of action.

  • How can we get Dynamic columns and data with RTF Templates in BI Publisher

    How can we get Dynamic columns and data with RTf Templates.
    My requirement is :
    create table xxinv_item_pei_taginfo(item_id number,
    Organization_id number,
    item varchar2(4000),
    record_type varchar2(4000),
    record_value CLOB,
    State varchar2(4000));
    insert into xxinv_item_pei_taginfo values( 493991 ,224, '1265-D30', 'USES','fever','TX');
    insert into xxinv_item_pei_taginfo values( 493991 ,224, '1265-D30', 'HOW TO USE','one tablet daily','TX');
    insert into xxinv_item_pei_taginfo values( 493991 ,224, '1265-D30', 'SIDE EFFECTS','XYZ','TX');
    insert into xxinv_item_pei_taginfo values( 493991 ,224, '1265-D30', 'DRUG INTERACTION','ABC','TX');
    insert into xxinv_item_pei_taginfo values( 493991 ,224, '1265-D30', 'OVERDOSE','Go and see doctor','TX');
    insert into xxinv_item_pei_taginfo values( 493991 ,224, '1265-D30', 'NOTES','Take after meal','TX');
    select * from xxinv_item_pei_taginfo;
    Item id Org Id Item Record_type Record_value State
    493991     224     1265-D30     USES     fever     TX
    493991     224     1265-D30     HOW TO USE     one tablet daily     TX
    493991     224     1265-D30     SIDE EFFECTS     XYZ     TX
    493991     224     1265-D30     DRUG INTERACTION     ABC     TX
    493991     224     1265-D30     OVERDOSE      Go and see doctor     TX
    493991     224     1265-D30     NOTES     Take after meal     TX
    Above is my data
    I have to fetch the record_type from a lookup where I can have any of the record type, sometime USES, HOW TO USE, SIDE EFFECTS and sometimes some other set of record types
    In my report I have to get these record typpes as field name dynamically whichever is available in that lookup and record values against them.
    its a BI Publisher report.
    please suggest

    if you have data in db then you can create xml with needed structure
    and so you can create bip report
    do you have errors or .... ?

Maybe you are looking for

  • How can i reset my ipad after forgoten password

    i dont know how to reset my ipad, i forgot my password,i have message (ipad is disabled connect to itune)

  • How Can I Print Without Splitting Categories

    I have a sheet created with a single Category column, with each category comprised of 8 items. I would like to print the sheet (about 4 pages, but I don't want a category to be slit to more than one page. i.e. I don't want to print with 1 item on one

  • Bridge CS6 WIll Not Open

    HI, Windows 7 Home Premium 32bit 4 GByte memory. Downloaded and installes CS6 trial and Bridge will not open; there is hard disk activity at the beginning and then nothing. Any thoughts, thanks? Pete

  • FTP Adapter Sender: Dynamic configuration of directory

    Hello all, I need to read files from an FTP server. The source directory contains the current date and hence changes everyday. That means: Today it's          /home/user/out/20100519/ready/ Tomorrow it's gonna be     /home/user/out/20100520/ready/ an

  • Query on SAP IS Banking - SAP Deposits Management/ SAP BCA in ECC 6.0

    Dear all, In SAP Deposits Management in the new platform, we have the node Financial Services both in Easy Access and IMG under which we have the major functionalities like Account and Product Management. However this is unavailable in ECC 6.0. Reque