[英]Problems using BaseX GUI
I am trying to navigate through an instance
by using XPath . 我正在尝试使用XPath 导航
instance
。 I am providing below an excerpt of the original instance
: 我在下面提供了原始
instance
的摘录:
<?xml version="1.0" encoding="US-ASCII"?>
<xbrli:xbrl xmlns:ann="http://www.anninc.com/20140201"
xmlns:dei="http://xbrl.sec.gov/dei/2013-01-31"
xmlns:iso4217="http://www.xbrl.org/2003/iso4217"
xmlns:link="http://www.xbrl.org/2003/linkbase"
xmlns:us-gaap="http://fasb.org/us-gaap/2013-01-31"
xmlns:xbrldi="http://xbrl.org/2006/xbrldi"
xmlns:xbrli="http://www.xbrl.org/2003/instance"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<link:schemaRef xlink:href="ann-20140201.xsd"
xlink:type="simple" />
<xbrli:context id="FD2011Q4YTD">
<xbrli:entity>
<xbrli:identifier scheme="http://www.sec.gov/CIK"
>0000874214</xbrli:identifier>
</xbrli:entity>
<xbrli:period>
<xbrli:startDate>2011-01-30</xbrli:startDate>
<xbrli:endDate>2012-01-28</xbrli:endDate>
</xbrli:period>
</xbrli:context>
<xbrli:context id="FD2011Q4YTD_ann_EarningsPerShareReconciliationAxis_ann_EarningsPerShareBasic.Member">
<xbrli:entity>
I am aware that the root element
has a namespace
inside. 我知道
root element
内部有一个namespace
。 I am using BaseX GUI . 我正在使用BaseX GUI 。 According to previous help my
root element
is {http://xbrl.org/2003/instance}xbrl
! 根据以前的帮助,我的
root element
是{http://xbrl.org/2003/instance}xbrl
!
However when i am trying it on an XPath expression like this: 但是,当我在这样的XPath表达式上尝试时:
xquery doc("ann-20140201.xml")//{http://xbrl.org/2003/instance}xbrl
and i hit Execute Query i am getting: 我点击执行查询,我得到:
Error:
Stopped at C:/Users/Μαρίνος/Desktop/ann-20140201.xml, 1/6:
[XPST0003] Processing instruction has illegal name: 'xml'.
What am i doing wrong? 我究竟做错了什么? Also i have been advised to use:
还建议我使用:
declare namespace xbrli=http://xbrl.org/2003/instance;
I am inputting this command from the GUI and i input
the command
here (do i input the declaration command here?): 我从GUI输入此命令,然后在此处
input
command
(是否在此处输入声明命令 ?):
BUT i am still getting the same error
message as seen above. 但是我仍然收到与上面相同的
error
消息。 What must i do with the illegal name: xml
? 我必须使用
illegal name: xml
什么?
EDIT_1 EDIT_1
wst says use Q
with Clark Notation: wst说将
Q
与Clark表示法一起使用:
xquery doc("ann-20140201.xml")//Q{http://xbrl.org/2003/instance}xbrl
--> If i hit run it executes with no error. ->如果我点击运行,它将执行而没有错误。 However instead of getting the
root element
in the Result
pane on BaseX as i get it with this command: 但是,不是像我通过以下命令获取它那样,而是在BaseX的“
Result
窗格中获取root element
:
XQUERY doc("ann-20140201.xml")//*
I get nothing; 我什么也没得到。 why that?
为什么? Also how do i declare a namespace?
另外我如何声明一个名称空间?
Enter the following in the editor window and press "run": 在编辑器窗口中输入以下内容,然后按“运行”:
declare namespace xbrli="http://www.xbrl.org/2003/instance";
http:send-request(
<http:request method='get'/>,
'http://www.sec.gov/Archives/edgar/data/874214/000087421414000008/ann-20140201.xml'
)[2]/xbrli:xbrl
The database is able to retrieve the original document over HTTP and query the root element from it without issue. 数据库能够通过HTTP检索原始文档并从中查询根元素,而不会出现问题。
More locally, the following works perfectly as well (after importing the document as a database): 在本地,以下操作也很好(将文档导入数据库后):
declare namespace xbrli="http://www.xbrl.org/2003/instance";
doc("ann-20140201")/xbrli:xbrl
I notice that your namespace declaration in the question doesn't have question marks -- those are important. 我注意到您在问题中的名称空间声明没有问号-这些很重要。
I also have no trouble getting a result from a QName-based query: 我也毫不费力地从基于QName的查询中得到结果:
doc("ann-20140201")/Q{http://www.xbrl.org/2003/instance}xbrl
我认为为了使用Clark表示法进行查询,您需要在Q
前面加上前缀:
xquery doc("ann-20140201.xml")//Q{http://xbrl.org/2003/instance}xbrl
The processor shouldn't see the XML declaration ( <?xml...?>
) as a processing instruction. 处理器不应将XML声明(
<?xml...?>
)视为处理指令。
Make sure you don't have any whitespace, including linebreaks, before the declaration. 确保声明前没有空格,包括换行符。 It needs to be the very first thing in the file.
它必须是文件中的第一件事。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.