Extract and format table from a Postgres XML column with XPath

86 views Asked by At

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.

0

There are 0 answers