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 

xmlns=""

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





PostPosted: Thu Apr 13, 2006 7:03 am    Post subject: xmlns="" Reply with quote



Hello there,



I am trying to create a xml document like this, using the vcl XMLDocument :



<?xml version="1.0" encoding="utf-16" ?>
- <Hogia_Message xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" toPartId="Mobilast"
fromPartId="Wanelid" xmlns="http://www.hogia.se/XMLSchema/Envelope">
- <Message xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" messageId="234"
xmlns="http://www.mobilast.se/xmlschema/EMI-Schemat.xsd">
- <MessageInfo>
<Order />
</MessageInfo>
</Message>
</Hogia_Message>




with this code:

XMLDocument1.Version:='1.0';
XMLDocument1.Encoding:='utf-16';
elem1 := XMLDocument1.CreateElement('Hogia_Message','');
XMLDocument1.DocumentElement:= elem1;
elem1.DeclareNamespace('xsi','http://www.w3.org/2001/XMLSchema-instance');
elem1.DeclareNamespace('xsd','http://www.w3.org/2001/XMLSchema');
elem1.SetAttribute('toPartId','Mobilast');
elem1.SetAttribute('fromPartId','Wanelid');
elem1.DeclareNamespace('','http://www.hogia.se/XMLSchema/Envelope');

elem2 := XMLDocument1.CreateElement('Message','');
elem2:=elem1.AddChild('Message','');
elem2.DeclareNamespace('xsi','http://www.w3.org/2001/XMLSchema-instance');
elem2.DeclareNamespace('xsd','http://www.w3.org/2001/XMLSchema');
elem2.SetAttribute('messageId',IntToStr(234));
elem2.DeclareNamespace('','http://www.mobilast.se/xmlschema/EMISchemat.xsd');

elem3:=XMLDocument1.CreateElement('MessageInfo',elem1.NamespaceURI);
elem2.ChildNodes.Add(elem3);

elem4:=XMLDocument1.CreateNode('Order',ntElement);
elem3.ChildNodes.Add(elem4);

and I get this:


<?xml version="1.0" encoding="utf-16" ?>
- <Hogia_Message xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" toPartId="Mobilast"
fromPartId="Wanelid" xmlns="http://www.hogia.se/XMLSchema/Envelope">
- <Message xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" messageId="234"
xmlns="http://www.mobilast.se/xmlschema/EMI-Schemat.xsd">
- <MessageInfo xmlns="">
<Order />
</MessageInfo>
</Message>
</Hogia_Message>

I have tried several other ways also. How can I do to get rid of xmlns="" in
the tag MessageInfo


/Camilla
Back to top
Ian Hinson
Guest





PostPosted: Sun Apr 23, 2006 5:03 am    Post subject: Re: xmlns="" Reply with quote



Oops. The example I gave in my last reply should have been for elem3 not
elem2.

elem3 := XMLDocument1.CreateNode(NODE_ELEMENT,
'MessageInfo','http://www.mobilast.se/xmlschema/EMI-Schemat.xsd');

Note the elements need to be declared as IXMLDOMNode, not IXMLDOMElement.

"Camilla Wiklund" <camilla.wiklund (AT) vagagenturen (DOT) se> wrote in message
news:443ded85 (AT) newsgroups (DOT) borland.com...
Quote:

Hello there,



I am trying to create a xml document like this, using the vcl XMLDocument
:



?xml version="1.0" encoding="utf-16" ?
- <Hogia_Message xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" toPartId="Mobilast"
fromPartId="Wanelid" xmlns="http://www.hogia.se/XMLSchema/Envelope"
- <Message xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" messageId="234"
xmlns="http://www.mobilast.se/xmlschema/EMI-Schemat.xsd"
- <MessageInfo
Order /
/MessageInfo
/Message
/Hogia_Message




with this code:

XMLDocument1.Version:='1.0';
XMLDocument1.Encoding:='utf-16';
elem1 := XMLDocument1.CreateElement('Hogia_Message','');
XMLDocument1.DocumentElement:= elem1;

elem1.DeclareNamespace('xsi','http://www.w3.org/2001/XMLSchema-instance');
elem1.DeclareNamespace('xsd','http://www.w3.org/2001/XMLSchema');
elem1.SetAttribute('toPartId','Mobilast');
elem1.SetAttribute('fromPartId','Wanelid');
elem1.DeclareNamespace('','http://www.hogia.se/XMLSchema/Envelope');

