Java 类org.dom4j.tree.AbstractNode 实例源码

项目:geokettle-2.0    文件:GetXMLData.java   
@SuppressWarnings("unchecked")
private boolean applyXPath()
{
 try{
     XPath xpath = data.document.createXPath(data.PathValue);
     if(meta.isNamespaceAware())
     {
       xpath = data.document.createXPath(addNSPrefix(data.PathValue,    data.PathValue));
       xpath.setNamespaceURIs(data.NAMESPACE);
     }
     // get nodes list
  data.an =  (List<AbstractNode>) xpath.selectNodes(data.document);
  data.nodesize=data.an.size();
  data.nodenr=0;
 }catch (Exception e)
 {
  log.logError(toString(),Messages.getString("GetXMLData.Log.ErrorApplyXPath",e.getMessage()));
  return false;
 }
 return true;
}
项目:read-open-source-code    文件:GetXMLData.java   
@SuppressWarnings("unchecked")
private boolean applyXPath()
{
 try{
     XPath xpath = data.document.createXPath(data.PathValue);
     if(meta.isNamespaceAware())
     {
       xpath = data.document.createXPath(addNSPrefix(data.PathValue,    data.PathValue));
       xpath.setNamespaceURIs(data.NAMESPACE);
     }
     // get nodes list
  data.an =  (List<AbstractNode>) xpath.selectNodes(data.document);
  data.nodesize=data.an.size();
  data.nodenr=0;
 }catch (Exception e)
 {
  logError(BaseMessages.getString(PKG, "GetXMLData.Log.ErrorApplyXPath",e.getMessage()));
  return false;
 }
 return true;
}
项目:kettle-4.4.0-stable    文件:GetXMLData.java   
@SuppressWarnings("unchecked")
private boolean applyXPath()
{
 try{
     XPath xpath = data.document.createXPath(data.PathValue);
     if(meta.isNamespaceAware())
     {
       xpath = data.document.createXPath(addNSPrefix(data.PathValue,    data.PathValue));
       xpath.setNamespaceURIs(data.NAMESPACE);
     }
     // get nodes list
  data.an =  (List<AbstractNode>) xpath.selectNodes(data.document);
  data.nodesize=data.an.size();
  data.nodenr=0;
 }catch (Exception e)
 {
  logError(BaseMessages.getString(PKG, "GetXMLData.Log.ErrorApplyXPath",e.getMessage()));
  return false;
 }
 return true;
}
项目:kettle-trunk    文件:GetXMLData.java   
@SuppressWarnings("unchecked")
private boolean applyXPath()
{
 try{
     XPath xpath = data.document.createXPath(data.PathValue);
     if(meta.isNamespaceAware())
     {
       xpath = data.document.createXPath(addNSPrefix(data.PathValue,    data.PathValue));
       xpath.setNamespaceURIs(data.NAMESPACE);
     }
     // get nodes list
  data.an =  (List<AbstractNode>) xpath.selectNodes(data.document);
  data.nodesize=data.an.size();
  data.nodenr=0;
 }catch (Exception e)
 {
  logError(BaseMessages.getString(PKG, "GetXMLData.Log.ErrorApplyXPath",e.getMessage()));
  return false;
 }
 return true;
}
项目:geokettle-2.0    文件:GetXMLData.java   
private Object[] getXMLRowPutRowWithErrorhandling()  throws KettleException
{
     // Build an empty row based on the meta-data         
     Object[] r=null;
     data.errorInRowButContinue=false;
     try{   
         if(meta.isInFields())
         {

            while ((data.nodenr>=data.nodesize || data.readrow==null))
            {
                if(!ReadNextString())
                {
                    return null;
                }
                if(data.readrow==null)
                {
                    return null;
                }
            }
         }

        if(meta.isInFields())
            r= processPutRow(data.readrow,(AbstractNode)data.an.get(data.nodenr));
        else
            r= processPutRow(null,(AbstractNode)data.an.get(data.nodenr));
     }
     catch (Exception e)
     {
        throw new KettleException(Messages.getString("GetXMLData.Error.UnableReadFile"), e);
     }

     return r;
}
项目:read-open-source-code    文件:GetXMLData.java   
private Object[] getXMLRowPutRowWithErrorhandling()  throws KettleException
{
     // Build an empty row based on the meta-data         
     Object[] r=null;
     data.errorInRowButContinue=false;
     try{   
         if(meta.isInFields())
         {

            while ((data.nodenr>=data.nodesize || data.readrow==null))
            {
                if(!ReadNextString())
                {
                    return null;
                }
                if(data.readrow==null)
                {
                    return null;
                }
            }
         }

         r= processPutRow((AbstractNode)data.an.get(data.nodenr));
     }
     catch (Exception e)
     {
        throw new KettleException(BaseMessages.getString(PKG, "GetXMLData.Error.UnableReadFile"), e);
     }

     return r;
}
项目:kettle-4.4.0-stable    文件:GetXMLData.java   
private Object[] getXMLRowPutRowWithErrorhandling()  throws KettleException
{
     // Build an empty row based on the meta-data         
     Object[] r=null;
     data.errorInRowButContinue=false;
     try{   
         if(meta.isInFields())
         {

            while ((data.nodenr>=data.nodesize || data.readrow==null))
            {
                if(!ReadNextString())
                {
                    return null;
                }
                if(data.readrow==null)
                {
                    return null;
                }
            }
         }

         r= processPutRow((AbstractNode)data.an.get(data.nodenr));
     }
     catch (Exception e)
     {
        throw new KettleException(BaseMessages.getString(PKG, "GetXMLData.Error.UnableReadFile"), e);
     }

     return r;
}
项目:kettle-trunk    文件:GetXMLData.java   
private Object[] getXMLRowPutRowWithErrorhandling()  throws KettleException
{
     // Build an empty row based on the meta-data         
     Object[] r=null;
     data.errorInRowButContinue=false;
     try{   
         if(meta.isInFields())
         {

            while ((data.nodenr>=data.nodesize || data.readrow==null))
            {
                if(!ReadNextString())
                {
                    return null;
                }
                if(data.readrow==null)
                {
                    return null;
                }
            }
         }

         r= processPutRow((AbstractNode)data.an.get(data.nodenr));
     }
     catch (Exception e)
     {
        throw new KettleException(BaseMessages.getString(PKG, "GetXMLData.Error.UnableReadFile"), e);
     }

     return r;
}
项目:bio2rdf-rest    文件:DocumentToFlat.java   
/**
 * Document to Flat
 */
