Java Code Examples for javax.xml.stream.events.Attribute#getDTDType()
The following examples show how to use
javax.xml.stream.events.Attribute#getDTDType() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: StAXSchemaParser.java From hottub with GNU General Public License v2.0 | 5 votes |
private void fillXMLAttributes(StartElement event) { fAttributes.removeAllAttributes(); final Iterator attrs = event.getAttributes(); while (attrs.hasNext()) { Attribute attr = (Attribute) attrs.next(); fillQName(fAttributeQName, attr.getName()); String type = attr.getDTDType(); int idx = fAttributes.getLength(); fAttributes.addAttributeNS(fAttributeQName, (type != null) ? type : XMLSymbols.fCDATASymbol, attr.getValue()); fAttributes.setSpecified(idx, attr.isSpecified()); } }
Example 2
Source File: StAXEvent2SAX.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * Get the attributes associated with the given START_ELEMENT StAXevent. * * @return the StAX attributes converted to an org.xml.sax.Attributes */ private Attributes getAttributes(StartElement event) { AttributesImpl attrs = new AttributesImpl(); if ( !event.isStartElement() ) { throw new InternalError( "getAttributes() attempting to process: " + event); } // in SAX, namespace declarations are not part of attributes by default. // (there's a property to control that, but as far as we are concerned // we don't use it.) So don't add xmlns:* to attributes. // gather non-namespace attrs for (Iterator i = event.getAttributes(); i.hasNext();) { Attribute staxAttr = (javax.xml.stream.events.Attribute)i.next(); String uri = staxAttr.getName().getNamespaceURI(); if (uri == null) { uri = ""; } String localName = staxAttr.getName().getLocalPart(); String prefix = staxAttr.getName().getPrefix(); String qName; if (prefix == null || prefix.length() == 0) { qName = localName; } else { qName = prefix + ':' + localName; } String type = staxAttr.getDTDType(); String value = staxAttr.getValue(); attrs.addAttribute(uri, localName, qName, type, value); } return attrs; }
Example 3
Source File: StAXEventConnector.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * Get the attributes associated with the given START_ELEMENT StAXevent. * * @return the StAX attributes converted to an org.xml.sax.Attributes */ private Attributes getAttributes(StartElement event) { attrs.clear(); // in SAX, namespace declarations are not part of attributes by default. // (there's a property to control that, but as far as we are concerned // we don't use it.) So don't add xmlns:* to attributes. // gather non-namespace attrs for (Iterator i = event.getAttributes(); i.hasNext();) { Attribute staxAttr = (Attribute)i.next(); QName name = staxAttr.getName(); String uri = fixNull(name.getNamespaceURI()); String localName = name.getLocalPart(); String prefix = name.getPrefix(); String qName; if (prefix == null || prefix.length() == 0) qName = localName; else qName = prefix + ':' + localName; String type = staxAttr.getDTDType(); String value = staxAttr.getValue(); attrs.addAttribute(uri, localName, qName, type, value); } return attrs; }
Example 4
Source File: StAXSchemaParser.java From Bytecoder with Apache License 2.0 | 5 votes |
private void fillXMLAttributes(StartElement event) { fAttributes.removeAllAttributes(); final Iterator<Attribute> attrs = event.getAttributes(); while (attrs.hasNext()) { Attribute attr = attrs.next(); fillQName(fAttributeQName, attr.getName()); String type = attr.getDTDType(); int idx = fAttributes.getLength(); fAttributes.addAttributeNS(fAttributeQName, (type != null) ? type : XMLSymbols.fCDATASymbol, attr.getValue()); fAttributes.setSpecified(idx, attr.isSpecified()); } }
Example 5
Source File: StAXSchemaParser.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
private void fillXMLAttributes(StartElement event) { fAttributes.removeAllAttributes(); final Iterator attrs = event.getAttributes(); while (attrs.hasNext()) { Attribute attr = (Attribute) attrs.next(); fillQName(fAttributeQName, attr.getName()); String type = attr.getDTDType(); int idx = fAttributes.getLength(); fAttributes.addAttributeNS(fAttributeQName, (type != null) ? type : XMLSymbols.fCDATASymbol, attr.getValue()); fAttributes.setSpecified(idx, attr.isSpecified()); } }
Example 6
Source File: StAXSchemaParser.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
private void fillXMLAttributes(StartElement event) { fAttributes.removeAllAttributes(); final Iterator attrs = event.getAttributes(); while (attrs.hasNext()) { Attribute attr = (Attribute) attrs.next(); fillQName(fAttributeQName, attr.getName()); String type = attr.getDTDType(); int idx = fAttributes.getLength(); fAttributes.addAttributeNS(fAttributeQName, (type != null) ? type : XMLSymbols.fCDATASymbol, attr.getValue()); fAttributes.setSpecified(idx, attr.isSpecified()); } }
Example 7
Source File: StAXEvent2SAX.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
/** * Get the attributes associated with the given START_ELEMENT StAXevent. * * @return the StAX attributes converted to an org.xml.sax.Attributes */ private Attributes getAttributes(StartElement event) { AttributesImpl attrs = new AttributesImpl(); if ( !event.isStartElement() ) { throw new InternalError( "getAttributes() attempting to process: " + event); } // in SAX, namespace declarations are not part of attributes by default. // (there's a property to control that, but as far as we are concerned // we don't use it.) So don't add xmlns:* to attributes. // gather non-namespace attrs for (Iterator i = event.getAttributes(); i.hasNext();) { Attribute staxAttr = (javax.xml.stream.events.Attribute)i.next(); String uri = staxAttr.getName().getNamespaceURI(); if (uri == null) { uri = ""; } String localName = staxAttr.getName().getLocalPart(); String prefix = staxAttr.getName().getPrefix(); String qName; if (prefix == null || prefix.length() == 0) { qName = localName; } else { qName = prefix + ':' + localName; } String type = staxAttr.getDTDType(); String value = staxAttr.getValue(); attrs.addAttribute(uri, localName, qName, type, value); } return attrs; }
Example 8
Source File: StAXEventConnector.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
/** * Get the attributes associated with the given START_ELEMENT StAXevent. * * @return the StAX attributes converted to an org.xml.sax.Attributes */ private Attributes getAttributes(StartElement event) { attrs.clear(); // in SAX, namespace declarations are not part of attributes by default. // (there's a property to control that, but as far as we are concerned // we don't use it.) So don't add xmlns:* to attributes. // gather non-namespace attrs for (Iterator i = event.getAttributes(); i.hasNext();) { Attribute staxAttr = (Attribute)i.next(); QName name = staxAttr.getName(); String uri = fixNull(name.getNamespaceURI()); String localName = name.getLocalPart(); String prefix = name.getPrefix(); String qName; if (prefix == null || prefix.length() == 0) qName = localName; else qName = prefix + ':' + localName; String type = staxAttr.getDTDType(); String value = staxAttr.getValue(); attrs.addAttribute(uri, localName, qName, type, value); } return attrs; }
Example 9
Source File: StAXEvent2SAX.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
/** * Get the attributes associated with the given START_ELEMENT StAXevent. * * @return the StAX attributes converted to an org.xml.sax.Attributes */ private Attributes getAttributes(StartElement event) { AttributesImpl attrs = new AttributesImpl(); if ( !event.isStartElement() ) { throw new InternalError( "getAttributes() attempting to process: " + event); } // in SAX, namespace declarations are not part of attributes by default. // (there's a property to control that, but as far as we are concerned // we don't use it.) So don't add xmlns:* to attributes. // gather non-namespace attrs for (Iterator i = event.getAttributes(); i.hasNext();) { Attribute staxAttr = (javax.xml.stream.events.Attribute)i.next(); String uri = staxAttr.getName().getNamespaceURI(); if (uri == null) { uri = ""; } String localName = staxAttr.getName().getLocalPart(); String prefix = staxAttr.getName().getPrefix(); String qName; if (prefix == null || prefix.length() == 0) { qName = localName; } else { qName = prefix + ':' + localName; } String type = staxAttr.getDTDType(); String value = staxAttr.getValue(); attrs.addAttribute(uri, localName, qName, type, value); } return attrs; }
Example 10
Source File: StAXEvent2SAX.java From hottub with GNU General Public License v2.0 | 5 votes |
/** * Get the attributes associated with the given START_ELEMENT StAXevent. * * @return the StAX attributes converted to an org.xml.sax.Attributes */ private Attributes getAttributes(StartElement event) { AttributesImpl attrs = new AttributesImpl(); if ( !event.isStartElement() ) { throw new InternalError( "getAttributes() attempting to process: " + event); } // in SAX, namespace declarations are not part of attributes by default. // (there's a property to control that, but as far as we are concerned // we don't use it.) So don't add xmlns:* to attributes. // gather non-namespace attrs for (Iterator i = event.getAttributes(); i.hasNext();) { Attribute staxAttr = (javax.xml.stream.events.Attribute)i.next(); String uri = staxAttr.getName().getNamespaceURI(); if (uri == null) { uri = ""; } String localName = staxAttr.getName().getLocalPart(); String prefix = staxAttr.getName().getPrefix(); String qName; if (prefix == null || prefix.length() == 0) { qName = localName; } else { qName = prefix + ':' + localName; } String type = staxAttr.getDTDType(); String value = staxAttr.getValue(); attrs.addAttribute(uri, localName, qName, type, value); } return attrs; }
Example 11
Source File: StAXEvent2SAX.java From jdk1.8-source-analysis with Apache License 2.0 | 5 votes |
/** * Get the attributes associated with the given START_ELEMENT StAXevent. * * @return the StAX attributes converted to an org.xml.sax.Attributes */ private Attributes getAttributes(StartElement event) { AttributesImpl attrs = new AttributesImpl(); if ( !event.isStartElement() ) { throw new InternalError( "getAttributes() attempting to process: " + event); } // in SAX, namespace declarations are not part of attributes by default. // (there's a property to control that, but as far as we are concerned // we don't use it.) So don't add xmlns:* to attributes. // gather non-namespace attrs for (Iterator i = event.getAttributes(); i.hasNext();) { Attribute staxAttr = (javax.xml.stream.events.Attribute)i.next(); String uri = staxAttr.getName().getNamespaceURI(); if (uri == null) { uri = ""; } String localName = staxAttr.getName().getLocalPart(); String prefix = staxAttr.getName().getPrefix(); String qName; if (prefix == null || prefix.length() == 0) { qName = localName; } else { qName = prefix + ':' + localName; } String type = staxAttr.getDTDType(); String value = staxAttr.getValue(); attrs.addAttribute(uri, localName, qName, type, value); } return attrs; }
Example 12
Source File: StAXSchemaParser.java From JDKSourceCode1.8 with MIT License | 5 votes |
private void fillXMLAttributes(StartElement event) { fAttributes.removeAllAttributes(); final Iterator attrs = event.getAttributes(); while (attrs.hasNext()) { Attribute attr = (Attribute) attrs.next(); fillQName(fAttributeQName, attr.getName()); String type = attr.getDTDType(); int idx = fAttributes.getLength(); fAttributes.addAttributeNS(fAttributeQName, (type != null) ? type : XMLSymbols.fCDATASymbol, attr.getValue()); fAttributes.setSpecified(idx, attr.isSpecified()); } }
Example 13
Source File: StAXEvent2SAX.java From JDKSourceCode1.8 with MIT License | 5 votes |
/** * Get the attributes associated with the given START_ELEMENT StAXevent. * * @return the StAX attributes converted to an org.xml.sax.Attributes */ private Attributes getAttributes(StartElement event) { AttributesImpl attrs = new AttributesImpl(); if ( !event.isStartElement() ) { throw new InternalError( "getAttributes() attempting to process: " + event); } // in SAX, namespace declarations are not part of attributes by default. // (there's a property to control that, but as far as we are concerned // we don't use it.) So don't add xmlns:* to attributes. // gather non-namespace attrs for (Iterator i = event.getAttributes(); i.hasNext();) { Attribute staxAttr = (javax.xml.stream.events.Attribute)i.next(); String uri = staxAttr.getName().getNamespaceURI(); if (uri == null) { uri = ""; } String localName = staxAttr.getName().getLocalPart(); String prefix = staxAttr.getName().getPrefix(); String qName; if (prefix == null || prefix.length() == 0) { qName = localName; } else { qName = prefix + ':' + localName; } String type = staxAttr.getDTDType(); String value = staxAttr.getValue(); attrs.addAttribute(uri, localName, qName, type, value); } return attrs; }
Example 14
Source File: StAXSchemaParser.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
private void fillXMLAttributes(StartElement event) { fAttributes.removeAllAttributes(); final Iterator attrs = event.getAttributes(); while (attrs.hasNext()) { Attribute attr = (Attribute) attrs.next(); fillQName(fAttributeQName, attr.getName()); String type = attr.getDTDType(); int idx = fAttributes.getLength(); fAttributes.addAttributeNS(fAttributeQName, (type != null) ? type : XMLSymbols.fCDATASymbol, attr.getValue()); fAttributes.setSpecified(idx, attr.isSpecified()); } }
Example 15
Source File: StAXEvent2SAX.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
/** * Get the attributes associated with the given START_ELEMENT StAXevent. * * @return the StAX attributes converted to an org.xml.sax.Attributes */ private Attributes getAttributes(StartElement event) { AttributesImpl attrs = new AttributesImpl(); if ( !event.isStartElement() ) { throw new InternalError( "getAttributes() attempting to process: " + event); } // in SAX, namespace declarations are not part of attributes by default. // (there's a property to control that, but as far as we are concerned // we don't use it.) So don't add xmlns:* to attributes. // gather non-namespace attrs for (Iterator i = event.getAttributes(); i.hasNext();) { Attribute staxAttr = (javax.xml.stream.events.Attribute)i.next(); String uri = staxAttr.getName().getNamespaceURI(); if (uri == null) { uri = ""; } String localName = staxAttr.getName().getLocalPart(); String prefix = staxAttr.getName().getPrefix(); String qName; if (prefix == null || prefix.length() == 0) { qName = localName; } else { qName = prefix + ':' + localName; } String type = staxAttr.getDTDType(); String value = staxAttr.getValue(); attrs.addAttribute(uri, localName, qName, type, value); } return attrs; }
Example 16
Source File: StAXEventConnector.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
/** * Get the attributes associated with the given START_ELEMENT StAXevent. * * @return the StAX attributes converted to an org.xml.sax.Attributes */ private Attributes getAttributes(StartElement event) { attrs.clear(); // in SAX, namespace declarations are not part of attributes by default. // (there's a property to control that, but as far as we are concerned // we don't use it.) So don't add xmlns:* to attributes. // gather non-namespace attrs for (Iterator i = event.getAttributes(); i.hasNext();) { Attribute staxAttr = (Attribute)i.next(); QName name = staxAttr.getName(); String uri = fixNull(name.getNamespaceURI()); String localName = name.getLocalPart(); String prefix = name.getPrefix(); String qName; if (prefix == null || prefix.length() == 0) qName = localName; else qName = prefix + ':' + localName; String type = staxAttr.getDTDType(); String value = staxAttr.getValue(); attrs.addAttribute(uri, localName, qName, type, value); } return attrs; }
Example 17
Source File: StAXSchemaParser.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
private void fillXMLAttributes(StartElement event) { fAttributes.removeAllAttributes(); final Iterator attrs = event.getAttributes(); while (attrs.hasNext()) { Attribute attr = (Attribute) attrs.next(); fillQName(fAttributeQName, attr.getName()); String type = attr.getDTDType(); int idx = fAttributes.getLength(); fAttributes.addAttributeNS(fAttributeQName, (type != null) ? type : XMLSymbols.fCDATASymbol, attr.getValue()); fAttributes.setSpecified(idx, attr.isSpecified()); } }
Example 18
Source File: StAXEvent2SAX.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
/** * Get the attributes associated with the given START_ELEMENT StAXevent. * * @return the StAX attributes converted to an org.xml.sax.Attributes */ private Attributes getAttributes(StartElement event) { AttributesImpl attrs = new AttributesImpl(); if ( !event.isStartElement() ) { throw new InternalError( "getAttributes() attempting to process: " + event); } // in SAX, namespace declarations are not part of attributes by default. // (there's a property to control that, but as far as we are concerned // we don't use it.) So don't add xmlns:* to attributes. // gather non-namespace attrs for (Iterator i = event.getAttributes(); i.hasNext();) { Attribute staxAttr = (javax.xml.stream.events.Attribute)i.next(); String uri = staxAttr.getName().getNamespaceURI(); if (uri == null) { uri = ""; } String localName = staxAttr.getName().getLocalPart(); String prefix = staxAttr.getName().getPrefix(); String qName; if (prefix == null || prefix.length() == 0) { qName = localName; } else { qName = prefix + ':' + localName; } String type = staxAttr.getDTDType(); String value = staxAttr.getValue(); attrs.addAttribute(uri, localName, qName, type, value); } return attrs; }
Example 19
Source File: StAXSchemaParser.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
private void fillXMLAttributes(StartElement event) { fAttributes.removeAllAttributes(); final Iterator attrs = event.getAttributes(); while (attrs.hasNext()) { Attribute attr = (Attribute) attrs.next(); fillQName(fAttributeQName, attr.getName()); String type = attr.getDTDType(); int idx = fAttributes.getLength(); fAttributes.addAttributeNS(fAttributeQName, (type != null) ? type : XMLSymbols.fCDATASymbol, attr.getValue()); fAttributes.setSpecified(idx, attr.isSpecified()); } }
Example 20
Source File: StAXSchemaParser.java From jdk1.8-source-analysis with Apache License 2.0 | 5 votes |
private void fillXMLAttributes(StartElement event) { fAttributes.removeAllAttributes(); final Iterator attrs = event.getAttributes(); while (attrs.hasNext()) { Attribute attr = (Attribute) attrs.next(); fillQName(fAttributeQName, attr.getName()); String type = attr.getDTDType(); int idx = fAttributes.getLength(); fAttributes.addAttributeNS(fAttributeQName, (type != null) ? type : XMLSymbols.fCDATASymbol, attr.getValue()); fAttributes.setSpecified(idx, attr.isSpecified()); } }