elem2 := XMLDocument1.CreateElement('Message','');
elem2:=elem1.AddChild('Message','');

elem2.DeclareNamespace('xsi','http://www.w3.org/2001/XMLSchema-instance');
elem2.DeclareNamespace('xsd','http://www.w3.org/2001/XMLSchema');
elem2.SetAttribute('messageId',IntToStr(234));

elem2.DeclareNamespace('','http://www.mobilast.se/xmlschema/EMISchemat.xsd');

elem3:=XMLDocument1.CreateElement('MessageInfo',elem1.NamespaceURI);
elem2.ChildNodes.Add(elem3);

elem4:=XMLDocument1.CreateNode('Order',ntElement);
elem3.ChildNodes.Add(elem4);

and I get this:


?xml version="1.0" encoding="utf-16" ?
- <Hogia_Message xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" toPartId="Mobilast"
fromPartId="Wanelid" xmlns="http://www.hogia.se/XMLSchema/Envelope"
- <Message xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" messageId="234"
xmlns="http://www.mobilast.se/xmlschema/EMI-Schemat.xsd"
- <MessageInfo xmlns=""
Order /
/MessageInfo
/Message
/Hogia_Message

I have tried several other ways also. How can I do to get rid of xmlns=""
in the tag MessageInfo


/Camilla

Back to top
Ian Hinson
Guest





PostPosted: Sun Apr 23, 2006 5:03 am    Post subject: Re: xmlns="" Reply with quote



Hi Camilla,

Use:
elem2 := XMLDocument1.CreateNode(NODE_ELEMENT,
'Message','http://www.mobilast.se/xmlschema/EMI-Schemat.xsd');

I found the answer here
http://groups.google.com.au/group/microsoft.public.xml.msxml-webrelease/browse_frm/thread/a1d37bcdbda3870d/9f8cafa15a76ef17

Ian.

"Camilla Wiklund" <camilla.wiklund (AT) vagagenturen (DOT) se> wrote in message
news:443ded85 (AT) newsgroups (DOT) borland.com...
Quote:

Hello there,



I am trying to create a xml document like this, using the vcl XMLDocument
:



?xml version="1.0" encoding="utf-16" ?
- <Hogia_Message xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" toPartId="Mobilast"
fromPartId="Wanelid" xmlns="http://www.hogia.se/XMLSchema/Envelope"
- <Message xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" messageId="234"
xmlns="http://www.mobilast.se/xmlschema/EMI-Schemat.xsd"
- <MessageInfo
Order /
/MessageInfo
/Message
/Hogia_Message




with this code:

XMLDocument1.Version:='1.0';
XMLDocument1.Encoding:='utf-16';
elem1 := XMLDocument1.CreateElement('Hogia_Message','');
XMLDocument1.DocumentElement:= elem1;

elem1.DeclareNamespace('xsi','http://www.w3.org/2001/XMLSchema-instance');
elem1.DeclareNamespace('xsd','http://www.w3.org/2001/XMLSchema');
elem1.SetAttribute('toPartId','Mobilast');
elem1.SetAttribute('fromPartId','Wanelid');
elem1.DeclareNamespace('','http://www.hogia.se/XMLSchema/Envelope');

elem2 := XMLDocument1.CreateElement('Message','');
elem2:=elem1.AddChild('Message','');

elem2.DeclareNamespace('xsi','http://www.w3.org/2001/XMLSchema-instance');
elem2.DeclareNamespace('xsd','http://www.w3.org/2001/XMLSchema');
elem2.SetAttribute('messageId',IntToStr(234));

elem2.DeclareNamespace('','http://www.mobilast.se/xmlschema/EMISchemat.xsd');

elem3:=XMLDocument1.CreateElement('MessageInfo',elem1.NamespaceURI);
elem2.ChildNodes.Add(elem3);

elem4:=XMLDocument1.CreateNode('Order',ntElement);
elem3.ChildNodes.Add(elem4);

and I get this:


?xml version="1.0" encoding="utf-16" ?
- <Hogia_Message xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" toPartId="Mobilast"
fromPartId="Wanelid" xmlns="http://www.hogia.se/XMLSchema/Envelope"
- <Message xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" messageId="234"
xmlns="http://www.mobilast.se/xmlschema/EMI-Schemat.xsd"
- <MessageInfo xmlns=""
Order /
/MessageInfo
/Message
/Hogia_Message

I have tried several other ways also. How can I do to get rid of xmlns=""
in the tag MessageInfo


/Camilla

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.