Read from a Sequence of Items in Saxon 8

Read from a Sequence of Items in Saxon 8

As you probably know, an XPath 2.0 expression returns a sequence of items (nodes and atomic values). The following code shows you how to read from a sequence of items in Saxon 8. The code identifies the nodes and atomic values and calls the correct methods for showing them.

...List L=null;...try{    //this XPath expression returns a sequence of nodes   L=XPE.evaluate("/company/departments/");        //this XPath expression returns an atomic value   //L=XPE.evaluate("5 instance of xs:integer");        }catch(net.sf.saxon.trans.XPathException e)      {System.out.println(e.getMessage());}   //processing the resulted sequence   if(L!=null)   {      for(Iterator iter=L.iterator();iter.hasNext();)      {         Object obj=(Object);         if(obj instanceof NodeInfo)         {                       NodeInfo NI=(NodeInfo)obj;            String info=net.sf.saxon.type.Type.displayTypeName(NI);            System.out.println("INFO:["+info+"]");            System.out.println("VALUE:["+NI.getStringValue()"]");                    }         else         {            String val=String.valueOf(obj);            System.out.println("ATOMIC VALUE:"+val);         }      }                       }}
Share the Post:
Heading photo, Metadata.

What is Metadata?

What is metadata? Well, It’s an odd concept to wrap your head around. Metadata is essentially the secondary layer of data that tracks details about the “regular” data. The regular

XDR solutions

The Benefits of Using XDR Solutions

Cybercriminals constantly adapt their strategies, developing newer, more powerful, and intelligent ways to attack your network. Since security professionals must innovate as well, more conventional endpoint detection solutions have evolved

AI is revolutionizing fraud detection

How AI is Revolutionizing Fraud Detection

Artificial intelligence – commonly known as AI – means a form of technology with multiple uses. As a result, it has become extremely valuable to a number of businesses across

AI innovation

Companies Leading AI Innovation in 2023

Artificial intelligence (AI) has been transforming industries and revolutionizing business operations. AI’s potential to enhance efficiency and productivity has become crucial to many businesses. As we move into 2023, several

data fivetran pricing

Fivetran Pricing Explained

One of the biggest trends of the 21st century is the massive surge in analytics. Analytics is the process of utilizing data to drive future decision-making. With so much of