public void flat() {
    XPath loopXpath = null;
    if(!defineNS) {
        loopXpath = doc.createXPath(namespaceTool.addDefaultNSPrefix(currentLoop, currentLoop));
    } else {
        loopXpath = doc.createXPath(currentLoop);
    }
    loopXpath.setNamespaceURIs(xmlNameSpaceMap);
    nodes = loopXpath.selectNodes(doc);
    if(this.isOptional && nodes.size() == 0 && !top) {
        setParentAsLoop();
        flat();
    } else if (nodes !=null ) {
        //reset relative paths
        if(currentLoop != originalLoop) {//not point to the same string
            for(int i=0;i<currentRelativePathMappings.length;i++) {
                currentRelativePathMappings[i] = resetRelativeXPath(currentRelativePathMappings[i]);
            }
        }

        for(AbstractNode node : nodes) {
            //init row
            Map<String,String> row = new HashMap<String,String>();
            resultSet.add(row);
            //init columns for one row
            for(int i=0;i<currentRelativePathMappings.length;i++) {
                String relativePath = currentRelativePathMappings[i];
                XPath xpath = null;
                if(!defineNS) {
                    xpath = node.createXPath(namespaceTool.addDefaultNSPrefix(relativePath, currentLoop));
                } else {
                    xpath = node.createXPath(relativePath);
                }
                xpath.setNamespaceURIs(xmlNameSpaceMap);
                Object obj = xpath.evaluate(node);
                if(obj instanceof String || obj instanceof Number){
                    row.put(absolutePathMappings[i], String.valueOf(obj));
                }else{
                    row.put(absolutePathMappings[i], xpath.selectSingleNode(node)!=null ? xpath.valueOf(node) : null);
                }
            }
        }
        doc = null;
        nodes = null;
    }
}
项目:bio2rdf-rest    文件:DocumentToFlat.java   
public List<AbstractNode> getNodes() {
    return nodes;
}
项目:bio2rdf-rest    文件:DocumentToFlat.java   
/**
 * Document to Flat
 */
