Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

157
Vistas
format an xml file with no root node in linux

I tried to format the below XML using xmllint --format xmlfilename with no luck since the file does not have a root node.

As a test I did put a root node and the XML file was formatted successfully.

How can I format this file without a root node?

<connection_param>
    <mlc_props_file>
        <file_full_path>./fs/public/mxres/mxmlc/mlc_properties.mxres</file_full_path>
    </mlc_props_file>
</connection_param>

<login group="CONFIG" password="00100020004100470016" user="CONFIG"/>
over 4 years ago · Santiago Trujillo
2 Respuestas
Responde la pregunta

0

You can incorporate that content into a "wrapper" XML file that includes it's content using an external entity reference.

In the example below, it assumes that your content is the fragment.xml file and the "wrapper" XML is in the same directory.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE wrapper [
  <!ENTITY content SYSTEM "fragment.xml">
]>
<wrapper>
    &content;
</wrapper>

Then parse/transform the "wrapper" XML file in order to parse/format the content.

over 4 years ago · Santiago Trujillo Denunciar

0

Use tidy:

echo '
<connection_param>
<mlc_props_file>
<file_full_path>./fs/public/mxres/mxmlc/mlc_properties.mxres</file_full_path>
</mlc_props_file>
</connection_param>
<login group="CONFIG" password="00100020004100470016" user="CONFIG"/>
'| tidy -xml -qi

Output:

<connection_param>
  <mlc_props_file>
    <file_full_path>
    ./fs/public/mxres/mxmlc/mlc_properties.mxres</file_full_path>
  </mlc_props_file>
</connection_param>
<login group="CONFIG" password="00100020004100470016"
user="CONFIG" />
over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda