Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: Append/Import XML from input - IE5-7 - Javascript

From: Ray Proffitt <rayone@-----.--->
To: NULL
Date: 3/16/2008 6:11:00 PM
Folks.

This works great for XML strings with a document/root element.
But is there anyway of parsing and importing nodes with no root?

Import =3D <Where>1=3D1</Where><OrderBy><FieldRef Name=3D"Test"/></OrderBy>

<root>
<data>
<query>
<!--HERE-->
</query
</data>
</root>

I should probably give you some context of what I'm trying to achieve.
I've got a clientside HTML page that queries a WSDL and based on what
bindings and elements is has a form is presented to the user.
There are inputs, drop downs and textareas... the textareas are used
to enter free XML... so I need a way of capturing free XML and adding
it as a child of a particular node.

So in the above case the users going to enter: <Where>1=3D1</
Where><OrderBy><FieldRef Name=3D"Test"/></OrderBy> and I need to make it
a child of <query>.
I don't want to go down the route of splitting the string and
appendChild, if possible.

Thanks.

On Mar 13, 12:38=A0pm, Ray Proffitt <ray...@gmail.com> wrote:
> Woohoo... thank you both oFldXMl.documentElement worked.
>
> Seems so obvious now; when you know.
>
> All the best.
>
> On Mar 11, 8:53=A0pm, "Anthony Jones" <A...@yadayadayada.com> wrote:
>
>
>
> > "Joe Fawcett" <joefawc...@newsgroup.nospam> wrote in message
>
> >news:uFcXbf1gIHA.6032@T......
>
> > > "Ray Proffitt" <ray...@gmail.com> wrote in message
> > >news:b9c4fef8-5168-4b16-8f9d-3ac54393feae@s....=
..
> > > > Hi.
>
> > > > I have an XML document:
> > > > <root>
> > > > <data>
> > > > <query>
> > > > <!--HERE-->
> > > > </query
> > > > </data>
> > > > </root>
>
> > > > And I need to insert an XML node with children where <!--HERE--> is.=

> > > > I know how to get the <query> node, but I can't figure out how to
> > > > insert my node object.
> > > > An input field will contain the following: <Where><Contains><FieldRe=
f
> > > > Name=3D"Test"/><Value Type=3D"Text">Tester</Value></Contains></Where=
>
>
> > > > I parse this using "MSXML2.DOMDocument.3.0", and try and insert the
> > > > XMLDom object as a child of <query>.
>
> > > > I've tried using:
> > > > 1.- The text property of the <query> node, but that escapes the XML
> > > > and it's treated as text.
> > > > 2.- queryNode.appendChild(oFldXml) =3D the operation cannot be perfo=
rmed
> > > > with a node of type document.
> > > > 3.- queryNode.importNode(oFldXml, true) =3D Method not supported.
>
> > > > Any advice would be really appreciated.
>
> > > > Thanks.
> > > If you are using version 3.0 then you need cloneNode:
>
> > > queryNode.appendChild(oFldXml.documentElement.cloneNode(true))
>
> > Since the oFldXml DOM has been created for the sole purpose of parsing s=
ome
> > XML from a string and then inserting the results into another DOM its mo=
st
> > likely that oFldXml will be discarded soon after. =A0Hence the cloneNode=
(true)
> > is most likely unnecessary. =A0Just oFldXMl.documentElement would do.
>
> > --
> > Anthony Jones - MVP ASP/ASP.NET- Hide quoted text -
>
> > - Show quoted text -- Hide quoted text -
>
> - Show quoted text -



transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent