> What kind of XML jugglery will permit me to covert a XML Document with
> "Qualified" elements into an XML document without Qualified Elements.
>
> eg: The source document is something like
>
> <ns0:baseelement xmlns:"http://schemas.myorg.com/solutions/yabadaba">
^^^^^^^
That is not proper XML syntax, I think you want
xmlns:ns0="http://schemas.myorg.com/solutions/yabadaba".
> <ns0:record1>
> <ns0:nelement1>value</ns0:nelement1>
[quoted text clipped - 8 lines]
>
> <baseelement xmlns:"http://schemas.myorg.com/solutions/yabadaba">
^^^^^^^
That isn't proper XML syntax either. I think you want
xmlns="http://schemas.myorg.com/solutions/yabadaba".
> <record1>
> <nelement1>value</nelement1>
[quoted text clipped - 4 lines]
> ...
> </baseelement>
An XSLT stylesheet could do the job:
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:template match="*">
<xsl:element name="{local-name()}" namespace="{namespace-uri()}">
<xsl:apply-templates select="@* | node()"/>
</xsl:element>
</xsl:template>
<xsl:template match="@* | text() | comment() | processing-instruction()">
<xsl:copy/>
</xsl:template>
</xsl:stylesheet>

Signature
Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
Ravi Shankar - 09 Mar 2008 18:25 GMT
Hello Martin,
Thank you for the quick response.
The output I've mentioned I get as a result of XML De-serialization.
I've a schema for which I used XSD to generate classes and compiled them
into a DLL. In BizTalk I then use the schea to define a message and use the
classes to help me manipulate various components of the message within the
BizTalk orchestration...
Now I ran into a situation where I need to pass this deserialized object as
a parameter to a ASP.Net WebService and get the response back which was not
working and while debugging I found that while I had a quialified element
message I needed to generate a message which has unqualified elements.
Your response with XSL is an option I could possibly use within an external
.Net component I could call from the orchestration as a helper function.
Thanks & Regards,
Ravi Shankar
> > What kind of XML jugglery will permit me to covert a XML Document with
> > "Qualified" elements into an XML document without Qualified Elements.
[quoted text clipped - 48 lines]
>
> </xsl:stylesheet>
Martin Honnen - 09 Mar 2008 18:36 GMT
> I've a schema for which I used XSD to generate classes and compiled them
> into a DLL. In BizTalk I then use the schea to define a message and use the
[quoted text clipped - 5 lines]
> working and while debugging I found that while I had a quialified element
> message I needed to generate a message which has unqualified elements.
Whether an element is marked up as
<foo xmlns="http://example.com/2008/ex1"></foo>
or as
<pf1:foo xmlns:pf1="http://example.com/2008/ex1"></pf1:foo>
should not matter to a web service.
As you are using XML serialization/deserialization you might also want
to have a look at
<URL:http://msdn2.microsoft.com/en-us/library/ms163161.aspx> as there
you can provide a third parameter mapping namespace URIs to prefixes.

Signature
Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
Ravi Shankar - 13 Mar 2008 08:48 GMT
Hi Martin,
Thank you for the reference.
The problem has been resolved. The schema that we were working with has
basic definition issues. Once we sorted those out, the resultant classes
generated by XSD worked fine.
I cannot control the serialization/deserialization as this is done by the
SOAP adapter that comes with BizTalk.. All I can ensure is that the message
is passed with correct data.
Thanks & Regards,

Signature
Ravi Shankar
> > I've a schema for which I used XSD to generate classes and compiled them
> > into a DLL. In BizTalk I then use the schea to define a message and use the
[quoted text clipped - 16 lines]
> <URL:http://msdn2.microsoft.com/en-us/library/ms163161.aspx> as there
> you can provide a third parameter mapping namespace URIs to prefixes.
> What kind of XML jugglery will permit me to covert a XML Document with
> "Qualified" elements into an XML document without Qualified Elements.
Here is how you could solve that with LINQ to XML in the .NET framework 3.5:
XDocument doc = XDocument.Load(@"XMLFile1.xml");
foreach (XAttribute att in
doc.Descendants().Attributes().Where(a => a.Name.Namespace ==
XNamespace.Xmlns).ToList())
{
att.Remove();
}
doc.Save(@"XMLFile2.xml");

Signature
Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/