BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How do I put XML header information into Delphi TXMLDoc gene

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi XML
View previous topic :: View next topic  
Author Message
khariv
Guest





PostPosted: Fri Sep 30, 2005 12:08 am    Post subject: How do I put XML header information into Delphi TXMLDoc gene Reply with quote



I am using both Delphi 7 and Delphi 2005 to generate XML documents to
interact with several web services I have written. Everything is working
just fine, but I have a bit of an annoying problem. The XML that is
being generated, while "well formed" and correct in all ways, does not
contain the header information that is "supposed" to come with XML.

For example, my program is generating XML that looks something like this:

<IXDataExchangeObject>
<DataElements>
<Element name="fData" dataType="float">45.6</Element>
<Element name="sData" dataType="string">test string
value</Element>
</DataElements>
</IXDataExchangeObject>


My Hand created "standard XML" looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<!--ProserpinIX XML Template-->
<!DOCTYPE IXDataExchangeObject SYSTEM "http://www.proserpinix.com/XML/
IXDataExchangeObjectXML.dtd">
<IXDataExchangeObject>
<DataElements>
<Element name="fData" dataType="float">45.6</Element>
<Element name="sData" dataType="string">test string
value</Element>
</DataElements>
</IXDataExchangeObject>


I know this is probably just a cosmetic issue, and it certainly does not
seem to be affecting the functionality of my systems. Short of putting
the generated XML into a string list and "pre-pending" the header
information, is there a way to do this programmatically?

thanks
khariV



--- posted by geoForum on http://delphi.newswhat.com
Back to top
Rick Roen
Guest





PostPosted: Fri Sep 30, 2005 12:48 pm    Post subject: Re: How do I put XML header information into Delphi TXMLDoc Reply with quote



I think this depends on how exactly you are generating your XML.

In MSXML you can get the "xml header" with

var
XML: IXMLDocument;

begin
XML := NewXMLDocument( '1.0' );
....end;

I can't remember offhad how to do the DOCTYPE, but I think you can get it
with a google to "XMXML add DOCTYPE". (same thing for the comment element)

Rick



Quote:
My Hand created "standard XML" looks like this:
?xml version="1.0" encoding="UTF-8"?
!--ProserpinIX XML Template--
!DOCTYPE IXDataExchangeObject SYSTEM "http://www.proserpinix.com/XML/
IXDataExchangeObjectXML.dtd"
IXDataExchangeObject
DataElements
Element name="fData" dataType="float">45.6</Element
Element name="sData" dataType="string">test string
value /DataElements
/IXDataExchangeObject



Back to top
Peter Flynn
Guest





PostPosted: Sun Oct 02, 2005 7:38 pm    Post subject: Re: How do I put XML header information into Delphi TXMLDoc Reply with quote



khariv wrote:

Quote:
I am using both Delphi 7 and Delphi 2005 to generate XML documents to
interact with several web services I have written. Everything is working
just fine, but I have a bit of an annoying problem. The XML that is
being generated, while "well formed" and correct in all ways, does not
contain the header information that is "supposed" to come with XML.

For example, my program is generating XML that looks something like this:

IXDataExchangeObject
DataElements
Element name="fData" dataType="float">45.6</Element
Element name="sData" dataType="string">test string
value</Element
/DataElements
/IXDataExchangeObject


My Hand created "standard XML" looks like this:
?xml version="1.0" encoding="UTF-8"?

This line is usually optional if you are using UTF-8.
If you use some other character encoding you must specify it.

Quote:
!--ProserpinIX XML Template--

That's a comment :-)

Quote:
!DOCTYPE IXDataExchangeObject SYSTEM "http://www.proserpinix.com/XML/
IXDataExchangeObjectXML.dtd"

A DTD is usually only required:

a) for editing further instances of this type of document that you
want to conform to the same data model (a DTD will guide an XML
editor to create the correct elements for you);

b) for processing if it contains default values for Token List
Attributes, or Notations or Entities that your processor may
need access to;

c) when you send an XML file to some other process or person, where
the DOCTYPE Declaration may be needed to identify the layout or
version of the markup.

It does not harm to have it there, but it may simply not be needed
for processing.

Quote:
IXDataExchangeObject
DataElements
Element name="fData" dataType="float">45.6</Element
Element name="sData" dataType="string">test string
value /DataElements
/IXDataExchangeObject

I know this is probably just a cosmetic issue, and it certainly does not
seem to be affecting the functionality of my systems. Short of putting
the generated XML into a string list and "pre-pending" the header
information, is there a way to do this programmatically?

If your process is running inside a script of some kind, you could
reprogram the script to paste on the XML Declaration and the DOCTYPE
Declaration before it sends the file for processing. But as you say,
if it doesn't affect functionality then it may simply not be needed.

///Peter
--
XML FAQ: http://xml.silmaril.ie/


Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi XML All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.