Re: Xml
Re: Xml
- Subject: Re: Xml
- From: "Gerriet M. Denkmann" <email@hidden>
- Date: Tue, 4 Nov 2008 17:49:35 +0100
On 4 Nov 2008, at 00:57, Klaus Backert wrote:
Am 03.11.2008 um 23:09 schrieb Gerriet M. Denkmann:
I do:
NSXMLDocument *xmlDoc = ...
NSData *data = [ xmlDoc XMLDataWithOptions: NSXMLNodePrettyPrint |
NSXMLNodeCompactEmptyElement ];
This <data> looks like:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!DOCTYPE [
<!ELEMENT geometry (vertices)>
<!ATTLIST geometry version CDATA "1.0">
<!ELEMENT vertices (vertex)*>
<!ELEMENT vertex EMPTY> <---- new as of today
<!ATTLIST vertex name CDATA "none">
<!ATTLIST vertex x CDATA "nan">
<!ATTLIST vertex y CDATA "nan">
<!ATTLIST vertex z CDATA "nan">
]>
<geometry version="1.3">
<vertices>
<vertex name="0" x="0" y="9" z="0"/>
<vertex name="1" x="0" y="-9" z="0"/>
</vertices>
</geometry>
So far so good(?)
When I do [ xmlDoc validateAndReturnError: &error ] I get "no DTD
found!". Why?
And when I do:
NSXMLParser *parser = [ [ NSXMLParser alloc ] initWithData: data ];
[ parser parse];
I get:
parserDidStartDocument
NSXMLParserErrorDomain 68 = NSXMLParserNAMERequiredError
Obviously I am doing something (or several things) not right. But
what?
I'm not sure, if this has to do with the error mentioned above, but
isn't the vertex element declaration <!ELEMENT vertex ...> missing?
You are absolutely right.
I did have an element declaration, but the "EMPTY" was missing - and
so it was silently ignored by NSXMLDTD.
Now my corrected Dtd contains:
<!ELEMENT vertex EMPTY>
Looks better, but both problems still persist: "no DTD found!" and
NSXMLParserNAMERequiredError.
Any ideas?
Kind regards,
Gerriet.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
- Follow-Ups:
- Re: Xml
- From: Klaus Backert <email@hidden>
References: | |
| >Xml (From: "Gerriet M. Denkmann" <email@hidden>) |
| >Re: Xml (From: Klaus Backert <email@hidden>) |