XML Namespace - How to Declutter?

I have an app that creates XML documents, but recently they have been getting cluttered with namespace info in them. Here’s an example:

[quote]
Lightwright
True
200225152135


1
1
512


2
513
1024
[/quote]

The first four lines have namespace info embedded in them, the rest don’t. All are created with identical or nearly-identical code.

Any thoughts on why there’s a difference and/or how I can prevent this? IMHO the document only needs one namespace entry at the beginning of the file.

Thanks!

care to post the first few lines of the XML where the DTD is (do you have a dtd for your xml ?)
usually a namespace is inserted if there is ambiguity about its definition
cant say I’ve ever run into them being inserted using Xojo’s xml classes though

EDIT : FWIW unless you’re reading the nodes attributes those are “invisible” to your code reading the XML anyway unless you specifically read them

Not sure what a DTD is, but this is the first line of the .xml file:

<?xml version="1.0" encoding="UTF-8" standalone="no" ?>

I’d rather the extra stuff wasn’t there (there can be thousands of lines), the file wants to be as small as possible, reading and writing it very quickly is important.

not sure why you’d be getting namespaced entries then if your writing it using the XML document classes and why only for those particular elements
That said reading & writing those few extra bytes isnt going to make any noticeable difference even if it was in every node

The fastest way to read XML I’ve found, without doing it all by hand (blech !), is to NOT use the XML document class but to use the XML parsing exposed by the XMLReader
You get a callback to handle whatever things you want and can skip anything or handle anything

It tends to result in more code BUT, since it also does not read the entire XML into memory at once, you can read XML files of pretty much unlimited size

[quote=476862:@Norman Palardy]That said reading & writing those few extra bytes isnt going to make any noticeable difference even if it was in every node

The fastest way to read XML I’ve found, without doing it all by hand (blech !), is to NOT use the XML document class but to use the XML parsing exposed by the XMLReader
[/quote]

Yeah, it just offended my usually-dormant urge for tidiness.

I’ll check out XMLReader, thank you!

Are you using the Transform method on the XML you create?

I ask because I found using XSLT & Transform with the XML I was creating was adding namespace attributes where I didn’t expect them.

[quote=476867:@John McKernon]
I’ll check out XMLReader, thank you![/quote]
XMLReader is a non-trivial change IF you are already using XML document