473,385 Members | 1,912 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Creating Namespace Attributes

Hello,

I'm trying to round-trip some XML out of Adobe InDesign, through my
application and then back into InDesign.

Tables in InDesign are created using a specific namespace like this:

<Table TABLE_TYPE="table05"
xmlns:aid="http://ns.adobe.com/AdobeInDesign/4.0/" aid:table="table"
aid:trows="7" aid:tcols="2">
<Cell aid:table="cell" aid:crows="1" aid:ccols="1"
aid:ccolwidth="73.79470231328037"> etc.

Now, I'm looking to add a new table, so what I'm doing is constructing it
using the following code (VB.NET):

Dim customElement As XmlElement = ProductGuideExport.DestinationXMLDoc. _
CreateElement("table")
Dim newAttrib As XmlAttribute = CreateNewAttrib(customElement, _
"TABLE_TYPE", "table05")
newAttrib = CreateNewAttrib(customElement, "xmlns:aid",
"http://ns.adobe.com/AdobeInDesign/4.0/")
newAttrib = CreateNewAttrib(customElement, "table", "table", "aid")
newAttrib = CreateNewAttrib(customElement, "trows", "3", "aid")
newAttrib = CreateNewAttrib(customElement, "cols", "5", "aid")

etc...

where my CreateNewAttrib method is overloaded as:
Private Shared Function CreateNewAttrib(ByVal Element As Xml.XmlElement, _
ByVal Name As String, ByVal Value As String) As Xml.XmlAttribute

Dim newAttrib1 As XmlAttribute = _
Element.OwnerDocument.CreateAttribute(Name)
newAttrib1.Value = Value
Return Element.Attributes.Append(newAttrib1)
End Function

Private Shared Function CreateNewAttrib(ByVal Element As Xml.XmlElement, _
ByVal QulifiedName As String, ByVal Value As String, _
ByVal URI As String) As Xml.XmlAttribute

Dim newAttrib1 As XmlAttribute = Element.OwnerDocument.CreateAttribute _
(QulifiedName, URI)
newAttrib1.Value = Value
Return Element.Attributes.Append(newAttrib1)
End Function

This results in the following XML:

<table TABLE_TYPE="table03"
xmlns:aid="http://ns.adobe.com/AdobeInDesign/4.0/" d3p1:table="table"
d3p1:trows="3" d3p1:cols="5" xmlns:d3p1="aid">
<cell d3p1:table="cell" d3p1:crows="1" d3p1:ccols="1"
d3p1:ccolwidth="50.0">

So the question is, is this a legal equivalent to the original InDesign XML?
If so, then fine, but if not, how can I get the DOM to correctly create
InDesign-compliant XML?

Many thanks in advance

Rob


Nov 12 '05 #1
0 1208

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: John L. Clark | last post by:
I am curious as to the rationale, and effect, of having default namespaces not applying (directly) to attributes (see http://www.w3.org/TR/REC-xml-names/#defaulting). Given an attribute without a...
25
by: kj | last post by:
Consider the following XML document: <?xml version='1.0' encoding='UTF-8'?> <bar:foo xmlns:bar='someuri'> <baz/> </bar:foo> What namespace does baz belong to? What is this namespace bound...
12
by: Alex Hunsley | last post by:
There's no really specific questions in this post, but I'm looking for people's thought on the issues within... The two main versions I've encountered for data pseudo-hiding (encapsulation) in...
2
by: David Elliott | last post by:
I am creating a configuration class to read / write a standard configuration file. <?xml version="1.0" encoding="utf-8"?> <configuration> <appSettings> <add key="ConnectionString"...
0
by: Vilmar Brazão de Oliveira | last post by:
Hi, I am having err when creating link to each line of grid at LINE 38. My objective in asp.net is: each line can be linked to page with your parameters as VB 5/6, Delphi 5/6/7, etc.... See the...
3
by: Tabi | last post by:
Hi, I have just created a class that removes action attribute from HtmlForm. The code looks like here. namespace ComIT.Applications.Common { public class Form :...
1
by: JackieWilson | last post by:
Hello! I', trying to create DOM based XML document. First I create XmlDocument object and then read other XML DOM Document and modifie the first one. I'm putting Noden and Attributes tto the...
13
by: Axel Dahmen | last post by:
Hi, I've got a question on namespaces. After reading http://www.w3.org/TR/xml-names11 I still don't understand how namespaces are applied to attributes - particularly in regard to how processing...
0
by: mk189 | last post by:
Hi, I am trying to create XML schema of custom markup language, enriched by XHTML. In simplified version, the XML documet could look like that: <a:alarm-manual xmlns:a="alarm-manual"...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.