Lines 22-27
Link Here
|
22 |
import org.xml.sax.helpers.LocatorImpl; |
22 |
import org.xml.sax.helpers.LocatorImpl; |
23 |
|
23 |
|
24 |
import org.apache.xerces.xni.*; |
24 |
import org.apache.xerces.xni.*; |
|
|
25 |
import org.apache.xerces.xni.parser.XMLDTDSource; |
26 |
import org.apache.xerces.xni.parser.XMLDTDContentModelSource; |
27 |
import org.apache.xerces.xni.parser.XMLDocumentSource; |
25 |
import org.apache.xerces.parsers.*; |
28 |
import org.apache.xerces.parsers.*; |
26 |
|
29 |
|
27 |
import org.netbeans.tax.*; |
30 |
import org.netbeans.tax.*; |
Lines 42-48
Link Here
|
42 |
* be needed (JAXP validation on request could be a good approach). |
45 |
* be needed (JAXP validation on request could be a good approach). |
43 |
* |
46 |
* |
44 |
* @author Petr Kuzel |
47 |
* @author Petr Kuzel |
45 |
* @version in progress... |
48 |
* @version rewritten to XNI 2.4.0 |
46 |
*/ |
49 |
*/ |
47 |
public final class XNIBuilder implements TreeBuilder { |
50 |
public final class XNIBuilder implements TreeBuilder { |
48 |
|
51 |
|
Lines 116-122
Link Here
|
116 |
builder.setFeature (SAX_FEATURE + "external-general-entities", true); // NOI18N |
119 |
builder.setFeature (SAX_FEATURE + "external-general-entities", true); // NOI18N |
117 |
builder.setFeature (SAX_FEATURE + "external-parameter-entities", true); // NOI18N |
120 |
builder.setFeature (SAX_FEATURE + "external-parameter-entities", true); // NOI18N |
118 |
builder.setFeature (XERCES_FEATURE + "validation/warn-on-duplicate-attdef", true); // NOI18N |
121 |
builder.setFeature (XERCES_FEATURE + "validation/warn-on-duplicate-attdef", true); // NOI18N |
119 |
builder.setFeature (XERCES_FEATURE + "validation/warn-on-undeclared-elemdef", true); // NOI18N |
122 |
// unrecognized in Xerces 2.4.0 |
|
|
123 |
//builder.setFeature (XERCES_FEATURE + "validation/warn-on-undeclared-elemdef", true); // NOI18N |
120 |
builder.setFeature (XERCES_FEATURE + "allow-java-encodings", true); // NOI18N |
124 |
builder.setFeature (XERCES_FEATURE + "allow-java-encodings", true); // NOI18N |
121 |
builder.setFeature (XERCES_FEATURE + "scanner/notify-char-refs", true); // NOI18N |
125 |
builder.setFeature (XERCES_FEATURE + "scanner/notify-char-refs", true); // NOI18N |
122 |
builder.setFeature (XERCES_FEATURE + "scanner/notify-builtin-refs", true); // NOI18N |
126 |
builder.setFeature (XERCES_FEATURE + "scanner/notify-builtin-refs", true); // NOI18N |
Lines 272-277
Link Here
|
272 |
|
276 |
|
273 |
private RememberingReader rememberingReader; |
277 |
private RememberingReader rememberingReader; |
274 |
|
278 |
|
|
|
279 |
private XMLDTDSource xmldtdSource; // XMLDTDHandler 2.4.0 |
280 |
|
281 |
private XMLDTDContentModelSource xmldtdContentModelSource; // XMLDTDContentModelHandler 2.4.0 |
282 |
|
283 |
private XMLDocumentSource xmlDocumentSource; // XMLDocumentHanlder 2.4.0 |
275 |
|
284 |
|
276 |
/** |
285 |
/** |
277 |
* Create a parser with standard configuration. |
286 |
* Create a parser with standard configuration. |
Lines 308-322
Link Here
|
308 |
super.parse (in); |
317 |
super.parse (in); |
309 |
} |
318 |
} |
310 |
|
319 |
|
|
|
320 |
|
311 |
// |
321 |
// |
312 |
// XMLDocumentHandler methods |
322 |
// XMLDocumentHandler methods |
313 |
// |
323 |
// |
314 |
|
324 |
|
|
|
325 |
public XMLDocumentSource getDocumentSource() { |
326 |
return xmlDocumentSource; |
327 |
} |
328 |
|
329 |
public void setDocumentSource(XMLDocumentSource src) { |
330 |
xmlDocumentSource = src; |
331 |
} |
332 |
|
333 |
// XMLDocumentHandler 2.4.0 |
334 |
public void startDocument (XMLLocator locator, String encoding, NamespaceContext nsCtx, Augmentations a) { |
335 |
startDocument(locator, encoding, a); |
336 |
} |
337 |
|
315 |
/** |
338 |
/** |
316 |
* The start of the document. |
339 |
* The start of the document. |
317 |
* |
340 |
* |
318 |
* @throws SAXException Thrown by handler to signal an error. |
341 |
* @throws SAXException Thrown by handler to signal an error. |
319 |
*/ |
342 |
*/ |
|
|
343 |
// XMLDocumentHandler 2.0.0b4 |
320 |
public void startDocument (XMLLocator locator, String encoding, Augmentations a) { |
344 |
public void startDocument (XMLLocator locator, String encoding, Augmentations a) { |
321 |
|
345 |
|
322 |
trace ("startDocument()"); // NOI18N |
346 |
trace ("startDocument()"); // NOI18N |
Lines 354-359
Link Here
|
354 |
} // xmlDecl(String,String,String) |
378 |
} // xmlDecl(String,String,String) |
355 |
|
379 |
|
356 |
|
380 |
|
|
|
381 |
// XMLDTDHandler 2.4.0 and XMLDocumentHandler > 2.0.0b4 |
357 |
public void textDecl (String version, String encoding, Augmentations a) { |
382 |
public void textDecl (String version, String encoding, Augmentations a) { |
358 |
|
383 |
|
359 |
trace ("textDecl()"); // NOI18N |
384 |
trace ("textDecl()"); // NOI18N |
Lines 368-374
Link Here
|
368 |
} |
393 |
} |
369 |
} |
394 |
} |
370 |
|
395 |
|
371 |
//??? DTDHAndler |
396 |
// XMLDTDHAndler 2.0.0b4 |
372 |
public void textDecl (String version, String encoding) { |
397 |
public void textDecl (String version, String encoding) { |
373 |
textDecl(version, encoding, null); |
398 |
textDecl(version, encoding, null); |
374 |
} |
399 |
} |
Lines 696-702
Link Here
|
696 |
} // characters(XMLString) |
721 |
} // characters(XMLString) |
697 |
|
722 |
|
698 |
|
723 |
|
699 |
//??? DTDHandler |
724 |
// XMLDTDHandler 2.4.0 |
|
|
725 |
public void ignoredCharacters (XMLString text, Augmentations a) { |
726 |
characters( text, null); |
727 |
} |
728 |
|
729 |
// XMLDTDHandler 2.0.0b4 |
700 |
public void characters (XMLString text) { |
730 |
public void characters (XMLString text) { |
701 |
characters( text, null); |
731 |
characters( text, null); |
702 |
} |
732 |
} |
Lines 729-735
Link Here
|
729 |
} |
759 |
} |
730 |
} // endElement(QName) |
760 |
} // endElement(QName) |
731 |
|
761 |
|
732 |
|
|
|
733 |
/** |
762 |
/** |
734 |
* The start of a CDATA section. Buffer its content. |
763 |
* The start of a CDATA section. Buffer its content. |
735 |
*/ |
764 |
*/ |
Lines 782-794
Link Here
|
782 |
// not interested |
811 |
// not interested |
783 |
} |
812 |
} |
784 |
|
813 |
|
|
|
814 |
// XMLDTDHandler 2.4.0 |
815 |
public void startExternalSubset(XMLResourceIdentifier entity, Augmentations a) { |
816 |
startEntity( |
817 |
"[dtd]", entity.getPublicId(), entity.getLiteralSystemId(), |
818 |
entity.getBaseSystemId(), null, a |
819 |
); |
820 |
} |
821 |
|
822 |
public void startGeneralEntity(String name, XMLResourceIdentifier entity, String encoding, Augmentations a) { |
823 |
startEntity( |
824 |
name, entity.getPublicId(), entity.getLiteralSystemId(), |
825 |
entity.getBaseSystemId(), encoding, a |
826 |
); |
827 |
} |
828 |
|
785 |
/** |
829 |
/** |
786 |
* This method notifies of the start of an entity. The document entity |
830 |
* This method notifies of the start of an entity. The document entity |
787 |
* has the pseudo-name of "[xml]"; The DTD has the pseudo-name of "[dtd]; |
831 |
* has the pseudo-name of "[xml]"; The DTD has the pseudo-name of "[dtd]; |
788 |
* parameter entity names start with '%'; and general entity names are |
832 |
* parameter entity names start with '%'; and general entity names are |
789 |
* just the entity name. |
833 |
* just the entity name. |
|
|
834 |
* |
835 |
* @param encoding special value of "IGNORE" markg parameter |
836 |
* entities in DTD markup (these are ignored) |
790 |
*/ |
837 |
*/ |
791 |
public void startEntity (String name, String publicId, String systemId, |
838 |
private void startEntity (String name, String publicId, String systemId, |
792 |
String baseSystemId, String encoding, Augmentations a) { |
839 |
String baseSystemId, String encoding, Augmentations a) { |
793 |
|
840 |
|
794 |
trace ("startEntity(" + name + ")"); // NOI18N |
841 |
trace ("startEntity(" + name + ")"); // NOI18N |
Lines 868-882
Link Here
|
868 |
} // startEntity(String,String,String,String) |
915 |
} // startEntity(String,String,String,String) |
869 |
|
916 |
|
870 |
|
917 |
|
871 |
//??? DTDHandler |
918 |
// XMLDTDHandler 2.0.0b4 |
872 |
public void startEntity (String name, String publicId, String systemId, |
919 |
public void startEntity (String name, String publicId, String systemId, |
873 |
String baseSystemId, String encoding) { |
920 |
String baseSystemId, String encoding) { |
874 |
startEntity(name, publicId, systemId, baseSystemId, encoding, null); |
921 |
startEntity(name, publicId, systemId, baseSystemId, encoding, null); |
875 |
} |
922 |
} |
876 |
|
923 |
|
|
|
924 |
// XMLDTDHanlder 2.4.0 |
925 |
public void startParameterEntity(String name, XMLResourceIdentifier entity, String encoding, Augmentations a) { |
926 |
String pname = name; |
927 |
if (false == name.startsWith("%")) { |
928 |
pname = "%" + name; |
929 |
} |
930 |
startEntity( |
931 |
pname, entity.getPublicId(), entity.getLiteralSystemId(), |
932 |
entity.getBaseSystemId(), encoding, a |
933 |
); |
934 |
} |
935 |
|
877 |
/** |
936 |
/** |
878 |
* A comment. |
937 |
* A comment. |
879 |
*/ |
938 |
*/ |
|
|
939 |
// XMLDTDHandler 2.4.0 and XMLDocumentHandler |
880 |
public void comment (XMLString text, Augmentations a) { |
940 |
public void comment (XMLString text, Augmentations a) { |
881 |
|
941 |
|
882 |
trace ("comment()"); // NOI18N |
942 |
trace ("comment()"); // NOI18N |
Lines 890-896
Link Here
|
890 |
} |
950 |
} |
891 |
} // comment(XMLString) |
951 |
} // comment(XMLString) |
892 |
|
952 |
|
893 |
//??? DTDHandler |
953 |
// XMLDTDHandler 2.0.0b4 |
894 |
public void comment (XMLString text) { |
954 |
public void comment (XMLString text) { |
895 |
comment(text, null); |
955 |
comment(text, null); |
896 |
} |
956 |
} |
Lines 900-905
Link Here
|
900 |
* target name and, optionally, text data. The data is only meaningful |
960 |
* target name and, optionally, text data. The data is only meaningful |
901 |
* to the application. |
961 |
* to the application. |
902 |
*/ |
962 |
*/ |
|
|
963 |
// XMLDTDHandler 2.4.0 and XMLDocumentHandler > 2.0.0b4 |
903 |
public void processingInstruction (String target, XMLString data, Augmentations a) { |
964 |
public void processingInstruction (String target, XMLString data, Augmentations a) { |
904 |
|
965 |
|
905 |
trace ("processingInstruction(" + target + ")"); // NOI18N |
966 |
trace ("processingInstruction(" + target + ")"); // NOI18N |
Lines 913-930
Link Here
|
913 |
} |
974 |
} |
914 |
} // processingInstruction(String,XMLString) |
975 |
} // processingInstruction(String,XMLString) |
915 |
|
976 |
|
916 |
//??? DTDHandler |
977 |
// XMLDTDHandler 2.0.0b4 |
917 |
public void processingInstruction (String target, XMLString data) { |
978 |
public void processingInstruction (String target, XMLString data) { |
918 |
processingInstruction( target, data, null); |
979 |
processingInstruction( target, data, null); |
919 |
} |
980 |
} |
920 |
|
981 |
|
|
|
982 |
// XMLDTDHandler 2.4.0 |
983 |
public void endExternalSubset(Augmentations a) { |
984 |
endEntity("[dtd]", a); |
985 |
} |
986 |
|
987 |
// XMLDTDHandler 2.4.0 |
988 |
public void endParameterEntity(String name, Augmentations a) { |
989 |
String pname = name; |
990 |
if (false == name.startsWith("%")) { |
991 |
pname = "%" + name; |
992 |
} |
993 |
endEntity(pname, a); |
994 |
} |
995 |
|
996 |
public void endGeneralEntity(String name, Augmentations a) { |
997 |
endEntity(name, a); |
998 |
} |
999 |
|
921 |
/** |
1000 |
/** |
922 |
* This method notifies the end of an entity. The document entity has |
1001 |
* This method notifies the end of an entity. The document entity has |
923 |
* the pseudo-name of "[xml]"; the DTD has the pseudo-name of "[dtd]; |
1002 |
* the pseudo-name of "[xml]"; the DTD has the pseudo-name of "[dtd]; |
924 |
* parameter entity names start with '%'; and general entity names are |
1003 |
* parameter entity names start with '%'; and general entity names are |
925 |
* just the entity name. |
1004 |
* just the entity name. |
926 |
*/ |
1005 |
*/ |
927 |
public void endEntity (String name, Augmentations a) { |
1006 |
private void endEntity (String name, Augmentations a) { |
928 |
trace ("endEntity(" + name + ")"); // NOI18N |
1007 |
trace ("endEntity(" + name + ")"); // NOI18N |
929 |
|
1008 |
|
930 |
// skip for root entities of XML documents and |
1009 |
// skip for root entities of XML documents and |
Lines 954-964
Link Here
|
954 |
endEntity(name, null); |
1033 |
endEntity(name, null); |
955 |
} |
1034 |
} |
956 |
|
1035 |
|
957 |
// ~~~~~~~~~~~~~ XMLDTDHandler methods ~~~~~~~~~~~~~~~~~~~~~~~~~ |
1036 |
// XMLDTDHandler methods ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
|
1037 |
|
1038 |
// XMLDTDHandler 2.4.0 |
1039 |
public XMLDTDSource getDTDSource() { |
1040 |
return xmldtdSource; |
1041 |
} |
1042 |
|
1043 |
// XMLDTDHandler 2.4.0 |
1044 |
public void setDTDSource( XMLDTDSource src) { |
1045 |
xmldtdSource = src; |
1046 |
} |
1047 |
|
1048 |
// XMLDTDHandler 2.0.0b4 |
1049 |
public void startDTD ( XMLLocator locator, Augmentations a) { |
1050 |
startDTD(locator); |
1051 |
} |
958 |
|
1052 |
|
959 |
/** |
1053 |
/** |
960 |
* The start of the DTD (external part of it is reported by startEntity). |
1054 |
* The start of the DTD (external part of it is reported by startEntity). |
961 |
*/ |
1055 |
*/ |
|
|
1056 |
// XMLDTDHandler 2.0.0b4 |
962 |
public void startDTD ( XMLLocator locator) { |
1057 |
public void startDTD ( XMLLocator locator) { |
963 |
trace ("startDTD()"); // NOI18N |
1058 |
trace ("startDTD()"); // NOI18N |
964 |
|
1059 |
|
Lines 980-988
Link Here
|
980 |
} |
1075 |
} |
981 |
} // startDTD() |
1076 |
} // startDTD() |
982 |
|
1077 |
|
|
|
1078 |
// XMLDTDHandler 2.4.0 |
1079 |
public void elementDecl (String name, String contentModel, Augmentations a) { |
1080 |
elementDecl(name, contentModel); |
1081 |
} |
1082 |
|
983 |
/** |
1083 |
/** |
984 |
* An element declaration. |
1084 |
* An element declaration. |
985 |
*/ |
1085 |
*/ |
|
|
1086 |
// XMLDTDHandler 2.0.0b4 |
986 |
public void elementDecl (String name, String cM) { |
1087 |
public void elementDecl (String name, String cM) { |
987 |
trace ("elementDecl(" + name + ")"); // NOI18N |
1088 |
trace ("elementDecl(" + name + ")"); // NOI18N |
988 |
if (ASSERT) |
1089 |
if (ASSERT) |
Lines 997-1005
Link Here
|
997 |
|
1098 |
|
998 |
} // elementDecl(String,String) |
1099 |
} // elementDecl(String,String) |
999 |
|
1100 |
|
|
|
1101 |
// XMLDTDHandler 2.4.0 |
1102 |
public void startAttlist (String elementName, Augmentations a) { |
1103 |
startAttlist(elementName); |
1104 |
} |
1105 |
|
1000 |
/** |
1106 |
/** |
1001 |
* The start of an attribute list. |
1107 |
* The start of an attribute list. |
1002 |
*/ |
1108 |
*/ |
|
|
1109 |
// XMLDTDHandler 2.0.0b4 |
1003 |
public void startAttlist (String elementName) { |
1110 |
public void startAttlist (String elementName) { |
1004 |
|
1111 |
|
1005 |
trace ("startAttlist(" + elementName + ")"); // NOI18N |
1112 |
trace ("startAttlist(" + elementName + ")"); // NOI18N |
Lines 1013-1021
Link Here
|
1013 |
} |
1120 |
} |
1014 |
} // startAttlist(String) |
1121 |
} // startAttlist(String) |
1015 |
|
1122 |
|
|
|
1123 |
// XMLDTDHandler 2.4.0 |
1124 |
public void attributeDecl(String elementName, String attributeName, |
1125 |
String type, String[] enumeration, |
1126 |
String defaultType, XMLString defaultValue, |
1127 |
XMLString nonNormalizedDefaultValue, Augmentations a) { |
1128 |
attributeDecl( |
1129 |
elementName, attributeName, type, |
1130 |
enumeration, defaultType, defaultValue |
1131 |
); |
1132 |
} |
1133 |
|
1016 |
/** |
1134 |
/** |
1017 |
* An attribute declaration. |
1135 |
* An attribute declaration. |
1018 |
*/ |
1136 |
*/ |
|
|
1137 |
// XMLDTDHandler 2.0.0b4 |
1019 |
public void attributeDecl (String elementName, String attributeName, |
1138 |
public void attributeDecl (String elementName, String attributeName, |
1020 |
String type, String[] enumeration, |
1139 |
String type, String[] enumeration, |
1021 |
String defaultType, XMLString defaultValue) { |
1140 |
String defaultType, XMLString defaultValue) { |
Lines 1051-1059
Link Here
|
1051 |
} |
1170 |
} |
1052 |
} // attributeDecl(String,String,String,String[],String,XMLString) |
1171 |
} // attributeDecl(String,String,String,String[],String,XMLString) |
1053 |
|
1172 |
|
|
|
1173 |
// XMLDTDHandler 2.4.0 |
1174 |
public void endAttlist (Augmentations a) { |
1175 |
endAttlist(); |
1176 |
} |
1177 |
|
1054 |
/** |
1178 |
/** |
1055 |
* The end of an attribute list. |
1179 |
* The end of an attribute list. |
1056 |
*/ |
1180 |
*/ |
|
|
1181 |
// XMLDTDHandler 2.0.0b4 |
1057 |
public void endAttlist () { |
1182 |
public void endAttlist () { |
1058 |
|
1183 |
|
1059 |
trace ("endAttlist()"); // NOI18N |
1184 |
trace ("endAttlist()"); // NOI18N |
Lines 1061-1066
Link Here
|
1061 |
attlistDecl = null; |
1186 |
attlistDecl = null; |
1062 |
} // endAttlist() |
1187 |
} // endAttlist() |
1063 |
|
1188 |
|
|
|
1189 |
// XMLDTDHandler 2.4.0 |
1190 |
public void internalEntityDecl (String name, XMLString text, XMLString nonNormalizedText, Augmentations a) { |
1191 |
internalEntityDecl(name, text, nonNormalizedText); |
1192 |
} |
1193 |
|
1064 |
/** |
1194 |
/** |
1065 |
* An internal entity declaration. |
1195 |
* An internal entity declaration. |
1066 |
* |
1196 |
* |
Lines 1068-1073
Link Here
|
1068 |
* '%', whereas the name of a general entity is just the |
1198 |
* '%', whereas the name of a general entity is just the |
1069 |
* entity name. |
1199 |
* entity name. |
1070 |
*/ |
1200 |
*/ |
|
|
1201 |
// XMLDTDHandler 2.0.0b4 |
1071 |
public void internalEntityDecl (String name, XMLString text, XMLString nonNormalizedText) { |
1202 |
public void internalEntityDecl (String name, XMLString text, XMLString nonNormalizedText) { |
1072 |
|
1203 |
|
1073 |
trace ("internalEntityDecl(" + name + ")"); // NOI18N |
1204 |
trace ("internalEntityDecl(" + name + ")"); // NOI18N |
Lines 1083-1088
Link Here
|
1083 |
} |
1214 |
} |
1084 |
} // internalEntityDecl(String,XMLString) |
1215 |
} // internalEntityDecl(String,XMLString) |
1085 |
|
1216 |
|
|
|
1217 |
// XMLDTDHandler 2.4.0 |
1218 |
public void externalEntityDecl (String name, String publicId, |
1219 |
String systemId, String baseSystemId, Augmentations a) { |
1220 |
externalEntityDecl( name, publicId, systemId, baseSystemId); |
1221 |
} |
1222 |
|
1086 |
/** |
1223 |
/** |
1087 |
* An external entity declaration. |
1224 |
* An external entity declaration. |
1088 |
* |
1225 |
* |
Lines 1090-1095
Link Here
|
1090 |
* with '%', whereas the name of a general entity is just |
1227 |
* with '%', whereas the name of a general entity is just |
1091 |
* the entity name. |
1228 |
* the entity name. |
1092 |
*/ |
1229 |
*/ |
|
|
1230 |
// XMLDTDHandler 2.0.0b4 |
1093 |
public void externalEntityDecl (String name, String publicId, |
1231 |
public void externalEntityDecl (String name, String publicId, |
1094 |
String systemId, String baseSystemId) { |
1232 |
String systemId, String baseSystemId) { |
1095 |
|
1233 |
|
Lines 1107-1115
Link Here
|
1107 |
} |
1245 |
} |
1108 |
} // externalEntityDecl(String,String,String) |
1246 |
} // externalEntityDecl(String,String,String) |
1109 |
|
1247 |
|
|
|
1248 |
// XMLDTDHAnlder 2.4.0 |
1249 |
public void unparsedEntityDecl (String name, |
1250 |
String publicId, String systemId, |
1251 |
String notation, Augmentations a) { |
1252 |
unparsedEntityDecl(name, publicId, systemId, notation); |
1253 |
} |
1254 |
|
1110 |
/** |
1255 |
/** |
1111 |
* An unparsed entity declaration. |
1256 |
* An unparsed entity declaration. |
1112 |
*/ |
1257 |
*/ |
|
|
1258 |
// XMLDTDHAnlder 2.0.0b4 |
1113 |
public void unparsedEntityDecl (String name, |
1259 |
public void unparsedEntityDecl (String name, |
1114 |
String publicId, String systemId, |
1260 |
String publicId, String systemId, |
1115 |
String notation) { |
1261 |
String notation) { |
Lines 1123-1131
Link Here
|
1123 |
} |
1269 |
} |
1124 |
} // unparsedEntityDecl(String,String,String,String) |
1270 |
} // unparsedEntityDecl(String,String,String,String) |
1125 |
|
1271 |
|
|
|
1272 |
// XMLDTDHandler 2.4.0 |
1273 |
public void notationDecl (String name, String publicId, String systemId, Augmentations a) { |
1274 |
notationDecl(name, publicId, systemId); |
1275 |
} |
1276 |
|
1126 |
/** |
1277 |
/** |
1127 |
* A notation declaration |
1278 |
* A notation declaration |
1128 |
*/ |
1279 |
*/ |
|
|
1280 |
// XMLDTDHandler 2.0.0b4 |
1129 |
public void notationDecl (String name, String publicId, String systemId) { |
1281 |
public void notationDecl (String name, String publicId, String systemId) { |
1130 |
|
1282 |
|
1131 |
trace ("notationDecl(" + name + ")"); // NOI18N |
1283 |
trace ("notationDecl(" + name + ")"); // NOI18N |
Lines 1137-1148
Link Here
|
1137 |
} |
1289 |
} |
1138 |
} // notationDecl(String,String,String) |
1290 |
} // notationDecl(String,String,String) |
1139 |
|
1291 |
|
|
|
1292 |
// XMLDTDHandler 2.4.0 |
1293 |
public void startConditional (short type, Augmentations a) { |
1294 |
startConditional(type); |
1295 |
} |
1296 |
|
1140 |
/** |
1297 |
/** |
1141 |
* The start of a conditional section. |
1298 |
* The start of a conditional section. |
1142 |
* |
1299 |
* |
1143 |
* @param type The type of the conditional section. This value will |
1300 |
* @param type The type of the conditional section. This value will |
1144 |
* either be CONDITIONAL_INCLUDE or CONDITIONAL_IGNORE. |
1301 |
* either be CONDITIONAL_INCLUDE or CONDITIONAL_IGNORE. |
1145 |
*/ |
1302 |
*/ |
|
|
1303 |
// XMLDTDHandler 2.0.0b4 |
1146 |
public void startConditional (short type) { |
1304 |
public void startConditional (short type) { |
1147 |
trace ("startConditional(" + type + ")"); // NOI18N |
1305 |
trace ("startConditional(" + type + ")"); // NOI18N |
1148 |
if (ASSERT) |
1306 |
if (ASSERT) |
Lines 1160-1179
Link Here
|
1160 |
|
1318 |
|
1161 |
} // startConditional(short) |
1319 |
} // startConditional(short) |
1162 |
|
1320 |
|
|
|
1321 |
// XMLDTDHandler 2.4.0 |
1322 |
public void endConditional (Augmentations a) { |
1323 |
endConditional(); |
1324 |
} |
1325 |
|
1163 |
/** |
1326 |
/** |
1164 |
* The end of a conditional section. |
1327 |
* The end of a conditional section. |
1165 |
*/ |
1328 |
*/ |
|
|
1329 |
// XMLDTDHandler 2.0.0b4 |
1166 |
public void endConditional () { |
1330 |
public void endConditional () { |
1167 |
trace ("endConditional()"); // NOI18N |
1331 |
trace ("endConditional()"); // NOI18N |
1168 |
|
1332 |
|
1169 |
popParentNode (); |
1333 |
popParentNode (); |
1170 |
} // endConditional() |
1334 |
} // endConditional() |
1171 |
|
1335 |
|
|
|
1336 |
// XMLDTDHandler 2.4.0 |
1337 |
public void endDTD (Augmentations a) { |
1338 |
endDTD(); |
1339 |
} |
1340 |
|
1172 |
/** |
1341 |
/** |
1173 |
* The end of the DTD. |
1342 |
* The end of the DTD. |
1174 |
* |
1343 |
* |
1175 |
* @throws SAXException Thrown by handler to signal an error. |
1344 |
* @throws SAXException Thrown by handler to signal an error. |
1176 |
*/ |
1345 |
*/ |
|
|
1346 |
// XMLDTDHandler 2.0.0b4 |
1177 |
public void endDTD () { |
1347 |
public void endDTD () { |
1178 |
trace ("endDTD()"); // NOI18N |
1348 |
trace ("endDTD()"); // NOI18N |
1179 |
|
1349 |
|
Lines 1197-1210
Link Here
|
1197 |
} // endDTD() |
1367 |
} // endDTD() |
1198 |
|
1368 |
|
1199 |
|
1369 |
|
1200 |
// ~~~~~~~~~~~~~~~~~ Content Model parser ~~~~~~~~~~~~~~~~~~~ |
1370 |
// Content Model parser ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
1201 |
|
|
|
1202 |
|
1371 |
|
1203 |
private TreeElementDecl.ContentType lastType; // occurence operators are applied on this |
1372 |
private TreeElementDecl.ContentType lastType; // occurence operators are applied on this |
1204 |
private TreeElementDecl.ContentType contentModel; // OUTPUT result field |
1373 |
private TreeElementDecl.ContentType contentModel; // OUTPUT result field |
1205 |
private Stack contentModelMembersStack; // stack of parent group members |
1374 |
private Stack contentModelMembersStack; // stack of parent group members |
1206 |
|
1375 |
|
1207 |
public void startContentModel (String elementName) { |
1376 |
public XMLDTDContentModelSource getDTDContentModelSource() { |
|
|
1377 |
return xmldtdContentModelSource; |
1378 |
} |
1379 |
|
1380 |
public void setDTDContentModelSource(XMLDTDContentModelSource src) { |
1381 |
xmldtdContentModelSource = src; |
1382 |
} |
1383 |
|
1384 |
public void startContentModel (String elementName, Augmentations a) { |
1208 |
|
1385 |
|
1209 |
if ( Util.THIS.isLoggable() ) /* then */ Util.THIS.debug ("startContentModel(" + elementName + ")"); // NOI18N |
1386 |
if ( Util.THIS.isLoggable() ) /* then */ Util.THIS.debug ("startContentModel(" + elementName + ")"); // NOI18N |
1210 |
|
1387 |
|
Lines 1213-1239
Link Here
|
1213 |
|
1390 |
|
1214 |
} |
1391 |
} |
1215 |
|
1392 |
|
1216 |
public void any () { |
1393 |
public void any (Augmentations a) { |
1217 |
contentModel = new ANYType (); |
1394 |
contentModel = new ANYType (); |
1218 |
} |
1395 |
} |
1219 |
|
1396 |
|
1220 |
public void empty () { |
1397 |
public void empty (Augmentations a) { |
1221 |
contentModel = new EMPTYType (); |
1398 |
contentModel = new EMPTYType (); |
1222 |
} |
1399 |
} |
1223 |
|
1400 |
|
1224 |
public void pcdata () { |
1401 |
public void pcdata (Augmentations a) { |
1225 |
setMembersType (new MixedType ()); |
1402 |
setMembersType (new MixedType ()); |
1226 |
} |
1403 |
} |
1227 |
|
1404 |
|
1228 |
|
1405 |
|
1229 |
// it is not called for mixed type |
1406 |
// it is not called for mixed type |
1230 |
public void startGroup () { |
1407 |
public void startGroup (Augmentations a) { |
1231 |
if ( Util.THIS.isLoggable() ) /* then */ Util.THIS.debug ("startGroup()"); // NOI18N |
1408 |
if ( Util.THIS.isLoggable() ) /* then */ Util.THIS.debug ("startGroup()"); // NOI18N |
1232 |
|
1409 |
|
1233 |
startMembers (); |
1410 |
startMembers (); |
1234 |
} |
1411 |
} |
1235 |
|
1412 |
|
1236 |
public void element (String elementName) { |
1413 |
public void element (String elementName, Augmentations a) { |
1237 |
|
1414 |
|
1238 |
if ( Util.THIS.isLoggable() ) /* then */ Util.THIS.debug ("element(" + elementName + ")"); // NOI18N |
1415 |
if ( Util.THIS.isLoggable() ) /* then */ Util.THIS.debug ("element(" + elementName + ")"); // NOI18N |
1239 |
|
1416 |
|
Lines 1242-1248
Link Here
|
1242 |
} |
1419 |
} |
1243 |
|
1420 |
|
1244 |
// determine type of content model group |
1421 |
// determine type of content model group |
1245 |
public void separator (short separator) { |
1422 |
public void separator (short separator, Augmentations a) { |
1246 |
if ( Util.THIS.isLoggable() ) /* then */ Util.THIS.debug ("childrenSeparator()"); // NOI18N |
1423 |
if ( Util.THIS.isLoggable() ) /* then */ Util.THIS.debug ("childrenSeparator()"); // NOI18N |
1247 |
|
1424 |
|
1248 |
switch (separator) { |
1425 |
switch (separator) { |
Lines 1260-1266
Link Here
|
1260 |
// |
1437 |
// |
1261 |
// INPUT lastType field |
1438 |
// INPUT lastType field |
1262 |
// |
1439 |
// |
1263 |
public void occurrence (short occurrence) { |
1440 |
public void occurrence (short occurrence, Augmentations a) { |
1264 |
if ( Util.THIS.isLoggable() ) /* then */ Util.THIS.debug ("childrenOccurrence()"); // NOI18N |
1441 |
if ( Util.THIS.isLoggable() ) /* then */ Util.THIS.debug ("childrenOccurrence()"); // NOI18N |
1265 |
|
1442 |
|
1266 |
switch (occurrence) { |
1443 |
switch (occurrence) { |
Lines 1279-1285
Link Here
|
1279 |
|
1456 |
|
1280 |
} |
1457 |
} |
1281 |
|
1458 |
|
1282 |
public void endGroup () { |
1459 |
public void endGroup (Augmentations a) { |
1283 |
if ( Util.THIS.isLoggable() ) /* then */ Util.THIS.debug ("childrenEndGroup()"); // NOI18N |
1460 |
if ( Util.THIS.isLoggable() ) /* then */ Util.THIS.debug ("childrenEndGroup()"); // NOI18N |
1284 |
|
1461 |
|
1285 |
ChildrenType group = getMembersType (); |
1462 |
ChildrenType group = getMembersType (); |
Lines 1288-1294
Link Here
|
1288 |
addMember (lastType); |
1465 |
addMember (lastType); |
1289 |
} |
1466 |
} |
1290 |
|
1467 |
|
1291 |
public void endContentModel () { |
1468 |
public void endContentModel (Augmentations a) { |
1292 |
if ( Util.THIS.isLoggable() ) /* then */ Util.THIS.debug ("endContentModel()"); // NOI18N |
1469 |
if ( Util.THIS.isLoggable() ) /* then */ Util.THIS.debug ("endContentModel()"); // NOI18N |
1293 |
|
1470 |
|
1294 |
if (contentModel == null && lastType == null) { // #PCDATA |
1471 |
if (contentModel == null && lastType == null) { // #PCDATA |
Lines 1510-1516
Link Here
|
1510 |
if ( Util.THIS.isLoggable() ) { |
1687 |
if ( Util.THIS.isLoggable() ) { |
1511 |
String location = ""; |
1688 |
String location = ""; |
1512 |
if (locator != null) { |
1689 |
if (locator != null) { |
1513 |
String entity = locator.getSystemId (); |
1690 |
String entity = locator.getExpandedSystemId (); |
1514 |
int index = entity.lastIndexOf ('/'); |
1691 |
int index = entity.lastIndexOf ('/'); |
1515 |
entity = entity.substring (index > 0 ? index : 0); |
1692 |
entity = entity.substring (index > 0 ? index : 0); |
1516 |
location = entity + "/" + locator.getLineNumber () + ":" + locator.getColumnNumber () ; |
1693 |
location = entity + "/" + locator.getLineNumber () + ":" + locator.getColumnNumber () ; |