我想在公司大楼网站上提取2010-2015内不同公司的财务信息,并使用这些数据绘制附图等图表。 但我不知道确切的信息并得到错误。有谁能够帮我?公司大楼提供样本XML request和sample XML response。
向xml网关发送请求时出现错误:
string(1288)" 1.0
错误2016-08-29T13:04:36-00:00 CHMD5
CH_XML_Gateway 100致命XML格式验证失败:XML错误:无效的文档结构行1列1" string(0)""
这是我的xmlcode:
<?xml version="1.0" encoding="UTF-8"?>
<GovTalkMessage xsi:schemaLocation="http://www.govtalk.gov.uk/schemas/govtalk/govtalkheader http://xmlgw.companieshouse.gov.uk/v1-0/schema/Egov_ch.xsd" xmlns="http://www.govtalk.gov.uk/schemas/govtalk/govtalkheader" xmlns:dsig="http://www.w3.org/2000/09/xmldsig#" xmlns:gt="http://www.govtalk.gov.uk/schemas/govtalk/core" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<EnvelopeVersion>1.0</EnvelopeVersion>
<Header>
<MessageDetails>
<Class>FilingHistory</Class>
<Qualifier>request</Qualifier>
<TransactionID>11452543233</TransactionID>
</MessageDetails>
<SenderDetails>
<IDAuthentication>
<SenderID>my sender id</SenderID>
<Authentication>
<Method>CHMD5</Method>
<Value>my pass</Value>
</Authentication>
</IDAuthentication>
<EmailAddress>email company</EmailAddress>
</SenderDetails>
</Header>
<Body>
<FilingHistoryRequest xmlns="http://xmlgw.companieshouse.gov.uk/v1-0/schema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlgw.companieshouse.gov.uk/v1-0/schema http://xmlgw.companieshouse.gov.uk/v1-0/schema/FilingHistory-v2-1.xsd">
<CompanyNumber>03176906</CompanyNumber>
<CapitalDocInd>0</CapitalDocInd>
<SearchRows>4</SearchRows>
</FilingHistoryRequest>
</Body>
</GovTalkMessage>
答案 0 :(得分:0)
当我尝试使用Saxon作为模式处理器验证您的文档时,我收到以下消息,并附有解释。
Validation error on line 15 column 28 of test.xml:
FORG0001: The content "my pass" of element <Value> does not match the required simple
type. Value "my pass" contravenes the pattern facet "[0-9a-f]{0,32}" of the type of element Value
See http://www.w3.org/TR/xmlschema11-2/#cvc-datatype-valid clause 1
我认为这是因为您为了发布而将虚拟密码放入文件中。
Validation error on line 18 column 27 of test.xml:
FORG0001: The content "email company" of element <EmailAddress> does not match the
required simple type. Value "email company" contravenes the pattern facet
"[A-Za-z0-9\.\-_]{1,64}@[A-Za-z..." of the type of element EmailAddress
See http://www.w3.org/TR/xmlschema11-2/#cvc-datatype-valid clause 1
同样,我假设您替换了一个虚拟电子邮件地址。
Validation error on line 21 column 11 of test.xml:
FORG0001: In content of element <GovTalkMessage>: The content model does not allow element
<Q{.../govtalkheader}Body> to appear immediately after element
<Q{.../govtalkheader}Header>. It must be preceded by <Q{.../govtalkheader}GovTalkDetails>.
See http://www.w3.org/TR/xmlschema11-1/#cvc-complex-type clause 2.4
此错误消息可能是真正的问题。该消息非常清楚地表明您的源中有一个缺少的元素,在Header和Body之间。所需元素存在于GovTalk的示例XML消息中,但不在您的版本中。
Warning
Schema at location http://xmlgw.companieshouse.gov.uk/v1-0/schema/FilingHistory-v2-1.xsd
has target namespace "" but requested namespace was "http://xmlgw.companieshouse.gov.uk/v1-0/schema"
您应该在FilingHistoryRequest元素上使用xsi:noNamespaceSchemaLocation
而不是xsi:schemaLocation
。但是,GovTalk示例消息包含相同的错误。
Warning
Validation will continue without the schema at
http://xmlgw.companieshouse.gov.uk/v1-0/schema/FilingHistory-v2-1.xsd
所以撒克逊实际上忽略了错误的xsi:schemaLocation属性。