myTag1 and myTag2 look like XML namespaces. How exactly C# parser "fails to parse those tags"?
myTag1 and myTag2 look like XML namespaces. How exactly C# parser "fails to parse those tags"?
Probabily you understand the core........how do I use those type of tags?Qt Code:
XmlTextReader tr = new XmlTextReader(path_and_File); while (tr.Read()) { //here I need to extract tag name; //all goes fine until it see <tag1:Other> //an exception raises saying that tag1 namespace isn't declare; }To copy to clipboard, switch view to plain text mode
Regards
You can try to set the Namespaces attribute to false and see what happens. Another option is to reimplement LookupNamespace() method and make it always return some URI.
mickey (15th January 2008)
With first
it works;
Any more explaination about second option, please?
Regards
You have to declare namespaces before you can use them and you do this by adding special attribute:
This way the parser will know what "namespace" is. Such mechanism is useful when you embed one XML document in another (for example XHTML tags in XSLT stylesheet or SVG in DocBook) and still want to have a possibility to validate your document.Qt Code:
<element xmlns:namespace="http://unique.URI.for/namespace"> ... <namespace:someOtherElement /> ... </element>To copy to clipboard, switch view to plain text mode
The idea was to trick the parser and make it think, that it has already seen the namespace declaration.
mickey (15th January 2008)
Bookmarks