@@ -65,6 +65,8 @@ public class XmlFactory extends JsonFactory
6565 protected transient XMLOutputFactory _xmlOutputFactory ;
6666
6767 protected String _cfgNameForTextElement ;
68+
69+ protected XmlTagProcessor _tagProcessor ;
6870
6971 /*
7072 /**********************************************************
@@ -102,11 +104,18 @@ public XmlFactory(ObjectCodec oc, XMLInputFactory xmlIn, XMLOutputFactory xmlOut
102104 xmlIn , xmlOut , null );
103105 }
104106
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+
105113 protected XmlFactory (ObjectCodec oc , int xpFeatures , int xgFeatures ,
106114 XMLInputFactory xmlIn , XMLOutputFactory xmlOut ,
107- String nameForTextElem )
115+ String nameForTextElem , XmlTagProcessor tagProcessor )
108116 {
109117 super (oc );
118+ _tagProcessor = tagProcessor ;
110119 _xmlParserFeatures = xpFeatures ;
111120 _xmlGeneratorFeatures = xgFeatures ;
112121 _cfgNameForTextElement = nameForTextElem ;
@@ -140,6 +149,7 @@ protected XmlFactory(XmlFactory src, ObjectCodec oc)
140149 _cfgNameForTextElement = src ._cfgNameForTextElement ;
141150 _xmlInputFactory = src ._xmlInputFactory ;
142151 _xmlOutputFactory = src ._xmlOutputFactory ;
152+ _tagProcessor = src ._tagProcessor ;
143153 }
144154
145155 /**
@@ -155,6 +165,7 @@ protected XmlFactory(XmlFactoryBuilder b)
155165 _cfgNameForTextElement = b .nameForTextElement ();
156166 _xmlInputFactory = b .xmlInputFactory ();
157167 _xmlOutputFactory = b .xmlOutputFactory ();
168+ _tagProcessor = b .xmlTagProcessor ();
158169 _initFactories (_xmlInputFactory , _xmlOutputFactory );
159170 }
160171
@@ -325,6 +336,14 @@ public int getFormatGeneratorFeatures() {
325336 return _xmlGeneratorFeatures ;
326337 }
327338
339+ public XmlTagProcessor getXmlTagProcessor () {
340+ return _tagProcessor ;
341+ }
342+
343+ public void setXmlTagProcessor (XmlTagProcessor _tagProcessor ) {
344+ this ._tagProcessor = _tagProcessor ;
345+ }
346+
328347 /*
329348 /******************************************************
330349 /* Configuration, XML, generator settings
@@ -498,7 +517,7 @@ public ToXmlGenerator createGenerator(OutputStream out, JsonEncoding enc) throws
498517 ctxt .setEncoding (enc );
499518 return new ToXmlGenerator (ctxt ,
500519 _generatorFeatures , _xmlGeneratorFeatures ,
501- _objectCodec , _createXmlWriter (ctxt , out ));
520+ _objectCodec , _createXmlWriter (ctxt , out ), _tagProcessor );
502521 }
503522
504523 @ Override
@@ -507,7 +526,7 @@ public ToXmlGenerator createGenerator(Writer out) throws IOException
507526 final IOContext ctxt = _createContext (_createContentReference (out ), false );
508527 return new ToXmlGenerator (ctxt ,
509528 _generatorFeatures , _xmlGeneratorFeatures ,
510- _objectCodec , _createXmlWriter (ctxt , out ));
529+ _objectCodec , _createXmlWriter (ctxt , out ), _tagProcessor );
511530 }
512531
513532 @ SuppressWarnings ("resource" )
@@ -519,7 +538,7 @@ public ToXmlGenerator createGenerator(File f, JsonEncoding enc) throws IOExcepti
519538 final IOContext ctxt = _createContext (_createContentReference (out ), true );
520539 ctxt .setEncoding (enc );
521540 return new ToXmlGenerator (ctxt , _generatorFeatures , _xmlGeneratorFeatures ,
522- _objectCodec , _createXmlWriter (ctxt , out ));
541+ _objectCodec , _createXmlWriter (ctxt , out ), _tagProcessor );
523542 }
524543
525544 /*
@@ -543,7 +562,7 @@ public FromXmlParser createParser(XMLStreamReader sr) throws IOException
543562
544563 // false -> not managed
545564 FromXmlParser xp = new FromXmlParser (_createContext (_createContentReference (sr ), false ),
546- _parserFeatures , _xmlParserFeatures , _objectCodec , sr );
565+ _parserFeatures , _xmlParserFeatures , _objectCodec , sr , _tagProcessor );
547566 if (_cfgNameForTextElement != null ) {
548567 xp .setXMLTextElementName (_cfgNameForTextElement );
549568 }
@@ -562,7 +581,7 @@ public ToXmlGenerator createGenerator(XMLStreamWriter sw) throws IOException
562581 sw = _initializeXmlWriter (sw );
563582 IOContext ctxt = _createContext (_createContentReference (sw ), false );
564583 return new ToXmlGenerator (ctxt , _generatorFeatures , _xmlGeneratorFeatures ,
565- _objectCodec , sw );
584+ _objectCodec , sw , _tagProcessor );
566585 }
567586
568587 /*
@@ -582,7 +601,7 @@ protected FromXmlParser _createParser(InputStream in, IOContext ctxt) throws IOE
582601 }
583602 sr = _initializeXmlReader (sr );
584603 FromXmlParser xp = new FromXmlParser (ctxt , _parserFeatures , _xmlParserFeatures ,
585- _objectCodec , sr );
604+ _objectCodec , sr , _tagProcessor );
586605 if (_cfgNameForTextElement != null ) {
587606 xp .setXMLTextElementName (_cfgNameForTextElement );
588607 }
@@ -600,7 +619,7 @@ protected FromXmlParser _createParser(Reader r, IOContext ctxt) throws IOExcepti
600619 }
601620 sr = _initializeXmlReader (sr );
602621 FromXmlParser xp = new FromXmlParser (ctxt , _parserFeatures , _xmlParserFeatures ,
603- _objectCodec , sr );
622+ _objectCodec , sr , _tagProcessor );
604623 if (_cfgNameForTextElement != null ) {
605624 xp .setXMLTextElementName (_cfgNameForTextElement );
606625 }
@@ -627,7 +646,7 @@ protected FromXmlParser _createParser(char[] data, int offset, int len, IOContex
627646 }
628647 sr = _initializeXmlReader (sr );
629648 FromXmlParser xp = new FromXmlParser (ctxt , _parserFeatures , _xmlParserFeatures ,
630- _objectCodec , sr );
649+ _objectCodec , sr , _tagProcessor );
631650 if (_cfgNameForTextElement != null ) {
632651 xp .setXMLTextElementName (_cfgNameForTextElement );
633652 }
@@ -651,7 +670,7 @@ protected FromXmlParser _createParser(byte[] data, int offset, int len, IOContex
651670 }
652671 sr = _initializeXmlReader (sr );
653672 FromXmlParser xp = new FromXmlParser (ctxt , _parserFeatures , _xmlParserFeatures ,
654- _objectCodec , sr );
673+ _objectCodec , sr , _tagProcessor );
655674 if (_cfgNameForTextElement != null ) {
656675 xp .setXMLTextElementName (_cfgNameForTextElement );
657676 }
0 commit comments