Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 搜寻及;在不修改值的情况下替换XML节点,并在HTML输出中转换输入文件_C#_Xml_Html_Xslt - Fatal编程技术网

C# 搜寻及;在不修改值的情况下替换XML节点,并在HTML输出中转换输入文件

C# 搜寻及;在不修改值的情况下替换XML节点,并在HTML输出中转换输入文件,c#,xml,html,xslt,C#,Xml,Html,Xslt,我在这里读到了一些答案,并试图将它们应用到这个案例中……但仍在挣扎 我的两个目标,在标题中继续: 1) 我必须阅读大型XML文档(最多40兆),转换其中几乎所有的自定义标记,但不修改这些标记的内容 例如,我的文档是: <?xml version="1.0" encoding="utf-8"?> <Root> <Foo> <PARA> Text Value 1 </PARA>

我在这里读到了一些答案,并试图将它们应用到这个案例中……但仍在挣扎

我的两个目标,在标题中继续:

1) 我必须阅读大型XML文档(最多40兆),转换其中几乎所有的自定义标记,但不修改这些标记的内容

例如,我的文档是:

<?xml version="1.0" encoding="utf-8"?>
<Root>
    <Foo>
        <PARA>
            Text Value 1
        </PARA>
        <PARA>
            Text Value 2
        </PARA>
        <PARA>
            Text Value 3
        </PARA>
    </Foo>
    <SubNode>
        <SubExample>
            <PARA>
                Text Value 4
            </PARA>
            <PARA>
                Text Value 5
            </PARA>
            <PARA>
                Text Value 6
            </PARA>
        </SubExample>
    </SubNode>
</Root>
即:

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl">
  <xsl:output omit-xml-declaration="yes" indent="yes" doctype-system="about:legacy-compat"/> 
  </xsl:param>-->
  <xsl:template match="@* | node()">
    <xsl:copy>
      <xsl:apply-templates select="@* | node()"/>
    </xsl:copy>
  </xsl:template>
  <xsl:template match="PARA">
    <p></p>
  </xsl:template>
</xsl:stylesheet>

-->

但是这样做,
标记的内容是空的

2) 输入XML文件必须转换为有效的HTML5有效文档

提前谢谢你的帮助

你忘了在

elementGeez下包含,很简单:(\me noob.Thx很多朋友!第二点呢?我应该在:?
XslTransform myXslTransform;
        myXslTransform = new XslTransform();
        myXslTransform.Load(@"C:\Users\User\Desktop\TransformXml2Html.xslt");
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl">
  <xsl:output omit-xml-declaration="yes" indent="yes" doctype-system="about:legacy-compat"/> 
  </xsl:param>-->
  <xsl:template match="@* | node()">
    <xsl:copy>
      <xsl:apply-templates select="@* | node()"/>
    </xsl:copy>
  </xsl:template>
  <xsl:template match="PARA">
    <p></p>
  </xsl:template>
</xsl:stylesheet>