2

I am trying to navigate through an instance by using XPath. I am providing below an excerpt of the original 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. I am using BaseX GUI. According to previous help my root element is {http://xbrl.org/2003/instance}xbrl!

However when i am trying it on an XPath expression like this:

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?):

enter image description here

BUT i am still getting the same error message as seen above. What must i do with the illegal name: xml?

EDIT_1

wst says use Q with Clark Notation:

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:

XQUERY doc("ann-20140201.xml")//*

I get nothing; why that? Also how do i declare a namespace?

4

3 回答 3

2

在编辑器窗口中输入以下内容,然后按“运行”:

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

数据库能够通过 HTTP 检索原始文档并从中毫无问题地查询根元素。

更本地化,以下工作也很完美(在将文档作为数据库导入之后):

declare namespace xbrli="http://www.xbrl.org/2003/instance";
doc("ann-20140201")/xbrli:xbrl

我注意到您在问题中的命名空间声明没有问号——这些很重要。

从基于 QName 的查询中获取结果也没有问题:

doc("ann-20140201")/Q{http://www.xbrl.org/2003/instance}xbrl
于 2014-06-11T17:24:13.633 回答
1

处理器不应将 XML 声明 ( <?xml...?>) 视为处理指令。

确保在声明之前没有任何空格,包括换行符。它必须是文件中的第一件事。

于 2014-06-11T15:45:13.337 回答
1

我认为为了使用 Clark Notation 进行查询,您需要使用以下前缀Q

xquery doc("ann-20140201.xml")//Q{http://xbrl.org/2003/instance}xbrl
于 2014-06-11T15:38:08.630 回答