Validating NSXMLDocument with DTD that has ANY condition
Validating NSXMLDocument with DTD that has ANY condition
- Subject: Validating NSXMLDocument with DTD that has ANY condition
- From: Jesse Grosjean <email@hidden>
- Date: Wed, 29 Aug 2007 10:36:55 -0400
Now that I can ready my NSXMLDocument I'm trying to validate it. The
documents that I"m parsing are well defined, but one type of element
<extension> should be able to hold any kind of valid XML content. But
I'm not sure how to validate that, right now I'm getting errors from
[NSXMLDocument validateAndReturnError] anytime I use an element name
that isn't explicitly declared in my DTD. For example I get this error:
NSError "No declaration for element applicationWillFinishLaunching
No declaration for attribute class of element
applicationWillFinishLaunching
" Domain=NSXMLParserErrorDomain Code=1 UserInfo={
NSLocalizedDescription = "No declaration for element
applicationWillFinishLaunching\nNo declaration for attribute class of
element applicationWillFinishLaunching\n";
}
In a document that has a <applicationWillFinishLaunching> element
declared in the section that should allow ANY elements.
Does anyone know what I need to do to validate my document, but let
the children of one element type contain any valid XML?
Thanks,
Jesse
Below I've included the sample XML file that gets the above
validation error, and I've included the validating DTD below that.
----------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<plugin
id="com.blocks.BPreferences"
label="Preferences"
version="1.0.0"
info="Blocks Preferences">
<requirement bundle="com.blocks.Blocks"/>
<requirement bundle="com.blocks.BLifecycle"/>
<requirement bundle="com.blocks.BUserInterface"/>
<extension-point id="preferencePanes" />
<extension point="com.blocks.BLifecycle.lifecycle">
<applicationWillFinishLaunching class="BPreferencesController" />
</extension>
</plugin>
----------------------------------------------
<!ELEMENT plugin (requirement*, extension-point*, extension*)>
<!ATTLIST plugin
id CDATA #REQUIRED
label CDATA #REQUIRED
version CDATA #REQUIRED
info CDATA #IMPLIED
>
<!ELEMENT requirement EMPTY>
<!ATTLIST requirement
bundle CDATA #REQUIRED
version CDATA #IMPLIED
optional (true | false) "false"
>
<!ELEMENT extension-point EMPTY>
<!ATTLIST extension-point
id CDATA #REQUIRED
>
<!ELEMENT extension ANY>
<!ATTLIST extension
point CDATA #REQUIRED
>
_______________________________________________
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