Group:  General ยป microsoft.public.office.xml
Thread: Add XML attribute in Word 2003

DotNetBag
.NET Development Newsgroups

HTVi
TV Discussion Newsgroups

Our Hot Pick: Rising Antivirus 2006 - Certified by TUV & Checkmark! Get 10% discount by entering this coupon code: ONDISCOUNT10
Rising Antivirus 2006

Add XML attribute in Word 2003
"gsvi" <gsvitak[ at ]hotmail.com> 10.12.2005 21:27:24
Hello all,

I am writing a VBA add-in to Word 2003. I am attempting to add a block
of XML data to a section of the Word doc the user has selected. I would
like the XML to look something like

<OBSection username="jsmith" sectionName="section1">
rest of the highlighted information
</OBSection>

I am able to add the XML element via

Set beginRange = Selection.Range
Set ParentNode = Selection.Range.XMLNodes.Add("OBSection",
"http://www.gs.com/ed")

with the result
<OBSection>Section 1
</OBSection>

but I need to know how to add the attributes

my schema is attached for reference:

<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="OBSection" type="OBSection"/>

<xsd:complexType name="OBSection" mixed="true">
<xsd:attribute name="userName" type="xsd:string" use="optional"/>
<xsd:attribute name="SectionName" type="xsd:string" use="optional"/>
</xsd:complexType>
</xsd:schema>

Any help would be appreciated...

Thanks

Home | Search | Terms | Imprint | Contact
Newsgroups Reader - provided by WiredBox.Net