Delphi有OpenID 2.0库吗?
我有一个巨大的xsl文件,但我使用"tokenize"来解析逗号分隔字符串的部分抛出一个错误.为简单起见,我将其分解为仅测试令牌化部分,似乎无法取得任何进展.我一直收到以下错误:
表达预期.记号化( - > [< - 文本], '')
我尝试在其他帖子中使用一些示例xsl共享,但从未设法让它工作.我很难理解为什么下面的xsl代码无效.这看起来非常简单,但我想我错过了一些简单的事情.任何有助于我朝着正确方向前进的帮助都将非常感激.
XSL:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/root">
<xsl:for-each select="tokenize([text],',')"/>
<items>
<item>
<xsl:value-of select="."/>
</item>
</items>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
Run Code Online (Sandbox Code Playgroud)
XML:
<?xml-stylesheet type="text/xsl" href="simple.xsl"?>
<root>
<text>Item1, Item2, Item3</text>
</root>
Run Code Online (Sandbox Code Playgroud)
我期待XML输出如下:
<items>
<item>Item1</item>
<item>Item2</item>
<item>Item3</item>
</items>
Run Code Online (Sandbox Code Playgroud)
谢谢!
上面的重复标记说明^是错误的.
如何从Delphi 2010程序中调用.NET库(不是已注册的COM对象)的参数化方法?
具体来说,我想访问Saxon API,如此处所述.具体来说,我可以创建一个XsltCompiler并读取BaseURI属性,但不能设置它.
我使用Win32 COM服务器对象(mscoree.dll和mscorlib.dll)和Late Binding取得了一些成功.这要归功于Project-Jedi TJclClrHost组件的示例.我可以加载.NET程序集,创建.NET对象并读取没有参数的简单字符串属性或函数.我的问题是如何传递参数?
这个问题的例子是如何设置从Saxon .NET程序集加载的XsltCompiler的基本URI.这里记录了BaseUri的API ,其中显着的部分是......
public Uri BaseUri {get; set; }
Run Code Online (Sandbox Code Playgroud)
使用反射,我已经确定setter函数的名称是'set_BaseUri'.
可以使用从中导入的类型库中的Late Binding/Reflection调用此方法mscorlib.dll.相关方法如下.
_Type = interface(IDispatch)
['{BCA8B44D-AAD6-3A86-8AB7-03349F4F2DA2}']
....
function InvokeMember(const name: WideString; invokeAttr: BindingFlags; const Binder: _Binder;
Target: OleVariant; args: PSafeArray; modifiers: PSafeArray;
const culture: _CultureInfo; namedParameters: PSafeArray): OleVariant; safecall;
...
end;
Run Code Online (Sandbox Code Playgroud)
在我的Delphi 2010程序中,我写了..
FType.InvokeMember( 'set_BaseUri',
BindingFlags_Public or BindingFlags_Instance or BindingFlags_InvokeMethod or
BindingFlags_SetField or BindingFlags_SetProperty,
nil, FInstance, args, modifiers, nil, nil);
Run Code Online (Sandbox Code Playgroud)
其中:
FType是类型 …
Delphi应用程序如何调用导出的函数(非COM)dotNET程序集并让函数返回一个字符串?
COM不是我的特定应用程序的可能解决方案.我控制了通话的两端.
type
TStrProc = procedure( var x: widestring); stdcall;
function TryIt: string;
var
Handle: THandle;
Proc: TStrProc;
InData: widestring;
OutData: widestring;
begin
Handle := LoadLibrary( 'DelphiToDotNet.dll');
if Handle = 0 then exit;
@Proc := GetProcAddress( Handle, 'StrProc');
if @Proc <> nil then
begin
InData := 'input';
Proc( InData);
OutData := InData;
end;
FreeLibrary( Handle);
result := OutData
end;
Run Code Online (Sandbox Code Playgroud)
public class DotNetDllClass
{
[DllExport]
public static string StrProc(ref string s)
{
return "Hello from .Net …Run Code Online (Sandbox Code Playgroud) 对于从XE2到XE8的Delphi编译器,对于非Windows目标平台,是一个整数数据成员的读操作,用[Volatile]注释,原子?
我知道对于Windows平台的情况,当且仅当数据成员对齐到4个字节时才是原子的,但是非windows(Android等)呢?
请注意,我不是在询问线程安全性.线程安全性和原子性是两回事.
什么是正确的XML Schema 1.0声明
<notice xml:lang="en">Banana banana banana</notice>
Run Code Online (Sandbox Code Playgroud)
哪里:
我最好的(但错误的)努力是以下片段:
<xs:element name="notice" use="required" fixed="Banana banana banana">
<xs:complexType>
<xs:simpleContent>
<xs:extension>
<xs:attribute ref="xml:lang" use="required" fixed="en"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
Run Code Online (Sandbox Code Playgroud) 我是stackoverflow和xslt的noobie所以我希望我听起来不愚蠢!
所以我正在为一家GIS公司的SDI工作,我有一项任务要求我将一个空间参考系统(SRS)坐标平面上的点(例如EPSG:4035)转换为世界SRS,即EPSG:4326.这对我来说真的不是问题,因为我有一个在线服务的可访问性,只会给我我想要的东西.但是,它输出的格式是JSON或HTML.我已经浏览了一段时间来找到从JSON文件中提取信息的方法,但我见过的大多数技术都使用xslt:stylesheet 2.0版,我必须使用1.0版.我想做的一个方法是使用文档($ urlWithJsonFormat)xslt函数,但是这只接受xml文件.
以下是我要求转换后将检索的JSON格式文件的示例:
{
"geometries" :
[{
"xmin" : -4,
"ymin" : -60,
"xmax" : 25,
"ymax" : -41
}
]
}
我只想要的是xmin,ymin,xmax和ymax值,这就是全部!它看起来很简单,但对我来说没有任何作用......
我有下面的XML.
情况1
<body>
<nd>
<pnn>1.1</pnn>
<h1>PART 54</h1>
<ti>Construction</ti>
</nd>
<nd>
<h1>PART 54</h1>
<h2>I INTRODUCT</h2>
<ti>Time</ti>
</nd>
<nd>
<h1>PART 54</h1>
<h2>I INTRODUCT</h2>
<ti>Power</ti>
</nd>
<nd>
<h1>PART 54</h1>
<h2>II APPLICATIONS</h2>
<ti>Filing</ti>
</nd>
</body>
Run Code Online (Sandbox Code Playgroud)
案例2
<body>
<nd>
<pnn>1.1</pnn>
<h1>PART 54</h1>
<h2>I INTRODUCT</h2>
<ti>Construction</ti>
</nd>
<nd>
<h1>PART 54</h1>
<h2>I INTRODUCT</h2>
<ti>Time</ti>
</nd>
<nd>
<h1>PART 54</h1>
<h2>II APPLICATIONS</h2>
<ti>Filing</ti>
</nd>
</body>
Run Code Online (Sandbox Code Playgroud)
和下面的XSLT
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
<xsl:output method="html" doctype-public="XSLT-compat" omit-xml-declaration="yes" encoding="UTF-8" indent="yes" />
<xsl:template match="/">
<hmtl>
<head>
<title>New Version!</title>
</head>
<xsl:apply-templates select="body"></xsl:apply-templates> …Run Code Online (Sandbox Code Playgroud) 我在确定节点集的正确上下文时遇到了一些麻烦.我有一个看起来有点像这样的模板匹配(使用XSL 2.0):
<xsl:template match="//chapter/body/*[matches(name(), '^toc')][crossref][not(crossref/@idref='cip' or crossref/@idref='copy')]">
<xsl:variable name="curr_id" select="crossref/@idref"/>
<xsl:element name="location">
<xsl:attribute name="id"><xsl:value-of select="$curr_id"/></xsl:attribute>
<xsl:attribute name="order"><xsl:value-of select="position()"/></xsl:attribute>
<xsl:element name="label">
<text><xsl:value-of select="."/></text>
</xsl:element>
</xsl:element>
</xsl:template>
Run Code Online (Sandbox Code Playgroud)
XML看起来有点像这样:
<chapter id="toc">
<body>
<title>Contents</title>
<tocfm><crossref idref="cip">Catalog</crossref></tocfm>
<tocfm><crossref idref="copy">Copyright</crossref></tocfm>
<tocfm><crossref idref="ded">Dedication</crossref></tocfm>
<toc><crossref idref="prologue">Prologue</crossref></toc>
<toc><crossref idref="pt1">Book One</crossref></toc>
<toc><crossref idref="pt2">Book Two</crossref></toc>
<toc><crossref idref="pt3">Book Three</crossref></toc>
</body>
</chapter>
Run Code Online (Sandbox Code Playgroud)
我的期望是谓词将生成一个包含以下内容的节点集:
<tocfm><crossref idref="ded">Dedication</crossref></tocfm>
<toc><crossref idref="prologue">Prologue</crossref></toc>
<toc><crossref idref="pt1">Book One</crossref></toc>
<toc><crossref idref="pt2">Book Two</crossref></toc>
<toc><crossref idref="pt3">Book Three</crossref></toc>
Run Code Online (Sandbox Code Playgroud)
换句话说,所有包含crossref的toc类元素,其idref不是cip或copy.模板在输出方面执行此操作,但位置函数似乎不在该节点集上.相反,它为奉献产生了一个'3'的位置.但是,如果我输出通过跟随[1]的谓词找到的节点的值,我会得到Dedication作为该值.所以,我对于正在发挥作用的立场感到难过.任何人都可以开导我吗?
Delphi移动目标的原子操作建立AtomicXXX在内在函数族之上.该文件说:
由于Delphi移动编译器不支持内置汇编程序,因此System单元提供了四种原子内部函数,这些函数提供了一种原子交换,比较和交换,递增和递减内存值的方法.
这四个功能是:
其他提供原子操作的RTL函数,例如类的静态类方法TInterlocked,都是建立在这四个内在函数之上的.
对于针对ARMv7的移动编译器,这四种原子内在函数是否有任何对齐要求?如果是这样,他们是什么?
该文档未列出任何此类要求.但是,已知文件不准确,我不相信没有任何规定的要求作为没有此类要求的明确证据.