Reputation: 1536
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?):
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?
Upvotes: 2
Views: 1936
Reputation: 295766
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.
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:
doc("ann-20140201")/Q{http://www.xbrl.org/2003/instance}xbrl
Upvotes: 2
Reputation: 52888
The processor shouldn't see the XML declaration (<?xml...?>
) as a processing instruction.
Make sure you don't have any whitespace, including linebreaks, before the declaration. It needs to be the very first thing in the file.
Upvotes: 1
Reputation: 11771
I think in order to query using Clark Notation, you need to prefix with Q
:
xquery doc("ann-20140201.xml")//Q{http://xbrl.org/2003/instance}xbrl
Upvotes: 1