setting xml Element prefix is being ignored on save

hi..

i'm trying the following
:
jobTicket.LoadXml(@"<?AdLibeXpress applanguage='USA' appversion='2.5'
dtdversion='1.0' ?><!DOCTYPE JOBS SYSTEM 'C:\AdLib Express\DTD
\AdLibExpress.dtd'[]><JOBS xmlns:JOBS='http://www.adlibsoftware.com'
xmlns:JOB='http://www.adlibsoftware.com'/>");
			XmlElement job=jobTicket.CreateElement("JOB");
			jobTicket.DocumentElement.AppendChild(job);
			XmlElement docInputs=jobTicket.CreateElement("JOB:DOCINPUTS","");

when i save the xml, the element DOCINPUTS is being saved without job
prefix, even though in debug i can see the prefix property.correctly,
how can i get it to the string?

0
7/5/2007 5:19:19 PM
dotnet.xml 7266 articles. 0 followers. Follow

3 Replies
970 Views

Similar Articles

[PageSpeed] 20

elh.maayan@gmail.com wrote:

> i'm trying the following
> :
> jobTicket.LoadXml(@"<?AdLibeXpress applanguage='USA' appversion='2.5'
> dtdversion='1.0' ?><!DOCTYPE JOBS SYSTEM 'C:\AdLib Express\DTD
> \AdLibExpress.dtd'[]><JOBS xmlns:JOBS='http://www.adlibsoftware.com'
> xmlns:JOB='http://www.adlibsoftware.com'/>");
> 			XmlElement job=jobTicket.CreateElement("JOB");
> 			jobTicket.DocumentElement.AppendChild(job);
> 			XmlElement docInputs=jobTicket.CreateElement("JOB:DOCINPUTS","");
> 
> when i save the xml, the element DOCINPUTS is being saved without job
> prefix, even though in debug i can see the prefix property.correctly,
> how can i get it to the string?

You need to use a namespace aware overload of CreateElement e.g.
   jobTicket.CreateElement("JOB", "DOCINPUTS", 
"http://www.adlibsoftware.com")


-- 

	Martin Honnen --- MVP XML
	http://JavaScript.FAQTs.com/
0
mahotrash (1777)
7/5/2007 5:30:24 PM
what's what i did, but i thought there is another way (after all i've
allready defined the namespace once.

On Jul 5, 8:30 pm, Martin Honnen <mahotr...@yahoo.de> wrote:
> elh.maa...@gmail.com wrote:
> > i'm trying the following
> > :
> > jobTicket.LoadXml(@"<?AdLibeXpress applanguage='USA' appversion='2.5'
> > dtdversion='1.0' ?><!DOCTYPE JOBS SYSTEM 'C:\AdLib Express\DTD
> > \AdLibExpress.dtd'[]><JOBS xmlns:JOBS='http://www.adlibsoftware.com'
> > xmlns:JOB='http://www.adlibsoftware.com'/>");
> >                    XmlElement job=jobTicket.CreateElement("JOB");
> >                    jobTicket.DocumentElement.AppendChild(job);
> >                    XmlElement docInputs=jobTicket.CreateElement("JOB:DOCINPUTS","");
>
> > when i save the xml, the element DOCINPUTS is being saved without job
> > prefix, even though in debug i can see the prefix property.correctly,
> > how can i get it to the string?
>
> You need to use a namespace aware overload of CreateElement e.g.
>    jobTicket.CreateElement("JOB", "DOCINPUTS",
> "http://www.adlibsoftware.com")
>
> --
>
>         Martin Honnen --- MVP XML
>        http://JavaScript.FAQTs.com/


0
7/6/2007 8:55:01 AM
elh.maayan@gmail.com wrote:
> what's what i did, but i thought there is another way (after all i've
> allready defined the namespace once.

The namespace of an element node is determined when it is created with 
CreateElement. It does not matter at all where you insert it later and 
whether then there is an ancestor declaring some namespace.

-- 

	Martin Honnen --- MVP XML
	http://JavaScript.FAQTs.com/
0
mahotrash (1777)
7/6/2007 11:23:52 AM
Reply:

Similar Artilces: