Search code examples
xmlspringconfigurationstruts2struts

Why Spring config file must define DTD and XSD but Struts config file does not


I have went thru articles about DTD and XSD they are basically define structure with list of legal element and attribute, so as far as spring is concerned it is okay we must follow some guide lines so everyone must work under it. but as for struts how this kind of dependencies are managed, because in the context of MVC, spring and struts are like figuratively same.Here, which thread i am missing?

Any Shareable bit of it is highly appreciated.

Edited: This is the spring config file declaration

<?xml version="1.0" encoding="UTF-8"?>

<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">

and this is for struts config file

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE struts PUBLIC
 "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
 "http://struts.apache.org/dtds/struts-2.0.dtd">

now see in spring config file namespace 'xsi' and schemalocation for it which is define by spring but no such thing for struts config only struts dtd which is defined by struts.


Solution

  • Abbreviations mean

    are different languages but both are used to define the structure of the document and validate its contents. Using either of them enough to validate a document. Using DTD you can convert it to XSD and otherwise. It doesn't matter DTD or XSD is used to describe XML document.

    However, the main difference between DTD and XSD the last is itself XML document rather than the first is not.

    Spring and Struts are different and use different XML definitions of the XML documents, but it's not only one difference.