当前位置: 首页>>代码示例>>C#>>正文


C# Schema.getText方法代码示例

本文整理汇总了C#中Schema.getText方法的典型用法代码示例。如果您正苦于以下问题:C# Schema.getText方法的具体用法?C# Schema.getText怎么用?C# Schema.getText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Schema的用法示例。


在下文中一共展示了Schema.getText方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ReadText

 /// <summary>
 /// This <c>readText</c> method is used to read the text value
 /// from the XML element node specified. This will check the class
 /// schema to determine if a <c>Text</c> annotation was
 /// specified. If one was specified then the text within the XML
 /// element input node is used to populate the contact value.
 /// </summary>
 /// <param name="node">
 /// this is the XML element to acquire the text from
 /// </param>
 /// <param name="source">
 /// the type of the object that is being deserialized
 /// </param>
 /// <param name="schema">
 /// this is used to visit the element contacts
 /// </param>
 public void ReadText(InputNode node, Object source, Schema schema) {
    Label label = schema.getText();
    if(label != null) {
       Read(node, source, label);
    }
 }
开发者ID:ngallagher,项目名称:simplexml,代码行数:22,代码来源:Composite.cs

示例2: ValidateText

 /// <summary>
 /// This <c>validateText</c> method validates the text value
 /// from the XML element node specified. This will check the class
 /// schema to determine if a <c>Text</c> annotation was used.
 /// If one was specified then the text within the XML element input
 /// node is checked to determine if it is a valid entry.
 /// </summary>
 /// <param name="node">
 /// this is the XML element to acquire the text from
 /// </param>
 /// <param name="schema">
 /// this is used to visit the element contacts
 /// </param>
 public void ValidateText(InputNode node, Schema schema) {
    Label label = schema.getText();
    if(label != null) {
       Validate(node, label);
    }
 }
开发者ID:ngallagher,项目名称:simplexml,代码行数:19,代码来源:Composite.cs

示例3: WriteText

 /// <summary>
 /// This write method is used to write the text contact from the
 /// provided source object to the XML element. This takes the text
 /// value from the source object and writes it to the single contact
 /// marked with the <c>Text</c> annotation. If the value is
 /// null and the contact value is required an exception is thrown.
 /// </summary>
 /// <param name="source">
 /// this is the source object to be serialized
 /// </param>
 /// <param name="node">
 /// this is the XML element to write text value to
 /// </param>
 /// <param name="schema">
 /// this is used to track the referenced elements
 /// </param>
 public void WriteText(OutputNode node, Object source, Schema schema) {
    Label label = schema.getText();
    if(label != null) {
       Contact contact = label.getContact();
       Object value = contact.Get(source);
       Class type = source.getClass();
       if(value == null) {
          value = label.getEmpty(context);
       }
       if(value == null && label.isRequired()) {
          throw new TextException("Value for %s is null for %s", label, type);
       }
       WriteText(node, value, label);
    }
 }
开发者ID:ngallagher,项目名称:simplexml,代码行数:31,代码来源:Composite.cs


注:本文中的Schema.getText方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。