Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Debut de validateur

  • Loading branch information...
commit e9e272bea18218b44c334870563eda3b5379a74e 1 parent 81922aa
@tpatel tpatel authored
View
6 dtd/makefile
@@ -4,11 +4,11 @@ EXE = dtd
CXXFLAGS = -g
LDFLAGS =
-all: xml
+all: dtd
-xml: Document.o Attribute.o Element.o TestPut.o
- $(LD) -o $(EXE) $^ $(LDFLAGS)
+dtd: Document.o Attribute.o Element.o
+# $(LD) -o $(EXE) $^ $(LDFLAGS)
%.o: %.cpp %.hpp
$(CXX) -o $@ -c $< $(CXXFLAGS)
View
45 validation/Test.cpp
@@ -0,0 +1,45 @@
+#include "Validateur.hpp"
+#include "../dtd/Document.hpp"
+#include "../dtd/Element.hpp"
+#include "../dtd/Attribute.hpp"
+#include <iostream>
+#include <list>
+
+int main(int argc, char** argv) {
+ //Création du doc dtd
+ dtd::Name *n = new dtd::Name("Test");
+ dtd::Name *n2 = new dtd::Name("Test2");
+ dtd::Name *n3 = new dtd::Name("Test3");
+ dtd::Name *n4 = new dtd::Name("Test4");
+
+ std::list<dtd::Children*> l;
+ l.push_back(n);
+ l.push_back(n2);
+ dtd::Choice *c = new dtd::Choice(l);
+
+ std::list<dtd::Children*> l2;
+ l2.push_back(n3);
+ l2.push_back(c);
+ l2.push_back(n4);
+ dtd::Seq *s = new dtd::Seq(l2);
+
+ dtd::Element *e = new dtd::Element("ElemTest", s);
+
+ std::list<std::string> att;
+ att.push_back("att1");
+ att.push_back("att2");
+ dtd::Attribute *a = new dtd::Attribute("AttTest", att);
+
+ std::list<dtd::Declaration*> decl;
+ decl.push_back(e);
+ decl.push_back(a);
+ dtd::Document *d = new dtd::Document(decl);
+
+ std::cout << d << std::endl;
+
+ delete d;
+
+
+
+ return 0;
+}
View
13 validation/Validateur.cpp
@@ -0,0 +1,13 @@
+#include "validateur.hpp"
+
+bool Validateur::validationNode(std::string dtdNode, std::string xmlChildren) {
+ //TODO: check boost entre dtdNode (regex) et xmlChildren (text)
+}
+
+bool Validateur::validationDocument(xml::Document xml, dtd::Document dtd) {
+ //TODO: parcourir tout l'arbre xml
+ //pour chacun des noeuds xml
+ //Faire un getRegex sur l'élément de la dtd correspondant
+ //Faire la chaine XML
+ //appeller validationNode et stopped si ça retourne false
+}
View
16 validation/Validateur.hpp
@@ -0,0 +1,16 @@
+#ifndef VALIDATEUR_HPP
+#define VALIDATEUR_HPP
+#include <iostream>
+#include "../dtd/Document.hpp"
+#include "../xml/Document.hpp"
+
+class Validateur {
+
+public:
+ bool validationNode(std::string dtdNode, std::string xmlChildren); //Validation d'un noeud
+
+ bool validationDocument(xml::Document xml, dtd::Document dtd); //Validation du document
+};
+
+#endif
+
View
29 validation/makefile
@@ -0,0 +1,29 @@
+CXX = g++
+CXXFLAGS = -Wall #-Werror -pedantic
+EXEC_NAME = main
+INCLUDES =
+LIBS =
+OBJ_FILES = Test.o
+OBJ_FILES_DEP = ../xml/*.o ../dtd/*.o
+
+XML_REP = ../xml/
+DTD_REP = ../dtd/
+
+all: $(EXEC_NAME)
+
+.PHONY: clean rebuild
+
+clean:
+ make clean -C $(XML_REP)
+ make clean -C $(DTD_REP)
+ rm $(EXEC_NAME) $(OBJ_FILES)
+
+rebuild: clean all
+
+$(EXEC_NAME): $(OBJ_FILES)
+ make -C $(XML_REP)
+ make -C $(DTD_REP)
+ $(CXX) -o $(EXEC_NAME) $(OBJ_FILES) $(OBJ_FILES_DEP) $(LIBS)
+
+%.o: %.cpp
+ $(CXX) $(CXXFLAGS) $(INCLUDES) -o $@ -c $<
Please sign in to comment.
Something went wrong with that request. Please try again.