Bug 4509 – XML parser in std.xml throws TagException if the attr value is put in apostrophes.
Status
RESOLVED
Resolution
FIXED
Severity
major
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
x86
OS
Linux
Creation time
2010-07-26T10:24:00Z
Last change time
2016-10-01T11:46:10Z
Keywords
pull
Assigned to
abhishekkmr18
Creator
the.mail.of.mi2
Comments
Comment #0 by the.mail.of.mi2 — 2010-07-26T10:24:43Z
The best way to illustrate this error is this code:
[code]
import std.xml;
void main()
{
string goesRight = `<?xml version='1.0' encoding='UTF-8'?><stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" from="jid.pl" id="587a5767" xml:lang="en" version="1.0"></stream:stream>`;
string goesWrong = `<?xml version='1.0' encoding='UTF-8'?><stream:stream xmlns:stream='http://etherx.jabber.org/streams' xmlns='jabber:client' from='jid.pl' id='587a5767' xml:lang='en' version='1.0'></stream:stream>`;
DocumentParser parser = new DocumentParser(goesRight);
}
[/code]
It creates a DocumentParser object and shuts down. But when change the constructor argument to goesWrong (the only difference between the two strings are " changed to '. Please note that in the prologue it doesn't matter), it results in TagError.
Comment #1 by lt.infiltrator — 2015-10-31T14:36:10Z
Still exists in 2.068.
Backtrace (lacking line numbers, sadly):
std.xml.TagException@std/xml.d(2743): <stream:stream xmlns:stream=
----------------
./test(void std.xml.ElementParser.parse()+0x2ba) [0x809910a]
./test(std.xml.DocumentParser std.xml.DocumentParser.__ctor(immutable(char)[])+0x33) [0x8098d33]
./test(_Dmain+0x38) [0x80935b8]
./test(_D2rt6dmain211_d_run_mainUiPPaPUAAaZiZ6runAllMFZ9__lambda1MFZv+0x12) [0x8094d82]
./test(void rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).tryExec(scope void delegate())+0x18) [0x8094cf0]
./test(void rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).runAll()+0x27) [0x8094d47]
./test(void rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).tryExec(scope void delegate())+0x18) [0x8094cf0]
./test(_d_run_main+0x166) [0x8094c86]
./test(main+0x14) [0x8093634]
/lib/i386-linux-gnu/i686/cmov/libc.so.6(__libc_start_main+0xf3) [0xb75b4a63]
Comment #2 by abhishekkmr18 — 2016-03-08T06:59:54Z