Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how do i write the following xml instance document? 1

Status
Not open for further replies.

gemmak

Programmer
Jan 8, 2005
4
IE
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="companybalsheet.xsl"?>
<xbrl:group
xmlns=" xmlns:xbrl=" <xbrl:group id="" period="P2Y/2000-12-31" schemaLocation="XBRL-IETaxonomy102beta.xsd" scaleFactor="0" precision="3" type="" unit="ISO4217:USD" entity="IrishCo plc" decimalPattern="####.##" formatName="">
<xbrl:group item="statements.balanceSheet">
<xbrl:item id="fx000" period ="P1Y/2000-12-31" label="Balance Sheet" lang="en">0</xbrl:item>
<xbrl:item id="fx001" period ="P1Y/1999-12-31" label="Balance Sheet" lang="en">0</xbrl:item>
</xbrl:group>
</xbrl:group>
</xbrl:group>
 
I guess I'm confused as to what you're trying to do. This is an XML document that is also a stylesheet that can be used for transformations. So are you looking to apply this stylesheet to another document, or are you simply looking for code to produce this document in memory?

IOW, can you give us more info?

Chip H.


____________________________________________________________________
Click here to learn Ways to help with Tsunami Relief
If you want to get the best response to a question, please read FAQ222-2244 first
 
HI
I should have been more clear, I want to write code that will produce the instance document and store it in memory, I don't need the style sheet..
I have been looking at DOM and xmlTextWriter...
thanks
 
To produce the document as shown above, you would write code like (but not identical to) this:
Code:
Dim doc As XmlDocument
Dim nsm As XmlNameSpaceManager
Dim pi As XmlProcessingInstruction
Dim rootElem As XmlElement
Dim oneElem As XmlElement
Dim oneAttr As XmlAttribute

doc = New XmlDocument()
nsm = New XmlNameSpaceManager(doc.NameTable)
nsm.AddNamespace(String.Empty, "[URL unfurl="true"]http://www.w3.org/1999/XMLSchema"[/URL]
nsm.AddNamespace("xbrl", "[URL unfurl="true"]http://www.xbrl.org/core/2000-07-31/metamodel")[/URL]

rootElem = doc.CreateElement("xbrl:group")
doc.AppendChild(rootElem)

oneElem = doc.CreateElement("xbrl:group")
oneAttr = doc.CreateAttribute("id")
oneAttr.InnerText = String.Empty
oneElem.Attributes.Append(oneAttr)
oneAttr = doc.CreateAttribute("period")
oneAttr.InnerText = "P2Y/2000-12-31"
oneElem.Attributes.Append(oneAttr)
oneAttr = doc.CreateAttribute("schemaLocation")
oneAttr.InnerText = "XBRL-IETaxonomy102beta.xsd"
oneElem.Attributes.Append(oneAttr)
oneAttr = doc.CreateAttribute("scaleFactor")
oneAttr.InnerText = "0"
oneElem.Attributes.Append(oneAttr)
oneAttr = doc.CreateAttribute("precision")
oneAttr.InnerText = "3"
oneElem.Attributes.Append(oneAttr)
oneAttr = doc.CreateAttribute("type")
oneAttr.InnerText = String.Empty
oneElem.Attributes.Append(oneAttr)
oneAttr = doc.CreateAttribute("unit")
oneAttr.InnerText = "ISO4217:USD"
oneElem.Attributes.Append(oneAttr)
oneAttr = doc.CreateAttribute("entity")
oneAttr.InnerText = "IrishCo plc"
oneElem.Attributes.Append(oneAttr)
oneAttr = doc.CreateAttribute("decimalPattern")
oneAttr.InnerText = "####.##"
oneElem.Attributes.Append(oneAttr)
oneAttr = doc.CreateAttribute("formatName")
oneAttr.InnerText = String.Empty
oneElem.Attributes.Append(oneAttr)
rootElem.AppendChild(oneElem)

And so forth.

Chip H.

____________________________________________________________________
Click here to learn Ways to help with Tsunami Relief
If you want to get the best response to a question, please read FAQ222-2244 first
 
This is a great help thanks, I just have two questions:
This is the output that code generates:
<group>
<group id="" period="P2Y/2000-12-31" schemaLocation="XBRL-IETaxonomy102beta.xsd" scaleFactor="0" precision="3" type="" unit="ISO4217:USD" entity="IrishCo plc" decimalPattern="####.##" formatName="" />
</group>

how do I get it to include the namespaces specified?
Also, why is it <group></group> and not <xbrl:group> as specified in code?

thanks a million for your help
 
I would start with the documentation for XmlNameSpaceManager, and see how to attach it to your XmlDocument.

Chip H.


____________________________________________________________________
Click here to learn Ways to help with Tsunami Relief
If you want to get the best response to a question, please read FAQ222-2244 first
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top