与c#中的xml相关 [英] Related to trasform an xml in c#

查看:70
本文介绍了与c#中的xml相关的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我有一些xml文件,里面包含很多不必要的信息。所以现在我需要从那个xml中提取所需的信息。我听说我们需要编写一些xsd并使用C#预定义类并使用trasform函数....



xsd和xsl之间有什么区别。是否xsd将通过写入xsl自动生成...我有任何想法。请给我建议程序。我很惊讶地提取并生成带有所需信息的xml。



i had some xml file which contain lot of unnecessary information in it. so now i need to extract the required information from that xml. i heard that we need to write some xsd and use C# predefined class and use trasform function ....

what is the difference between xsd and xsl . whether xsd will generate automatically by writting xsl... i dint had any idea.please suggest me the procedure . i am struck up in extracting and generating xml with required information.

推荐答案

[回答后续问题]

[Answering a follow-up question]
pasupulety写道:
pasupulety wrote:

difference between xsl and xsd?




首先,最好先了解{0之间的区别之类的问题和{1}?在逻辑上是不正确的。苹果和苹果有什么区别?请看我过去的答案:

编程中的类和封装有什么区别 [ ^ ]。



另请参阅有关询问的讨论一个很好的问题:

如何提出一个好问题? [ ^ ]。



现在,您应该了解XSL在某些真正存在的XML文件上运行。它表示XML数据是一些其他形式,它可以通过数据丢失,复制等来实现。这只是一种转换数据的方法。基本上,它用于创建XML数据的不同表示,通常以人类可读的形式(例如HTML),但并非总是如此。请参阅:

http://en.wikipedia.org/wiki/XSL [< a href =http://en.wikipedia.org/wiki/XSLtarget =_ blanktitle =New Window> ^ ]。



相比之下,XSD不需要对单个XML文件执行任何操作。它确实定义了一整类这样的文件,换句话说,就是一组约束;并且每个可能的XML可能符合也可能不符合它。它定义了定义兼容文件类的元数据。在某种程度上,它在媒体上定义了一些基于XML的语义语言。请参阅:

http://en.wikipedia.org/wiki/XSD [< a href =http://en.wikipedia.org/wiki/XSDtarget =_ blanktitle =New Window> ^ ],

http://en.wikipedia.org/wiki/Metadata [ ^ ]。



-SA

First of all, it's best to understand that the questions like "what is the difference between {0} and {1}?" are logically incorrect. What is the difference between apple and Apple? Please see my past answer:
what is the difference between the class and encapsulation in programming[^].

See also this discussion on asking a good question:
How to ask a good question?[^].

Now, you should understand that XSL operated on some really existing XML files. It presents the XML data is some other form, and it can do it with data loss, duplication, etc. This is just a way to transform data. Basically, it is used to create a different representation of XML data, typically in a human-readable form (such as HTML), but not always. Please see:
http://en.wikipedia.org/wiki/XSL[^].

In contrast, XSD does not have to do anything with individual XML files. It really defined a whole class of such files, or, in other words, the set of constraints; and each of possible XMLs may or may not be compliant with it. It defined the metadata defining the class of compliant files. In a way, it defined some semantic language based on XML as on a media. Please see:
http://en.wikipedia.org/wiki/XSD[^],
http://en.wikipedia.org/wiki/Metadata[^].

—SA


XSD是一个XML模式文档,用于定义XML的结构。他们很高兴,但通常不需要完成工作。 XSL是样式表语言,您可能正在寻找的是XSLT,它将转换文件指定的一个文档转换为另一个文档。一旦掌握了它,XSLT就非常简单了--Michael Kay的书很棒,或者从这里开始: http:// www .w3schools.com / xsl / xsl_intro.asp
XSD is an XML schema document, defining the structure of your XML. They're nice to have, but not generally necessary to get the job done. XSL is stylesheet language, and what you're probably looking for is an XSLT, which transforms one document into another as specified by the transform file. XSLT is pretty simple once you get the hang of it--Michael Kay's books are great, or start here: http://www.w3schools.com/xsl/xsl_intro.asp


Xsl - 用于转换xml doc.ie添加新节点和删除新节点等。



xsd - 用于验证xml文档。类似数据类型,范围验证
Xsl - is used to tranform the xml doc.i.e Adding new nodes and Removing new nodes etc..

xsd - is used to validate xml document.Like datatype, range validation


这篇关于与c#中的xml相关的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