格式化 XML

重新缩进和排版源代码以便阅读;不能代替运行验证或业务规则检查。

输入: 文本结果: 文本

文本输入

工具选项

案例

Read the title and timestamp in an Atom feed

输入

<feed xmlns="http://www.w3.org/2005/Atom"><title>Example Feed</title><updated>2003-12-13T18:30:02Z</updated><entry><title>Atom-Powered Robots Run Amok</title><id>urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a</id></entry></feed>

Expected answer

<feed
  xmlns="http://www.w3.org/2005/Atom">
  <title>Example Feed</title>
  <updated>2003-12-13T18:30:02Z</updated>
  <entry>
    <title>Atom-Powered Robots Run Amok</title>
    <id>urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a</id>
  </entry>
</feed>
缩进字符串
Inspect a sitemap containing two public tool URLs

输入

<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"><url><loc>https://serialize.dev/tools/from-base64/</loc></url><url><loc>https://serialize.dev/tools/json-beautify/</loc></url></urlset>

Expected answer

<urlset
  xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
  <url>
    <loc>https://serialize.dev/tools/from-base64/</loc>
  </url>
  <url>
    <loc>https://serialize.dev/tools/json-beautify/</loc>
  </url>
</urlset>
缩进字符串
Separate an SVG circle from its view box

输入

<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><circle cx="50" cy="50" r="40" fill="#005fcc"/></svg>

Expected answer

<svg
    xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100">
    <circle cx="50" cy="50" r="40" fill="#005fcc"/>
</svg>
缩进字符串
Read namespace prefixes in a SOAP envelope

输入

<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"><soap:Body><m:GetPrice xmlns:m="urn:store"><m:ISBN>9780141439518</m:ISBN></m:GetPrice></soap:Body></soap:Envelope>

Expected answer

<soap:Envelope
	xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
	<soap:Body>
		<m:GetPrice
			xmlns:m="urn:store">
			<m:ISBN>9780141439518</m:ISBN>
		</m:GetPrice>
	</soap:Body>
</soap:Envelope>
缩进字符串
Keep a CDATA expression separate from XML markup

输入

<rule><name>Temperature alert</name><expression><![CDATA[temp < 0 && enabled]]></expression></rule>

Expected answer

<rule>
  <name>Temperature alert</name>
  <expression>
    <![CDATA[temp < 0 && enabled]]>
  </expression>
</rule>
缩进字符串

参数

参数默认值输入与选项
缩进字符串"\\t"支持 \n、\r 和 \t 等转义序列

相关工具

代码整理

操作参考

查看原始技术文档 (English)