Sign in to follow this  

custom xml in c# and 4 gb xml files

This topic is 669 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

hello.
I have created with the xsd.exe any classes from a huge xsd..
Then i load  a my custom xmlreader
I would create a custom xmlreader for make some little adjustment on the fly like sax to some xml files of size around 4 / 5 gb.
The problem is that when i change an element on the fly in the custom xmlreader the next function that is triggered is the public override string NamespaceURI and any string i return in this function i get an error because the parser asks for an xmls= and i can't remove this xmls= that is proposed in all elements.
How i can eliminate this xmlns=?
thanks.

Share this post


Link to post
Share on other sites

Basically you don't, as far as I know.

 

xmlns is a name space for elements, so you can combine different sets of primitives (each in its own namespace) with the same tag, without clashes.

 

Instead, you should handle the name space properly, don't find tags on name alone, but also check the xmlns name space. Similarly, when you insert new tags, also make sure they are in their correct name space, possibly by adding a name space first.

Share this post


Link to post
Share on other sites

when you say custom xml reader do you mean you have written your own xml reader?

 

If this is the case I would advise against this course of action and switch to some sax based parser. With your own parser you will have to ensure that you handles all the different ways to specify namespace, of which are are a few, and you will have to handle the various ways to pack strings to ensure protected characters are escaped etc. This on top of keeping up with the various xml specs to ensure that if you generate xml you are then able to parse it when the specs change etc.

 

Writing your own xml parser is similar to when you have a problem to solve and you think that regex is the solution :)

 

BTW, I say use sax based as your file is 5gb so a dom based parser will just bog down as it has to parse the entire file before it gives you access to it.

Share this post


Link to post
Share on other sites

This topic is 669 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this