@@ -65,6 +65,8 @@ public class XmlFactory extends JsonFactory
65
65
protected transient XMLOutputFactory _xmlOutputFactory ;
66
66
67
67
protected String _cfgNameForTextElement ;
68
+
69
+ protected XmlTagProcessor _tagProcessor ;
68
70
69
71
/*
70
72
/**********************************************************
@@ -102,11 +104,18 @@ public XmlFactory(ObjectCodec oc, XMLInputFactory xmlIn, XMLOutputFactory xmlOut
102
104
xmlIn , xmlOut , null );
103
105
}
104
106
107
+ public XmlFactory (ObjectCodec oc , int xpFeatures , int xgFeatures ,
108
+ XMLInputFactory xmlIn , XMLOutputFactory xmlOut ,
109
+ String nameForTextElem ) {
110
+ this (oc , xpFeatures , xgFeatures , xmlIn , xmlOut , nameForTextElem , XmlTagProcessors .newPassthroughProcessor ());
111
+ }
112
+
105
113
protected XmlFactory (ObjectCodec oc , int xpFeatures , int xgFeatures ,
106
114
XMLInputFactory xmlIn , XMLOutputFactory xmlOut ,
107
- String nameForTextElem )
115
+ String nameForTextElem , XmlTagProcessor tagProcessor )
108
116
{
109
117
super (oc );
118
+ _tagProcessor = tagProcessor ;
110
119
_xmlParserFeatures = xpFeatures ;
111
120
_xmlGeneratorFeatures = xgFeatures ;
112
121
_cfgNameForTextElement = nameForTextElem ;
@@ -140,6 +149,7 @@ protected XmlFactory(XmlFactory src, ObjectCodec oc)
140
149
_cfgNameForTextElement = src ._cfgNameForTextElement ;
141
150
_xmlInputFactory = src ._xmlInputFactory ;
142
151
_xmlOutputFactory = src ._xmlOutputFactory ;
152
+ _tagProcessor = src ._tagProcessor ;
143
153
}
144
154
145
155
/**
@@ -155,6 +165,7 @@ protected XmlFactory(XmlFactoryBuilder b)
155
165
_cfgNameForTextElement = b .nameForTextElement ();
156
166
_xmlInputFactory = b .xmlInputFactory ();
157
167
_xmlOutputFactory = b .xmlOutputFactory ();
168
+ _tagProcessor = b .xmlTagProcessor ();
158
169
_initFactories (_xmlInputFactory , _xmlOutputFactory );
159
170
}
160
171
@@ -325,6 +336,14 @@ public int getFormatGeneratorFeatures() {
325
336
return _xmlGeneratorFeatures ;
326
337
}
327
338
339
+ public XmlTagProcessor getXmlTagProcessor () {
340
+ return _tagProcessor ;
341
+ }
342
+
343
+ public void setXmlTagProcessor (XmlTagProcessor _tagProcessor ) {
344
+ this ._tagProcessor = _tagProcessor ;
345
+ }
346
+
328
347
/*
329
348
/******************************************************
330
349
/* Configuration, XML, generator settings
@@ -498,7 +517,7 @@ public ToXmlGenerator createGenerator(OutputStream out, JsonEncoding enc) throws
498
517
ctxt .setEncoding (enc );
499
518
return new ToXmlGenerator (ctxt ,
500
519
_generatorFeatures , _xmlGeneratorFeatures ,
501
- _objectCodec , _createXmlWriter (ctxt , out ));
520
+ _objectCodec , _createXmlWriter (ctxt , out ), _tagProcessor );
502
521
}
503
522
504
523
@ Override
@@ -507,7 +526,7 @@ public ToXmlGenerator createGenerator(Writer out) throws IOException
507
526
final IOContext ctxt = _createContext (_createContentReference (out ), false );
508
527
return new ToXmlGenerator (ctxt ,
509
528
_generatorFeatures , _xmlGeneratorFeatures ,
510
- _objectCodec , _createXmlWriter (ctxt , out ));
529
+ _objectCodec , _createXmlWriter (ctxt , out ), _tagProcessor );
511
530
}
512
531
513
532
@ SuppressWarnings ("resource" )
@@ -519,7 +538,7 @@ public ToXmlGenerator createGenerator(File f, JsonEncoding enc) throws IOExcepti
519
538
final IOContext ctxt = _createContext (_createContentReference (out ), true );
520
539
ctxt .setEncoding (enc );
521
540
return new ToXmlGenerator (ctxt , _generatorFeatures , _xmlGeneratorFeatures ,
522
- _objectCodec , _createXmlWriter (ctxt , out ));
541
+ _objectCodec , _createXmlWriter (ctxt , out ), _tagProcessor );
523
542
}
524
543
525
544
/*
@@ -543,7 +562,7 @@ public FromXmlParser createParser(XMLStreamReader sr) throws IOException
543
562
544
563
// false -> not managed
545
564
FromXmlParser xp = new FromXmlParser (_createContext (_createContentReference (sr ), false ),
546
- _parserFeatures , _xmlParserFeatures , _objectCodec , sr );
565
+ _parserFeatures , _xmlParserFeatures , _objectCodec , sr , _tagProcessor );
547
566
if (_cfgNameForTextElement != null ) {
548
567
xp .setXMLTextElementName (_cfgNameForTextElement );
549
568
}
@@ -562,7 +581,7 @@ public ToXmlGenerator createGenerator(XMLStreamWriter sw) throws IOException
562
581
sw = _initializeXmlWriter (sw );
563
582
IOContext ctxt = _createContext (_createContentReference (sw ), false );
564
583
return new ToXmlGenerator (ctxt , _generatorFeatures , _xmlGeneratorFeatures ,
565
- _objectCodec , sw );
584
+ _objectCodec , sw , _tagProcessor );
566
585
}
567
586
568
587
/*
@@ -582,7 +601,7 @@ protected FromXmlParser _createParser(InputStream in, IOContext ctxt) throws IOE
582
601
}
583
602
sr = _initializeXmlReader (sr );
584
603
FromXmlParser xp = new FromXmlParser (ctxt , _parserFeatures , _xmlParserFeatures ,
585
- _objectCodec , sr );
604
+ _objectCodec , sr , _tagProcessor );
586
605
if (_cfgNameForTextElement != null ) {
587
606
xp .setXMLTextElementName (_cfgNameForTextElement );
588
607
}
@@ -600,7 +619,7 @@ protected FromXmlParser _createParser(Reader r, IOContext ctxt) throws IOExcepti
600
619
}
601
620
sr = _initializeXmlReader (sr );
602
621
FromXmlParser xp = new FromXmlParser (ctxt , _parserFeatures , _xmlParserFeatures ,
603
- _objectCodec , sr );
622
+ _objectCodec , sr , _tagProcessor );
604
623
if (_cfgNameForTextElement != null ) {
605
624
xp .setXMLTextElementName (_cfgNameForTextElement );
606
625
}
@@ -627,7 +646,7 @@ protected FromXmlParser _createParser(char[] data, int offset, int len, IOContex
627
646
}
628
647
sr = _initializeXmlReader (sr );
629
648
FromXmlParser xp = new FromXmlParser (ctxt , _parserFeatures , _xmlParserFeatures ,
630
- _objectCodec , sr );
649
+ _objectCodec , sr , _tagProcessor );
631
650
if (_cfgNameForTextElement != null ) {
632
651
xp .setXMLTextElementName (_cfgNameForTextElement );
633
652
}
@@ -651,7 +670,7 @@ protected FromXmlParser _createParser(byte[] data, int offset, int len, IOContex
651
670
}
652
671
sr = _initializeXmlReader (sr );
653
672
FromXmlParser xp = new FromXmlParser (ctxt , _parserFeatures , _xmlParserFeatures ,
654
- _objectCodec , sr );
673
+ _objectCodec , sr , _tagProcessor );
655
674
if (_cfgNameForTextElement != null ) {
656
675
xp .setXMLTextElementName (_cfgNameForTextElement );
657
676
}
0 commit comments