public void flat() {
    XPath loopXpath = null;
    if(!defineNS) {
        loopXpath = doc.createXPath(namespaceTool.addDefaultNSPrefix(currentLoop, currentLoop));
    } else {
        loopXpath = doc.createXPath(currentLoop);
    }
    loopXpath.setNamespaceURIs(xmlNameSpaceMap);
    nodes = loopXpath.selectNodes(doc);
    if(this.isOptional && nodes.size() == 0 && !top) {
        setParentAsLoop();
        flat();
    } else if (nodes !=null ) {
        //reset relative paths
        if(currentLoop != originalLoop) {//not point to the same string
            for(int i=0;i<currentRelativePathMappings.length;i++) {
                currentRelativePathMappings[i] = resetRelativeXPath(currentRelativePathMappings[i]);
            }
        }

        for(AbstractNode node : nodes) {
            //init row
            Map<String,String> row = new HashMap<String,String>();
            resultSet.add(row);
            //init columns for one row
            for(int i=0;i<currentRelativePathMappings.length;i++) {
                String relativePath = currentRelativePathMappings[i];
                XPath xpath = null;
                if(!defineNS) {
                    xpath = node.createXPath(namespaceTool.addDefaultNSPrefix(relativePath, currentLoop));
                } else {
                    xpath = node.createXPath(relativePath);
                }
                xpath.setNamespaceURIs(xmlNameSpaceMap);
                Object obj = xpath.evaluate(node);
                if(obj instanceof String || obj instanceof Number){
                    row.put(absolutePathMappings[i], String.valueOf(obj));
                }else{
                    row.put(absolutePathMappings[i], xpath.selectSingleNode(node)!=null ? xpath.valueOf(node) : null);
                }
            }
        }
        doc = null;
        nodes = null;
    }
}
项目:bio2rdf-rest    文件:DocumentToFlat.java   
public List<AbstractNode> getNodes() {
    return nodes;
}
项目:bio2rdf-rest    文件:DocumentToFlat.java   
/**
 * Document to Flat
 */
public void flat() {
    XPath loopXpath = null;
    if(!defineNS) {
        loopXpath = doc.createXPath(namespaceTool.addDefaultNSPrefix(currentLoop, currentLoop));
    } else {
        loopXpath = doc.createXPath(currentLoop);
    }
    loopXpath.setNamespaceURIs(xmlNameSpaceMap);
    nodes = loopXpath.selectNodes(doc);
    if(this.isOptional && nodes.size() == 0 && !top) {
        setParentAsLoop();
        flat();
    } else if (nodes !=null ) {
        //reset relative paths
        if(currentLoop != originalLoop) {//not point to the same string
            for(int i=0;i<currentRelativePathMappings.length;i++) {
                currentRelativePathMappings[i] = resetRelativeXPath(currentRelativePathMappings[i]);
            }
        }

        for(AbstractNode node : nodes) {
            //init row
            Map<String,String> row = new HashMap<String,String>();
            resultSet.add(row);
            //init columns for one row
            for(int i=0;i<currentRelativePathMappings.length;i++) {
                String relativePath = currentRelativePathMappings[i];
                XPath xpath = null;
                if(!defineNS) {
                    xpath = node.createXPath(namespaceTool.addDefaultNSPrefix(relativePath, currentLoop));
                } else {
                    xpath = node.createXPath(relativePath);
                }
                xpath.setNamespaceURIs(xmlNameSpaceMap);
                Object obj = xpath.evaluate(node);
                if(obj instanceof String || obj instanceof Number){
                    row.put(absolutePathMappings[i], String.valueOf(obj));
                }else{
                    row.put(absolutePathMappings[i], xpath.selectSingleNode(node)!=null ? xpath.valueOf(node) : null);
                }
            }
        }
        doc = null;
        nodes = null;
    }
}
项目:bio2rdf-rest    文件:DocumentToFlat.java   
public List<AbstractNode> getNodes() {
    return nodes;
}