我有一个涉及解析 wddx 网络服务响应的项目。 DOM DocumentBuilder 抛出 XML 格式错误的异常,因为它没有引用 dtd。我插入了一个 DOCTYPE 语句,现在它抛出一个格式错误的异常 - 找不到协议(protocol)。我很确定这是我对 DTD 的引用,我现在需要一个本地副本。我认为从 wddx.org 获取 DTD 会很简单,但是,这并没有成功。
最佳答案
不确定它是否是最新的,但我找到了 this reference on xml.coverpages.org ,它链接到 a local archive copy of the DTD
WDDX DTD From: http://www.codebits.com/wddx/wddx_0090.dtd.txt Date: 1998-09-28
<!-- ************************************************************************
WDDX DTD:
Author: Simeon Simeonov (simeons@allaire.com)
Copyright (c) 1998 Allaire Corp. http://www.allaire.com
-->
<!-- ************************************************************************
Introductory Notes:
What is WDDX:
WDDX stands for Web Distributed Data eXchange. WDDX is a mechanism for
exchanging complex data structures between programming languages. It
has been designed with web applications in mind. WDDX consists of a
language-independent representation of instantiated data based on
XML 1.0 (which is defined using this DTD) and a set of serializer/
deserializer modules for every language/technology that uses WDDX.
The WDDX DTD:
The WDDX DTD can be used to validate WDDX packets. Packets are
representations of instantiated data structures in programming
languages. The following is an example of a WDDX packet:
<?xml version='1.0'?>
<!DOCTYPE wddxPacket SYSTEM 'wddx_0090.dtd'>
<wddxPacket version='0.9'>
<header/>
<data>
<struct>
<var name='s'>
<string>a string</string>
</var>
<var name='n'>
<number>-12.456</number>
</var>
<var name='d'>
<dateTime>1998-06-12T04:32:12</dateTime>
</var>
<var name='b'>
<boolean value='true'/>
</var>
<var name='a'>
<array length='2'>
<number>10</number>
<string>second element</string>
</array>
</var>
<var name='obj'>
<struct>
<var name='s'>
<string>a string</string>
</var>
<var name='n'>
<number>-12.456</number>
</var>
</struct>
</var>
<var name='r'>
<recordset rowCount='2' fieldNames='NAME,AGE'>
<field name='NAME'>
<string>John Doe</string>
<string>Jane Doe</string>
</field>
<field name='AGE'>
<number>34</number>
<number>31</number>
</field>
</recordset>
</var>
</struct>
</data>
</wddxPacket>
It defines a root level object that is a structure (also known as
an associative array) of six properties:
- s which is the string 'a string',
- n which is the number -12.456,
- d which is the date-time value June 12, 1998 4:32:12am,
- b which is the boolean value true,
- a which is an array of two elements (10 and 'second element'),
- obj which is a structure with two properties s and n, and
- r which is a recordset of two rows with fields NAME and AGE.
Basic data types:
WDDX supports the following basic data types: boolean (true/false),
number, date-time, and string.
Numbers are internally represented with floating point numbers. Because
of differences between WDDX-enabled languages, the range of numbers has
been restricted to 3.4E+/-38. The precision has been restricted to 7
digits after the decimal point. These requirements are consistent with
a 4-byte floating point representation.
Date-time values are encoded according to the full form of ISO8601.
Timezone information will be successfully parsed and used to convert to
a local data-time value. Efforts should me made to ensure that the
internal representation of date-time values does not suffer from Y2K
problems and covers a sufficient range of date-time values.
Strings can be of arbitrary length and must not contain embedded nulls.
Complex data types:
WDDX supports the following complex data types: arrays, structures, and
recordsets.
Arrays are integer-indexed collections of objects of arbitrary type.
The starting index value is usually 0 with the notable exception of
CFML whose arrays have an initial index value of 1. Because of these
differences working with array indices can lead to non-portable data.
Structures are string-indexed collections of object of arbitrary type.
In many languages they are known as associative arrays. Structures
contain one or more variables. Because some of the languages supported
by WDDX are not case-sensitive, no two variable names can differ only
by their case.
Recordsets are tabular data encapsulations: a set of named fields with
the same number of rows of data. Only simple data types can be stored in
recordsets. For tabular data storage of complex data types, an array of
structures should be used. Because some of the languages supported by
WDDX are not case-sensitive, no two field names can differ only by
their case.
Data type comparisons:
The following table compares the basic WDDX data types with those of
languages/technologies commonly used on the Web.
WDDX Type COM Java Type ECMAScript Type
************** ************* **************** ***************
boolean boolean boolean boolean
number float? float? number
dateTime DATE ?? Date
string BSTR java.lang.String string
array VARIANT array ?? Array
struct IWDDXStruct ?? Object
recordset IWDDXRecordset ?? WddxRecordset
More on data types:
WDDX provides no notion of a null object. Null objects should be
serialized to empty strings. Upon deserialization it is up to the
component performing the operation to determine whether and where
should empty strings be deserialized to null values.
WDDX serializes data using a model of pure aggregation. It has no
mechanism for handling object references. Aliased references will
result in multiple object instances being deserialized. WDDX
serialization applied to a data structure that has cyclical references
will most likely result in infinite iteration/recursion, depending on
the serializer implementation.
-->
<!ELEMENT wddxPacket (header, data)>
<!ATTLIST wddxPacket
version CDATA #FIXED "0.9">
<!ELEMENT header (comment?)>
<!ELEMENT comment (#PCDATA)>
<!ELEMENT data (boolean | number | dateTime | string | array | struct | recordset)*>
<!ELEMENT boolean EMPTY>
<!ATTLIST boolean
value (true | false) #REQUIRED>
<!ELEMENT string (#PCDATA)>
<!ELEMENT number (#PCDATA)>
<!ELEMENT dateTime (#PCDATA)>
<!ELEMENT array (boolean | number | dateTime | string | array | struct | recordset)*>
<!ATTLIST array
length CDATA #REQUIRED>
<!ELEMENT struct (var*)>
<!ELEMENT var (boolean | number | dateTime | string | array | struct | recordset)>
<!ATTLIST var
name CDATA #REQUIRED>
<!ELEMENT recordset (field*)>
<!ATTLIST recordset
rowCount CDATA #REQUIRED
fieldNames CDATA #REQUIRED>
<!ELEMENT field (boolean | number | dateTime | string)*>
<!ATTLIST field
name CDATA #REQUIRED>
关于xml - 我在哪里可以找到 wddx.dtd 的副本?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3542056/
类classAprivatedeffooputs:fooendpublicdefbarputs:barendprivatedefzimputs:zimendprotecteddefdibputs:dibendendA的实例a=A.new测试a.foorescueputs:faila.barrescueputs:faila.zimrescueputs:faila.dibrescueputs:faila.gazrescueputs:fail测试输出failbarfailfailfail.发送测试[:foo,:bar,:zim,:dib,:gaz].each{|m|a.send(m)resc
使用带有Rails插件的vim,您可以创建一个迁移文件,然后一次性打开该文件吗?textmate也可以这样吗? 最佳答案 你可以使用rails.vim然后做类似的事情::Rgeneratemigratonadd_foo_to_bar插件将打开迁移生成的文件,这正是您想要的。我不能代表textmate。 关于ruby-使用VimRails,您可以创建一个新的迁移文件并一次性打开它吗?,我们在StackOverflow上找到一个类似的问题: https://sta
我有一个对象has_many应呈现为xml的子对象。这不是问题。我的问题是我创建了一个Hash包含此数据,就像解析器需要它一样。但是rails自动将整个文件包含在.........我需要摆脱type="array"和我该如何处理?我没有在文档中找到任何内容。 最佳答案 我遇到了同样的问题;这是我的XML:我在用这个:entries.to_xml将散列数据转换为XML,但这会将条目的数据包装到中所以我修改了:entries.to_xml(root:"Contacts")但这仍然将转换后的XML包装在“联系人”中,将我的XML代码修改为
查看Ruby的CSV库的文档,我非常确定这是可能且简单的。我只需要使用Ruby删除CSV文件的前三列,但我没有成功运行它。 最佳答案 csv_table=CSV.read(file_path_in,:headers=>true)csv_table.delete("header_name")csv_table.to_csv#=>ThenewCSVinstringformat检查CSV::Table文档:http://ruby-doc.org/stdlib-1.9.2/libdoc/csv/rdoc/CSV/Table.html
我发现ActiveRecord::Base.transaction在复杂方法中非常有效。我想知道是否可以在如下事务中从AWSS3上传/删除文件:S3Object.transactiondo#writeintofiles#raiseanexceptionend引发异常后,每个操作都应在S3上回滚。S3Object这可能吗?? 最佳答案 虽然S3API具有批量删除功能,但它不支持事务,因为每个删除操作都可以独立于其他操作成功/失败。该API不提供任何批量上传功能(通过PUT或POST),因此每个上传操作都是通过一个独立的API调用完成的
我正在阅读SandiMetz的POODR,并且遇到了一个我不太了解的编码原则。这是代码:classBicycleattr_reader:size,:chain,:tire_sizedefinitialize(args={})@size=args[:size]||1@chain=args[:chain]||2@tire_size=args[:tire_size]||3post_initialize(args)endendclassMountainBike此代码将为其各自的属性输出1,2,3,4,5。我不明白的是查找方法。当一辆山地自行车被实例化时,因为它没有自己的initialize方法
我们的git存储库中目前有一个Gemfile。但是,有一个gem我只在我的环境中本地使用(我的团队不使用它)。为了使用它,我必须将它添加到我们的Gemfile中,但每次我checkout到我们的master/dev主分支时,由于与跟踪的gemfile冲突,我必须删除它。我想要的是类似Gemfile.local的东西,它将继承从Gemfile导入的gems,但也允许在那里导入新的gems以供使用只有我的机器。此文件将在.gitignore中被忽略。这可能吗? 最佳答案 设置BUNDLE_GEMFILE环境变量:BUNDLE_GEMFI
我喜欢使用Textile或Markdown为我的项目编写自述文件,但是当我生成RDoc时,自述文件被解释为RDoc并且看起来非常糟糕。有没有办法让RDoc通过RedCloth或BlueCloth而不是它自己的格式化程序运行文件?它可以配置为自动检测文件后缀的格式吗?(例如README.textile通过RedCloth运行,但README.mdown通过BlueCloth运行) 最佳答案 使用YARD直接代替RDoc将允许您包含Textile或Markdown文件,只要它们的文件后缀是合理的。我经常使用类似于以下Rake任务的东西:
我想让一个yaml对象引用另一个,如下所示:intro:"Hello,dearuser."registration:$introThanksforregistering!new_message:$introYouhaveanewmessage!上面的语法只是它如何工作的一个例子(这也是它在thiscpanmodule中的工作方式。)我正在使用标准的rubyyaml解析器。这可能吗? 最佳答案 一些yaml对象确实引用了其他对象:irb>require'yaml'#=>trueirb>str="hello"#=>"hello"ir
当谈到运行时自省(introspection)和动态代码生成时,我认为ruby没有任何竞争对手,可能除了一些lisp方言。前几天,我正在做一些代码练习来探索ruby的动态功能,我开始想知道如何向现有对象添加方法。以下是我能想到的3种方法:obj=Object.new#addamethoddirectlydefobj.new_method...end#addamethodindirectlywiththesingletonclassclass这只是冰山一角,因为我还没有探索instance_eval、module_eval和define_method的各种组合。是否有在线/离线资