0

I tried for many days but to no avail. to I have an XML column called of_xml in a PostgreSQL table called s.dict.

It looks like this:

<?xml version=""1.0"" encoding=""UTF-8"" standalone='no'?>
<?xml-stylesheet type=""text/xsl"" href=""http://192.168.60.21/pae-bpm-web/rtf/PlantillaResolucion.xsl""?>
  <Documento xmlns="" http://www.c/2005/05/CGRDoc "" xmlns:ns0="" http://www./09/xmldsig# "">
    <Contenido>
      <Folio>
        <Numero>R-01</Numero>
        <Agno>2019</Agno>
      </Folio>
      <ext:Resolucion xmlns:ext="" http://www./CGRDoc "" id="" Resol "">
        <ext:Resolucion Id="" FirmaResolucionDefault "">
          <FolioExpediente>R-19</FolioExpediente>
          <CtlPrevLeg>EXENTA</CtlPrevLeg>
          <NivelConfid>PUBLICO</NivelConfid>
          <Materia/>
          <Lugar>S</Lugar>
          <Fecha>2019</Fecha>
          <A>MANUEL</A>
          <TipoOficio>SACO</TipoOficio>
          <Ord/>
          <Ant>Presentación &lt;br/&gt;</Ant>
          <Mat>Proporciona&lt;br/&gt;</Mat>
          <Ftes>Ley&lt;br/&gt;</Ftes>
          <Conc>&lt;br/&gt;</Conc>
          <Separador>
            <Parrafo>1.- Ud. 2018.
            </Parrafo>
            <Parrafo/>
            <Parrafo>2.- Requerida.
            </Parrafo>
            <Parrafo/>
            <Parrafo>3.- Atendido.
            </Parrafo>
            <Parrafo/>
            <Parrafo/>
            <Parrafo>Saluda, </Parrafo>
            <Parrafo>&lt;a name=&quot;page-total-master0&quot; id=&quot;page-total-master0&quot;&gt;&lt;/a&gt;&lt;a name=&quot;page-total&quot; id=&quot;page-total&quot;&gt;&lt;/a&gt;</Parrafo>
          </Separador>

I tried a lot of times using XPath but I cannot get any positive results. I am interested in using the column "paragraph" because it has important information and I need to analyze words from it. Please help with showing the data in a table for export to a CSV.

wp78de
  • 18,207
  • 7
  • 43
  • 71
  • Hi. Your sample XML is incomplete and there is no column `Paragraph` (I guess you mean `Párrafo`, right?) Please take the https://stackoverflow.com/tour , https://stackoverflow.com/help/asking and https://stackoverflow.com/help/how-to-ask – wp78de Nov 26 '20 at 01:55
  • the problem is: I have no idea how write the right code. I used: SELECT (xpath('//Parrafo/Parrafo/text()',t1))[1]::text FROM sabana.dictamenes , LATERAL unnest(( SELECT xpath('//Contenido',ofi_xml) )) t1; – Felipe Zapata Nov 26 '20 at 13:28

0 Answers0