我正在学习.NET 4.5中新的基于声明的身份验证方法,并且正在使用Console应用程序来完成此操作.根据MSDN 这里,ClaimsAuthenticationManager是System.Security.Claims命名空间中的一员.正如你在这里看到的,我没有得到这个选项.我确保该项目使用的是.NET 4.5.我在这里错过了一些简单的东西......有人有什么建议吗?

我在这里逐字跟踪MSDN文档无济于事.
我的XML的一个例子:
<Ticket xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<LogNo>454564</LogNo>
<CaseNumber>
<Part1>FGV</Part1>
<Part2>9999</Part2>
<Part3>88888888 </Part3>
</CaseNumber>
</Ticket>
Run Code Online (Sandbox Code Playgroud)
我的XSLT的一个例子:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:strip-space elements="*" />
<xsl:template match="/text">
<xsl:value-of select='normalize-space()'/>
</xsl:template>
<xsl:template match="Ticket">
<Ticket><xsl:attribute name="LogNumber"><xsl:value-of select="LogNo"/></xsl:attribute>
<CaseNumber><xsl:value-of select="CaseNumber/Part1"/>-<xsl:value-of select="CaseNumber/Part2"/>-<xsl:value-of select="CaseNumber/Part3"/></CaseNumber>
</Ticket>
</xsl:template>
</xsl:stylesheet>
Run Code Online (Sandbox Code Playgroud)
我的输出XML:
<?xml version="1.0" encoding="IBM437"?>
<Tickets>
<Ticket LogNumber="454564">
<CaseNumber>FGV-9999-88888888 </CaseNumber>
</Ticket>
</Tickets>
Run Code Online (Sandbox Code Playgroud)
我在用
<xsl:template match="/text">
<xsl:value-of select='normalize-space()'/>
</xsl:template>
Run Code Online (Sandbox Code Playgroud)
正如MSDN文章和网上的其他人所说,但似乎无法从CaseNumber Part3中删除尾随空格.有什么我做错了吗?
我无法弄清楚这里的问题是什么。我从头开始项目,去调试,并收到错误:
System.InvalidOperationException 未处理 Message=创建表单时出错。有关详细信息,请参阅 Exception.InnerException。错误是:未将对象引用设置为对象的实例。
我不明白为什么在自动生成的文件中会发生此错误。这是完整的代码:
'------------------------------------------------------------------------------
' <auto-generated>
' This code was generated by a tool.
' Runtime Version:4.0.30319.269
'
' Changes to this file may cause incorrect behavior and will be lost if
' the code is regenerated.
' </auto-generated>
'------------------------------------------------------------------------------
Option Strict On
Option Explicit On
Namespace My
'NOTE: This file is auto-generated; do not modify it directly. To make changes,
' or if you encounter build errors in this file, go to the Project Designer
' …Run Code Online (Sandbox Code Playgroud) 我一直在搜索这几个小时,无法弄清楚这个问题.有人可以帮我这个吗?我在VB.NET 2010中执行SQLXMLBULKLOAD时遇到上述错误.我已尝试更改我的xml声明,我的架构属性,并且无法通过此错误.这似乎是微不足道的,但我无法弄清楚.请帮忙
<?xml version="1.0" ?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:sql="urn:schemas-microsoft-com:mapping-schema">
<xsd:element name="Employees" sql:is-constant="1">
<xsd:complexType>
<xsd:sequence maxOccurs="unbounded">
<xsd:element name="Employee" sql:relation="the_Employees">
<xsd:complexType>
<xsd:sequence maxOccurs="unbounded">
<!--<xsd:element name="id" type="xsd:integer" />-->
<xsd:element name="EmployeeID"sql:field="EmpNo">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:whiteSpace value="collapse"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="FirstName"sql:field="FirstName">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:whiteSpace value="collapse"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
Run Code Online (Sandbox Code Playgroud) 我需要转换XML并遇到一些问题...
当前的XML:
<?xml version="1.0" encoding="utf-8"?>
<Employees>
<Employee>
<ManagerFirstName>Joe</ManagerFirstName>
<ManagerLastName>Schmoe</ManagerLastName>
</Employee>
</Employees>
Run Code Online (Sandbox Code Playgroud)
所需输出:
<?xml version="1.0" encoding="utf-8"?>
<Employees>
<Employee>
<supervisorName>Schmoe, Joe</supervisorName>
</Employee>
</Employees>
Run Code Online (Sandbox Code Playgroud)
当前的XSL:
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0" >
<xsl:template match="/">
<xsl:apply-templates select="*"/>
</xsl:template>
<xsl:template match="node()">
<xsl:copy><xsl:apply-templates select="node()"/></xsl:copy>
</xsl:template>
<xsl:template match="ManagerFirstName">
<supervisorName>
<xsl:apply-templates select="node()"/>
<xsl:value-of select="/ManagerLastName"/>
<xsl:text>, </xsl:text>
<xsl:value-of select="/ManagerFirstName"/>
</supervisorName>
</xsl:template>
</xsl:stylesheet>
Run Code Online (Sandbox Code Playgroud)
这是行不通的,我无法弄清楚。目前正在输出的XML如下所示:
<?xml version="1.0" encoding="utf-8"?>
<Employees>
<Employee>
<supervisorName>Joe, </supervisorName>
<ManagerLastName>Schmoe/ManagerLastName>
</Employee>
</Employees>
Run Code Online (Sandbox Code Playgroud)
我觉得我好近...
更新 如何确保如果ManagerFirstName和ManagerLastName为空白,那么supervisorName内没有逗号?
更新2
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
<xsl:output indent="yes"/> <xsl:strip-space elements="*"/> …Run Code Online (Sandbox Code Playgroud) 我无法弄清楚为什么VBA会对我大吼大叫.非常简单的代码,只涉及一个if语句,它显然有一个"Starting"If和一个匹配的End If.我是一名VB.NET开发人员,所以它可能与我所缺少的语法不同.
Sub splitter()
Dim line() As String
Dim rng As Range
Dim row As Range
Dim cell As Range
For Each row In rng.Rows
If row.Value <> "" Then
line = Split(Range(row, 1), ",")
Select Case line(0)
Case "Desktop"
Range(row, 8).Value = "Desktop"
Case "Laptop"
Range(row, 8).Value = "Laptop"
Case "Server"
Range(row, 8).Value = "Server"
Case Else
Range(row, 8).Value = "N/A"
End If
Next
End Sub
Run Code Online (Sandbox Code Playgroud)
具体来说,最终结果是它将根据"父"下拉列表(Range(row,1))的选择填充"Child"下拉列表(Range(row,8)).因为问题会出现,我使用VBA进行此操作的原因是因为我可以使用Split()函数以及Parent下拉列表中的项目的方式,例如."桌面,戴尔,745".另外,我是一个比excel开发人员更好的程序员.
xml ×3
vb.net-2010 ×2
xslt ×2
.net-4.5 ×1
bulk-load ×1
c# ×1
excel ×1
excel-2010 ×1
excel-vba ×1
reference ×1
sqlxml ×1
vba ×1
whitespace ×1
xsd ×1