risb | Running is Beautiful | Data Visualization library
kandi X-RAY | risb Summary
kandi X-RAY | risb Summary
Running (and Data) is Beautiful
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- getActivityStream gets a single activity stream
- Sends a new point to a bucket
- Pull activity streams from last record
- Retrieve the last record
- precisionToString converts a precision number to a string
- setupInflux initializes InfluxDB client
- This is the main entry point .
- extractUniqueIdTags extracts all unique id tags
- init log level .
risb Key Features
risb Examples and Code Snippets
Community Discussions
Trending Discussions on risb
QUESTION
I am using SimpleXML to construct XML to be used as XBRL.
Question:
How can I implement namespace on child element the correct way, using SimpleXML as base?
Observations:
Missing namespace (thus there are no [xbrli:xbrl], [se-cd-base:CompanyName].
Missing encoding string.
My code:
...ANSWER
Answered 2020-Feb-08 at 12:58When using namespaces in an XML document, you need to think about three things:
- The namespace URI. This is the globally unique identifier that tools will recognise as being the same namespace (the URI doesn't have to point anywhere, it's just a way of organising who "owns" the identifier).
- The local prefix. This is an arbitrary string which a particular document, or even part of a document, associates with a particular namespace URI, basically just to keep things more compact. This is the part before the
:
in a tag like. There is also a default namespace for each part of a document, for elements with no prefix.
- The element or attribute name within that namespace. This is the part after the
:
in a tag like.
I mention all this to understand why the sample XML you provide is invalid, because it looks like you want to use four namespaces:
- Namespace
http://www.xbrl.org/2003/linkbase
which you have given the local prefixlink
- An unknown namespace which you have given the local prefix
xbrli
; I'll call this onehttp://example.org/xbrli
- An unknown namespace which you have given the local prefix
se-cd-base
; I'll call this onehttp://example.org/se-cd-base
- An unknown namespace which you have given the local prefix
xlink
; I'll call this onehttp://example.org/xlink
(unless this was a typo and should have been another reference tohttp://www.xbrl.org/2003/linkbase
?)
Now let's try to construct a valid version of your XML using SimpleXML...
First, we need to create the root element, which is in the http://example.org/xbrli
namespace; SimpleXML doesn't have a way to create a document without any nodes, so we have to write the first node by hand and parse it:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install risb
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page