libxml dtd
BlitzMax Forums/Brucey's Modules/libxml dtd
| ||
| Try as I might, I just CAN'T understand where <!DOCTYPE x SYSTEM "x"> is supposed to start from. Is it relative to the exe, the current file?? My DTD is located in Data\XML\DTD, relative to the exe. My files are located in Data\Worlds If I have a space in their file name, I need to use <!DOCTYPE world SYSTEM "Data/XML/DTD/World.dtd"> If I don't have a space in their file name, I need to use <!DOCTYPE world SYSTEM "../../Data/XML/DTD/World.dtd"> ???????????????????????????????????????????? It's very annoying!!!!!!!!!!!! Last edited 2011 |
| ||
Function validate:Int(filename:String) Local reader:TxmlTextReader = TxmlTextReader.fromFile(filename) reader.setParserProp(XML_PARSER_VALIDATE, 1) reader.setParserProp(XML_PARSER_LOADDTD, 1) Local ret = reader.read() While ret = 1 ret = reader.read() Wend reader.free() If ret <> 0 Then Return False End If Return True End Function Fixed this issue. Corrected code: Function validate:Int(filename:String) Local reader:TxmlTextReader = TxmlTextReader.fromFile(filename) reader.setParserProp(XML_PARSER_VALIDATE, 1) reader.setParserProp(XML_PARSER_LOADDTD, 1) Local ret = reader.read() While ret = 1 ret = reader.read() Wend If ret <> 0 Or (Not reader.isValid()) Then reader.free() Return False End If reader.free() Return True End Function Still having the above issue though. Last edited 2011 |
| ||
| I'm sorry for not being more courtious, I know you work on these modules in your spare time and I'm really thankful for all the hard work you put into the Blitz community. If you could look at this issue I would really appreciate it, as it is causing users problems if they put a space into their file names and I can't understand why. Thank you. Last edited 2011 |
| ||
| Well, interestingly, I seem to need to use ../../ for things to work properly on Mac... I have this setup :
test.bmx
data/
xml/
test.xml
dtds/
test.dtd
In my test.xml, to use relative uris, I need to set the path as : <!DOCTYPE note SYSTEM "../../data/dtds/test.dtd"> If I leave out the "../../", I get this :
Executing:test.debug
Resolve: sysID data/xml/data/dtds/test.dtd
Failed to parse catalog file:///etc/xml/catalog
Resolve URI data/xml/data/dtds/test.dtd
data/xml/test.xml:2: I/O error : failed to load external entity "data/xml/data/dtds/test.dtd"
<!DOCTYPE note SYSTEM "data/dtds/test.dtd">
^
data/xml/test.xml:3: validity error : Validation failed: no DTD found !
<note>
^
In the file catalog.c, there is this line : static int xmlDebugCatalogs = 0; /* used for debugging */ You can set it to 1 to get some more verbose output. When it is set to zero (default), I see this :
Executing:test.debug
data/xml/test.xml:2: I/O error : failed to load external entity "data/xml/data/dtds/test.dtd"
<!DOCTYPE note SYSTEM "data/dtds/test.dtd">
^
data/xml/test.xml:3: validity error : Validation failed: no DTD found !
<note>
^
Which is similar, but shows a bit less of what it was trying to do under-the-hood. Windows *should* perform in the same way, but I'll need to set it up there to see if there are any important differences... |