Question

I need to convert HTML file to iXBRL format. iXBRL format is basically html with some embedded nodes or some information of html file wrapped under ixbrl tags. For this, I will need to SEARCH and REMOVE some nodes from HTML file and WRAP some nodes under iXBRL tags.

I'm not able to use XML DOM as it shoots an exception on content type. .Net htmldocument class doesn't support removing the nodes and replacing them, neither I could see the Save option.

I tried using HTML Agility Pack but It can't find the nodes because of namespaces in the node name and it doesn't have any option to specify namespaces (line namespace manager in .net).

Can I specify namespace in XPATH expression? How?

Can anyone help me in Editing HTML (or XHTML) files using .net or any free library.

Was it helpful?

Solution

If you want to use XPATH with namespaces you just need to prefix the nodes with the right namespace.

If your Namespace looks like this:

xmlns:xbrli="http://www.xbrl.org/2003/instance"

And your Elements are like this:

<root>
<xbrli:elementname></xbrli:elementname>
<root>

Then you can select them in XPATH like:

//xbrli:elementname
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top