private static String createXMLMix(String xmlPfis,String xmlPjur,int firstRow,int numPFIS,int numPJUR,int rDefault,int maxResults) throws Exception {
  String result=null;
  if (xmlPfis != null || xmlPjur != null) {
    List nodes=null;
    Document document=DocumentHelper.createDocument();
    Element root=document.addElement(PersonKeys.XML_PERSONAS_TEXT);
    root.addAttribute(PersonKeys.XML_INICIO_TEXT,Integer.toString(firstRow));
    if ((firstRow + rDefault) > (numPFIS + numPJUR)) {
      root.addAttribute(PersonKeys.XML_FIN_TEXT,Integer.toString(numPFIS + numPJUR));
    }
 else {
      root.addAttribute(PersonKeys.XML_FIN_TEXT,Integer.toString(firstRow + rDefault));
    }
    root.addAttribute(PersonKeys.XML_TOTAL_TEXT,Integer.toString(numPFIS + numPJUR));
    root.addAttribute(PersonKeys.XML_RANGO_TEXT,Integer.toString(rDefault));
    root.addAttribute(PersonKeys.XML_RESULT_MAX_TEXT,Integer.toString(maxResults));
    if (xmlPfis != null) {
      Document docPfis=XMLPersons.createFromStringText(xmlPfis);
      nodes=docPfis.selectNodes(PersonKeys.XPATH_PERSONAS_PERSONA);
      for (Iterator it=nodes.iterator(); it.hasNext(); ) {
        Node node=(Node)it.next();
        node.setParent(null);
        root.add(node);
      }
    }
    if (xmlPjur != null) {
      Document docPJur=XMLPersons.createFromStringText(xmlPjur);
      nodes=docPJur.selectNodes(PersonKeys.XPATH_PERSONAS_PERSONA);
      for (Iterator it=nodes.iterator(); it.hasNext(); ) {
        Node node=(Node)it.next();
        node.setParent(null);
        root.add(node);
      }
    }
    result=document.asXML();
  }
  return result;
}

private static String createXMLMix ( String xmlPfis , String xmlPjur , int firstRow , int numPFIS , int numPJUR , int rDefault , int maxResults ) throws Exception { String result = null ; if ( xmlPfis != null || xmlPjur != null ) { List nodes = null ; Document document = DocumentHelper . createDocument ( ) ; Element root = document . addElement ( PersonKeys . XML_PERSONAS_TEXT ) ; root . addAttribute ( PersonKeys . XML_INICIO_TEXT , Integer . toString ( firstRow ) ) ; if ( ( firstRow + rDefault ) > ( numPFIS + numPJUR ) ) { root . addAttribute ( PersonKeys . XML_FIN_TEXT , Integer . toString ( numPFIS + numPJUR ) ) ; } else { root . addAttribute ( PersonKeys . XML_FIN_TEXT , Integer . toString ( firstRow + rDefault ) ) ; } root . addAttribute ( PersonKeys . XML_TOTAL_TEXT , Integer . toString ( numPFIS + numPJUR ) ) ; root . addAttribute ( PersonKeys . XML_RANGO_TEXT , Integer . toString ( rDefault ) ) ; root . addAttribute ( PersonKeys . XML_RESULT_MAX_TEXT , Integer . toString ( maxResults ) ) ; if ( xmlPfis != null ) { Document docPfis = XMLPersons . createFromStringText ( xmlPfis ) ; nodes = docPfis . selectNodes ( PersonKeys . XPATH_PERSONAS_PERSONA ) ; for ( Iterator it = nodes . iterator ( ) ; it . hasNext ( ) ; ) { Node node = ( Node ) it . next ( ) ; node . setParent ( null ) ; root . add ( node ) ; } } if ( xmlPjur != null ) { Document docPJur = XMLPersons . createFromStringText ( xmlPjur ) ; nodes = docPJur . selectNodes ( PersonKeys . XPATH_PERSONAS_PERSONA ) ; for ( Iterator it = nodes . iterator ( ) ; it . hasNext ( ) ; ) { Node node = ( Node ) it . next ( ) ; node . setParent ( null ) ; root . add ( node ) ; } } result = document . asXML ( ) ; } return result ; }
author : 66575267 - gabriel saiz modificacion : se le pasa como parametro el numero maximo de resultados .
