Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Removing XML information

Status
Not open for further replies.

haddaway

Programmer
Jul 6, 2005
172
SE
I am sending some XML classes over a socket. One message look like this:

<?xml version="1.0"?><LoginClass xmlns:xsd=" xmlns:xsi=" /><UseCompression>false</UseCompression></LoginClass>

Can I specify anything in the class or serialization method to ignore creating:

xmlns:xsd=" xmlns:xsi="
or:

<?xml version="1.0"?>

I would like to send as little information as possible.

thanks!
 
There is such a thing as

Code:
myDataset.WriteXml(myXmlWriter, XmlWriteMode.IgnoreSchema)

if you are working with xml in dataset. You can probably use the IgnoreSchema when you create your xmlreader or xmlwriter also

- - - - - - - - - - - - - - - - - -
Im three apples high, Im blue, and i most certainly like that cold beer that should be every mans right after a hard days work!
 
I am not working with datasets and I can't find where to put in XmlWriteMode.IgnoreSchema in this:

Public Shared Function XmlSerialize(ByVal serializableObject As Object) As String

Dim serializer As XmlSerializer = New XmlSerializer(serializableObject.GetType())
Dim aMemStr As System.IO.MemoryStream = New System.IO.MemoryStream
Dim writer As System.Xml.XmlTextWriter = New System.Xml.XmlTextWriter(aMemStr, Nothing)
serializer.Serialize(writer, serializableObject)

Dim strXml As String = System.Text.Encoding.UTF8.GetString(aMemStr.ToArray())
Return strXml

End Function


thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top