Java Code Examples for com.sun.org.apache.xerces.internal.xni.XMLAttributes#getName()
The following examples show how to use
com.sun.org.apache.xerces.internal.xni.XMLAttributes#getName() .
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: XPointerElementHandler.java From hottub with GNU General Public License v2.0 | 5 votes |
public boolean checkStringToken(QName element, XMLAttributes attributes){ QName cacheQName = null; String id =null; String rawname =null; QName attrName = new QName(); String attrType = null; String attrValue = null; int attrCount = attributes.getLength(); for (int i = 0; i < attrCount; i++) { Augmentations aaugs = attributes.getAugmentations(i); attributes.getName(i,attrName); attrType = attributes.getType(i); attrValue = attributes.getValue(i); if(attrType != null && attrValue!= null && isIdAttribute(attributes,aaugs,i) && attrValue.equals(fCurrentTokenString)){ if(hasMoreToken()){ fCurrentTokenType = 0; fCurrentTokenString = null; return true; } else{ foundElement = element; includeElement = true; fCurrentTokenType = 0; fCurrentTokenString = null; fSubResourceIdentified = true; return true; } } } return false; }
Example 2
Source File: XPointerElementHandler.java From jdk1.8-source-analysis with Apache License 2.0 | 5 votes |
public boolean checkStringToken(QName element, XMLAttributes attributes){ QName cacheQName = null; String id =null; String rawname =null; QName attrName = new QName(); String attrType = null; String attrValue = null; int attrCount = attributes.getLength(); for (int i = 0; i < attrCount; i++) { Augmentations aaugs = attributes.getAugmentations(i); attributes.getName(i,attrName); attrType = attributes.getType(i); attrValue = attributes.getValue(i); if(attrType != null && attrValue!= null && isIdAttribute(attributes,aaugs,i) && attrValue.equals(fCurrentTokenString)){ if(hasMoreToken()){ fCurrentTokenType = 0; fCurrentTokenString = null; return true; } else{ foundElement = element; includeElement = true; fCurrentTokenType = 0; fCurrentTokenString = null; fSubResourceIdentified = true; return true; } } } return false; }
Example 3
Source File: XPointerElementHandler.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
public boolean checkStringToken(QName element, XMLAttributes attributes){ QName cacheQName = null; String id =null; String rawname =null; QName attrName = new QName(); String attrType = null; String attrValue = null; int attrCount = attributes.getLength(); for (int i = 0; i < attrCount; i++) { Augmentations aaugs = attributes.getAugmentations(i); attributes.getName(i,attrName); attrType = attributes.getType(i); attrValue = attributes.getValue(i); if(attrType != null && attrValue!= null && isIdAttribute(attributes,aaugs,i) && attrValue.equals(fCurrentTokenString)){ if(hasMoreToken()){ fCurrentTokenType = 0; fCurrentTokenString = null; return true; } else{ foundElement = element; includeElement = true; fCurrentTokenType = 0; fCurrentTokenString = null; fSubResourceIdentified = true; return true; } } } return false; }
Example 4
Source File: XPointerElementHandler.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
public boolean checkStringToken(QName element, XMLAttributes attributes){ QName cacheQName = null; String id =null; String rawname =null; QName attrName = new QName(); String attrType = null; String attrValue = null; int attrCount = attributes.getLength(); for (int i = 0; i < attrCount; i++) { Augmentations aaugs = attributes.getAugmentations(i); attributes.getName(i,attrName); attrType = attributes.getType(i); attrValue = attributes.getValue(i); if(attrType != null && attrValue!= null && isIdAttribute(attributes,aaugs,i) && attrValue.equals(fCurrentTokenString)){ if(hasMoreToken()){ fCurrentTokenType = 0; fCurrentTokenString = null; return true; } else{ foundElement = element; includeElement = true; fCurrentTokenType = 0; fCurrentTokenString = null; fSubResourceIdentified = true; return true; } } } return false; }
Example 5
Source File: DOMResultBuilder.java From JDKSourceCode1.8 with MIT License | 4 votes |
public void startElement(QName element, XMLAttributes attributes, Augmentations augs) throws XNIException { Element elem; int attrCount = attributes.getLength(); if (fDocumentImpl == null) { elem = fDocument.createElementNS(element.uri, element.rawname); for (int i = 0; i < attrCount; ++i) { attributes.getName(i, fAttributeQName); elem.setAttributeNS(fAttributeQName.uri, fAttributeQName.rawname, attributes.getValue(i)); } } // If it's a Xerces DOM store type information for attributes, set idness, etc.. else { elem = fDocumentImpl.createElementNS(element.uri, element.rawname, element.localpart); for (int i = 0; i < attrCount; ++i) { attributes.getName(i, fAttributeQName); AttrImpl attr = (AttrImpl) fDocumentImpl.createAttributeNS(fAttributeQName.uri, fAttributeQName.rawname, fAttributeQName.localpart); attr.setValue(attributes.getValue(i)); // write type information to this attribute AttributePSVI attrPSVI = (AttributePSVI) attributes.getAugmentations(i).getItem (Constants.ATTRIBUTE_PSVI); if (attrPSVI != null) { if (fStorePSVI) { ((PSVIAttrNSImpl) attr).setPSVI(attrPSVI); } Object type = attrPSVI.getMemberTypeDefinition(); if (type == null) { type = attrPSVI.getTypeDefinition(); if (type != null) { attr.setType (type); if (((XSSimpleType) type).isIDType()) { ((ElementImpl) elem).setIdAttributeNode (attr, true); } } } else { attr.setType (type); if (((XSSimpleType) type).isIDType()) { ((ElementImpl) elem).setIdAttributeNode (attr, true); } } } attr.setSpecified(attributes.isSpecified(i)); elem.setAttributeNode(attr); } } append(elem); fCurrentNode = elem; if (fFragmentRoot == null) { fFragmentRoot = elem; } }
Example 6
Source File: DOMNormalizer.java From Bytecoder with Apache License 2.0 | 4 votes |
/** * The start of an element. * * @param element The name of the element. * @param attributes The element attributes. * @param augs Additional information that may include infoset augmentations * * @exception XNIException * Thrown by handler to signal an error. */ public void startElement(QName element, XMLAttributes attributes, Augmentations augs) throws XNIException { Element currentElement = (Element) fCurrentNode; int attrCount = attributes.getLength(); if (DEBUG_EVENTS) { System.out.println("==>startElement: " +element+ " attrs.length="+attrCount); } for (int i = 0; i < attrCount; i++) { attributes.getName(i, fAttrQName); Attr attr = null; attr = currentElement.getAttributeNodeNS(fAttrQName.uri, fAttrQName.localpart); if (attr == null) { // Must be a non-namespace aware DOM Level 1 node. attr = currentElement.getAttributeNode(fAttrQName.rawname); } AttributePSVI attrPSVI = (AttributePSVI) attributes.getAugmentations(i).getItem(Constants.ATTRIBUTE_PSVI); if (attrPSVI != null) { //REVISIT: instead we should be using augmentations: // to set/retrieve Id attributes XSTypeDefinition decl = attrPSVI.getMemberTypeDefinition(); boolean id = false; if (decl != null) { id = ((XSSimpleType)decl).isIDType(); } else { decl = attrPSVI.getTypeDefinition(); if (decl != null) { id = ((XSSimpleType)decl).isIDType(); } } if (id) { ((ElementImpl)currentElement).setIdAttributeNode(attr, true); } if (fPSVI) { ((PSVIAttrNSImpl) attr).setPSVI(attrPSVI); } // Updating the TypeInfo for this attribute. ((AttrImpl) attr).setType(decl); if ((fConfiguration.features & DOMConfigurationImpl.DTNORMALIZATION) != 0) { // datatype-normalization // NOTE: The specified value MUST be set after we set // the node value because that turns the "specified" // flag to "true" which may overwrite a "false" // value from the attribute list. final String normalizedValue = attrPSVI.getSchemaValue().getNormalizedValue(); if (normalizedValue != null) { boolean specified = attr.getSpecified(); attr.setValue(normalizedValue); if (!specified) { ((AttrImpl) attr).setSpecified(specified); } } } } else { // DTD String type = null; boolean isDeclared = Boolean.TRUE.equals(attributes.getAugmentations(i).getItem (Constants.ATTRIBUTE_DECLARED)); // For DOM Level 3 TypeInfo, the type name must // be null if this attribute has not been declared // in the DTD. if (isDeclared) { type = attributes.getType(i); if ("ID".equals (type)) { ((ElementImpl) currentElement).setIdAttributeNode(attr, true); } } // Updating the TypeInfo for this attribute. ((AttrImpl) attr).setType(type); } } }
Example 7
Source File: DOMResultBuilder.java From hottub with GNU General Public License v2.0 | 4 votes |
public void startElement(QName element, XMLAttributes attributes, Augmentations augs) throws XNIException { Element elem; int attrCount = attributes.getLength(); if (fDocumentImpl == null) { elem = fDocument.createElementNS(element.uri, element.rawname); for (int i = 0; i < attrCount; ++i) { attributes.getName(i, fAttributeQName); elem.setAttributeNS(fAttributeQName.uri, fAttributeQName.rawname, attributes.getValue(i)); } } // If it's a Xerces DOM store type information for attributes, set idness, etc.. else { elem = fDocumentImpl.createElementNS(element.uri, element.rawname, element.localpart); for (int i = 0; i < attrCount; ++i) { attributes.getName(i, fAttributeQName); AttrImpl attr = (AttrImpl) fDocumentImpl.createAttributeNS(fAttributeQName.uri, fAttributeQName.rawname, fAttributeQName.localpart); attr.setValue(attributes.getValue(i)); // write type information to this attribute AttributePSVI attrPSVI = (AttributePSVI) attributes.getAugmentations(i).getItem (Constants.ATTRIBUTE_PSVI); if (attrPSVI != null) { if (fStorePSVI) { ((PSVIAttrNSImpl) attr).setPSVI(attrPSVI); } Object type = attrPSVI.getMemberTypeDefinition(); if (type == null) { type = attrPSVI.getTypeDefinition(); if (type != null) { attr.setType (type); if (((XSSimpleType) type).isIDType()) { ((ElementImpl) elem).setIdAttributeNode (attr, true); } } } else { attr.setType (type); if (((XSSimpleType) type).isIDType()) { ((ElementImpl) elem).setIdAttributeNode (attr, true); } } } attr.setSpecified(attributes.isSpecified(i)); elem.setAttributeNode(attr); } } append(elem); fCurrentNode = elem; if (fFragmentRoot == null) { fFragmentRoot = elem; } }
Example 8
Source File: DOMResultBuilder.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
public void startElement(QName element, XMLAttributes attributes, Augmentations augs) throws XNIException { Element elem; int attrCount = attributes.getLength(); if (fDocumentImpl == null) { elem = fDocument.createElementNS(element.uri, element.rawname); for (int i = 0; i < attrCount; ++i) { attributes.getName(i, fAttributeQName); elem.setAttributeNS(fAttributeQName.uri, fAttributeQName.rawname, attributes.getValue(i)); } } // If it's a Xerces DOM store type information for attributes, set idness, etc.. else { elem = fDocumentImpl.createElementNS(element.uri, element.rawname, element.localpart); for (int i = 0; i < attrCount; ++i) { attributes.getName(i, fAttributeQName); AttrImpl attr = (AttrImpl) fDocumentImpl.createAttributeNS(fAttributeQName.uri, fAttributeQName.rawname, fAttributeQName.localpart); attr.setValue(attributes.getValue(i)); // write type information to this attribute AttributePSVI attrPSVI = (AttributePSVI) attributes.getAugmentations(i).getItem (Constants.ATTRIBUTE_PSVI); if (attrPSVI != null) { if (fStorePSVI) { ((PSVIAttrNSImpl) attr).setPSVI(attrPSVI); } Object type = attrPSVI.getMemberTypeDefinition(); if (type == null) { type = attrPSVI.getTypeDefinition(); if (type != null) { attr.setType (type); if (((XSSimpleType) type).isIDType()) { ((ElementImpl) elem).setIdAttributeNode (attr, true); } } } else { attr.setType (type); if (((XSSimpleType) type).isIDType()) { ((ElementImpl) elem).setIdAttributeNode (attr, true); } } } attr.setSpecified(attributes.isSpecified(i)); elem.setAttributeNode(attr); } } append(elem); fCurrentNode = elem; if (fFragmentRoot == null) { fFragmentRoot = elem; } }
Example 9
Source File: DOMNormalizer.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
/** * The start of an element. * * @param element The name of the element. * @param attributes The element attributes. * @param augs Additional information that may include infoset augmentations * * @exception XNIException * Thrown by handler to signal an error. */ public void startElement(QName element, XMLAttributes attributes, Augmentations augs) throws XNIException { Element currentElement = (Element) fCurrentNode; int attrCount = attributes.getLength(); if (DEBUG_EVENTS) { System.out.println("==>startElement: " +element+ " attrs.length="+attrCount); } for (int i = 0; i < attrCount; i++) { attributes.getName(i, fAttrQName); Attr attr = null; attr = currentElement.getAttributeNodeNS(fAttrQName.uri, fAttrQName.localpart); AttributePSVI attrPSVI = (AttributePSVI) attributes.getAugmentations(i).getItem(Constants.ATTRIBUTE_PSVI); if (attrPSVI != null) { //REVISIT: instead we should be using augmentations: // to set/retrieve Id attributes XSTypeDefinition decl = attrPSVI.getMemberTypeDefinition(); boolean id = false; if (decl != null){ id = ((XSSimpleType)decl).isIDType(); } else{ decl = attrPSVI.getTypeDefinition(); if (decl !=null){ id = ((XSSimpleType)decl).isIDType(); } } if (id){ ((ElementImpl)currentElement).setIdAttributeNode(attr, true); } if (fPSVI) { ((PSVIAttrNSImpl) attr).setPSVI(attrPSVI); } if ((fConfiguration.features & DOMConfigurationImpl.DTNORMALIZATION) != 0) { // datatype-normalization // NOTE: The specified value MUST be set after we set // the node value because that turns the "specified" // flag to "true" which may overwrite a "false" // value from the attribute list. boolean specified = attr.getSpecified(); attr.setValue(attrPSVI.getSchemaNormalizedValue()); if (!specified) { ((AttrImpl) attr).setSpecified(specified); } } } } }
Example 10
Source File: DOMNormalizer.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
/** * The start of an element. * * @param element The name of the element. * @param attributes The element attributes. * @param augs Additional information that may include infoset augmentations * * @exception XNIException * Thrown by handler to signal an error. */ public void startElement(QName element, XMLAttributes attributes, Augmentations augs) throws XNIException { Element currentElement = (Element) fCurrentNode; int attrCount = attributes.getLength(); if (DEBUG_EVENTS) { System.out.println("==>startElement: " +element+ " attrs.length="+attrCount); } for (int i = 0; i < attrCount; i++) { attributes.getName(i, fAttrQName); Attr attr = null; attr = currentElement.getAttributeNodeNS(fAttrQName.uri, fAttrQName.localpart); AttributePSVI attrPSVI = (AttributePSVI) attributes.getAugmentations(i).getItem(Constants.ATTRIBUTE_PSVI); if (attrPSVI != null) { //REVISIT: instead we should be using augmentations: // to set/retrieve Id attributes XSTypeDefinition decl = attrPSVI.getMemberTypeDefinition(); boolean id = false; if (decl != null){ id = ((XSSimpleType)decl).isIDType(); } else{ decl = attrPSVI.getTypeDefinition(); if (decl !=null){ id = ((XSSimpleType)decl).isIDType(); } } if (id){ ((ElementImpl)currentElement).setIdAttributeNode(attr, true); } if (fPSVI) { ((PSVIAttrNSImpl) attr).setPSVI(attrPSVI); } if ((fConfiguration.features & DOMConfigurationImpl.DTNORMALIZATION) != 0) { // datatype-normalization // NOTE: The specified value MUST be set after we set // the node value because that turns the "specified" // flag to "true" which may overwrite a "false" // value from the attribute list. boolean specified = attr.getSpecified(); attr.setValue(attrPSVI.getSchemaNormalizedValue()); if (!specified) { ((AttrImpl) attr).setSpecified(specified); } } } } }
Example 11
Source File: DOMResultBuilder.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
public void startElement(QName element, XMLAttributes attributes, Augmentations augs) throws XNIException { Element elem; int attrCount = attributes.getLength(); if (fDocumentImpl == null) { elem = fDocument.createElementNS(element.uri, element.rawname); for (int i = 0; i < attrCount; ++i) { attributes.getName(i, fAttributeQName); elem.setAttributeNS(fAttributeQName.uri, fAttributeQName.rawname, attributes.getValue(i)); } } // If it's a Xerces DOM store type information for attributes, set idness, etc.. else { elem = fDocumentImpl.createElementNS(element.uri, element.rawname, element.localpart); for (int i = 0; i < attrCount; ++i) { attributes.getName(i, fAttributeQName); AttrImpl attr = (AttrImpl) fDocumentImpl.createAttributeNS(fAttributeQName.uri, fAttributeQName.rawname, fAttributeQName.localpart); attr.setValue(attributes.getValue(i)); // write type information to this attribute AttributePSVI attrPSVI = (AttributePSVI) attributes.getAugmentations(i).getItem (Constants.ATTRIBUTE_PSVI); if (attrPSVI != null) { if (fStorePSVI) { ((PSVIAttrNSImpl) attr).setPSVI(attrPSVI); } Object type = attrPSVI.getMemberTypeDefinition(); if (type == null) { type = attrPSVI.getTypeDefinition(); if (type != null) { attr.setType (type); if (((XSSimpleType) type).isIDType()) { ((ElementImpl) elem).setIdAttributeNode (attr, true); } } } else { attr.setType (type); if (((XSSimpleType) type).isIDType()) { ((ElementImpl) elem).setIdAttributeNode (attr, true); } } } attr.setSpecified(attributes.isSpecified(i)); elem.setAttributeNode(attr); } } append(elem); fCurrentNode = elem; if (fFragmentRoot == null) { fFragmentRoot = elem; } }
Example 12
Source File: DOMNormalizer.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
/** * The start of an element. * * @param element The name of the element. * @param attributes The element attributes. * @param augs Additional information that may include infoset augmentations * * @exception XNIException * Thrown by handler to signal an error. */ public void startElement(QName element, XMLAttributes attributes, Augmentations augs) throws XNIException { Element currentElement = (Element) fCurrentNode; int attrCount = attributes.getLength(); if (DEBUG_EVENTS) { System.out.println("==>startElement: " +element+ " attrs.length="+attrCount); } for (int i = 0; i < attrCount; i++) { attributes.getName(i, fAttrQName); Attr attr = null; attr = currentElement.getAttributeNodeNS(fAttrQName.uri, fAttrQName.localpart); AttributePSVI attrPSVI = (AttributePSVI) attributes.getAugmentations(i).getItem(Constants.ATTRIBUTE_PSVI); if (attrPSVI != null) { //REVISIT: instead we should be using augmentations: // to set/retrieve Id attributes XSTypeDefinition decl = attrPSVI.getMemberTypeDefinition(); boolean id = false; if (decl != null){ id = ((XSSimpleType)decl).isIDType(); } else{ decl = attrPSVI.getTypeDefinition(); if (decl !=null){ id = ((XSSimpleType)decl).isIDType(); } } if (id){ ((ElementImpl)currentElement).setIdAttributeNode(attr, true); } if (fPSVI) { ((PSVIAttrNSImpl) attr).setPSVI(attrPSVI); } if ((fConfiguration.features & DOMConfigurationImpl.DTNORMALIZATION) != 0) { // datatype-normalization // NOTE: The specified value MUST be set after we set // the node value because that turns the "specified" // flag to "true" which may overwrite a "false" // value from the attribute list. boolean specified = attr.getSpecified(); attr.setValue(attrPSVI.getSchemaNormalizedValue()); if (!specified) { ((AttrImpl) attr).setSpecified(specified); } } } } }
Example 13
Source File: DOMResultBuilder.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
public void startElement(QName element, XMLAttributes attributes, Augmentations augs) throws XNIException { Element elem; int attrCount = attributes.getLength(); if (fDocumentImpl == null) { elem = fDocument.createElementNS(element.uri, element.rawname); for (int i = 0; i < attrCount; ++i) { attributes.getName(i, fAttributeQName); elem.setAttributeNS(fAttributeQName.uri, fAttributeQName.rawname, attributes.getValue(i)); } } // If it's a Xerces DOM store type information for attributes, set idness, etc.. else { elem = fDocumentImpl.createElementNS(element.uri, element.rawname, element.localpart); for (int i = 0; i < attrCount; ++i) { attributes.getName(i, fAttributeQName); AttrImpl attr = (AttrImpl) fDocumentImpl.createAttributeNS(fAttributeQName.uri, fAttributeQName.rawname, fAttributeQName.localpart); attr.setValue(attributes.getValue(i)); // write type information to this attribute AttributePSVI attrPSVI = (AttributePSVI) attributes.getAugmentations(i).getItem (Constants.ATTRIBUTE_PSVI); if (attrPSVI != null) { if (fStorePSVI) { ((PSVIAttrNSImpl) attr).setPSVI(attrPSVI); } Object type = attrPSVI.getMemberTypeDefinition(); if (type == null) { type = attrPSVI.getTypeDefinition(); if (type != null) { attr.setType (type); if (((XSSimpleType) type).isIDType()) { ((ElementImpl) elem).setIdAttributeNode (attr, true); } } } else { attr.setType (type); if (((XSSimpleType) type).isIDType()) { ((ElementImpl) elem).setIdAttributeNode (attr, true); } } } attr.setSpecified(attributes.isSpecified(i)); elem.setAttributeNode(attr); } } append(elem); fCurrentNode = elem; if (fFragmentRoot == null) { fFragmentRoot = elem; } }
Example 14
Source File: DOMNormalizer.java From JDKSourceCode1.8 with MIT License | 4 votes |
/** * The start of an element. * * @param element The name of the element. * @param attributes The element attributes. * @param augs Additional information that may include infoset augmentations * * @exception XNIException * Thrown by handler to signal an error. */ public void startElement(QName element, XMLAttributes attributes, Augmentations augs) throws XNIException { Element currentElement = (Element) fCurrentNode; int attrCount = attributes.getLength(); if (DEBUG_EVENTS) { System.out.println("==>startElement: " +element+ " attrs.length="+attrCount); } for (int i = 0; i < attrCount; i++) { attributes.getName(i, fAttrQName); Attr attr = null; attr = currentElement.getAttributeNodeNS(fAttrQName.uri, fAttrQName.localpart); AttributePSVI attrPSVI = (AttributePSVI) attributes.getAugmentations(i).getItem(Constants.ATTRIBUTE_PSVI); if (attrPSVI != null) { //REVISIT: instead we should be using augmentations: // to set/retrieve Id attributes XSTypeDefinition decl = attrPSVI.getMemberTypeDefinition(); boolean id = false; if (decl != null){ id = ((XSSimpleType)decl).isIDType(); } else{ decl = attrPSVI.getTypeDefinition(); if (decl !=null){ id = ((XSSimpleType)decl).isIDType(); } } if (id){ ((ElementImpl)currentElement).setIdAttributeNode(attr, true); } if (fPSVI) { ((PSVIAttrNSImpl) attr).setPSVI(attrPSVI); } if ((fConfiguration.features & DOMConfigurationImpl.DTNORMALIZATION) != 0) { // datatype-normalization // NOTE: The specified value MUST be set after we set // the node value because that turns the "specified" // flag to "true" which may overwrite a "false" // value from the attribute list. boolean specified = attr.getSpecified(); attr.setValue(attrPSVI.getSchemaNormalizedValue()); if (!specified) { ((AttrImpl) attr).setSpecified(specified); } } } } }
Example 15
Source File: DOMResultBuilder.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
public void startElement(QName element, XMLAttributes attributes, Augmentations augs) throws XNIException { Element elem; int attrCount = attributes.getLength(); if (fDocumentImpl == null) { elem = fDocument.createElementNS(element.uri, element.rawname); for (int i = 0; i < attrCount; ++i) { attributes.getName(i, fAttributeQName); elem.setAttributeNS(fAttributeQName.uri, fAttributeQName.rawname, attributes.getValue(i)); } } // If it's a Xerces DOM store type information for attributes, set idness, etc.. else { elem = fDocumentImpl.createElementNS(element.uri, element.rawname, element.localpart); for (int i = 0; i < attrCount; ++i) { attributes.getName(i, fAttributeQName); AttrImpl attr = (AttrImpl) fDocumentImpl.createAttributeNS(fAttributeQName.uri, fAttributeQName.rawname, fAttributeQName.localpart); attr.setValue(attributes.getValue(i)); // write type information to this attribute AttributePSVI attrPSVI = (AttributePSVI) attributes.getAugmentations(i).getItem (Constants.ATTRIBUTE_PSVI); if (attrPSVI != null) { if (fStorePSVI) { ((PSVIAttrNSImpl) attr).setPSVI(attrPSVI); } Object type = attrPSVI.getMemberTypeDefinition(); if (type == null) { type = attrPSVI.getTypeDefinition(); if (type != null) { attr.setType (type); if (((XSSimpleType) type).isIDType()) { ((ElementImpl) elem).setIdAttributeNode (attr, true); } } } else { attr.setType (type); if (((XSSimpleType) type).isIDType()) { ((ElementImpl) elem).setIdAttributeNode (attr, true); } } } attr.setSpecified(attributes.isSpecified(i)); elem.setAttributeNode(attr); } } append(elem); fCurrentNode = elem; if (fFragmentRoot == null) { fFragmentRoot = elem; } }
Example 16
Source File: DOMNormalizer.java From hottub with GNU General Public License v2.0 | 4 votes |
/** * The start of an element. * * @param element The name of the element. * @param attributes The element attributes. * @param augs Additional information that may include infoset augmentations * * @exception XNIException * Thrown by handler to signal an error. */ public void startElement(QName element, XMLAttributes attributes, Augmentations augs) throws XNIException { Element currentElement = (Element) fCurrentNode; int attrCount = attributes.getLength(); if (DEBUG_EVENTS) { System.out.println("==>startElement: " +element+ " attrs.length="+attrCount); } for (int i = 0; i < attrCount; i++) { attributes.getName(i, fAttrQName); Attr attr = null; attr = currentElement.getAttributeNodeNS(fAttrQName.uri, fAttrQName.localpart); AttributePSVI attrPSVI = (AttributePSVI) attributes.getAugmentations(i).getItem(Constants.ATTRIBUTE_PSVI); if (attrPSVI != null) { //REVISIT: instead we should be using augmentations: // to set/retrieve Id attributes XSTypeDefinition decl = attrPSVI.getMemberTypeDefinition(); boolean id = false; if (decl != null){ id = ((XSSimpleType)decl).isIDType(); } else{ decl = attrPSVI.getTypeDefinition(); if (decl !=null){ id = ((XSSimpleType)decl).isIDType(); } } if (id){ ((ElementImpl)currentElement).setIdAttributeNode(attr, true); } if (fPSVI) { ((PSVIAttrNSImpl) attr).setPSVI(attrPSVI); } if ((fConfiguration.features & DOMConfigurationImpl.DTNORMALIZATION) != 0) { // datatype-normalization // NOTE: The specified value MUST be set after we set // the node value because that turns the "specified" // flag to "true" which may overwrite a "false" // value from the attribute list. boolean specified = attr.getSpecified(); attr.setValue(attrPSVI.getSchemaNormalizedValue()); if (!specified) { ((AttrImpl) attr).setSpecified(specified); } } } } }
Example 17
Source File: DOMNormalizer.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
/** * The start of an element. * * @param element The name of the element. * @param attributes The element attributes. * @param augs Additional information that may include infoset augmentations * * @exception XNIException * Thrown by handler to signal an error. */ public void startElement(QName element, XMLAttributes attributes, Augmentations augs) throws XNIException { Element currentElement = (Element) fCurrentNode; int attrCount = attributes.getLength(); if (DEBUG_EVENTS) { System.out.println("==>startElement: " +element+ " attrs.length="+attrCount); } for (int i = 0; i < attrCount; i++) { attributes.getName(i, fAttrQName); Attr attr = null; attr = currentElement.getAttributeNodeNS(fAttrQName.uri, fAttrQName.localpart); AttributePSVI attrPSVI = (AttributePSVI) attributes.getAugmentations(i).getItem(Constants.ATTRIBUTE_PSVI); if (attrPSVI != null) { //REVISIT: instead we should be using augmentations: // to set/retrieve Id attributes XSTypeDefinition decl = attrPSVI.getMemberTypeDefinition(); boolean id = false; if (decl != null){ id = ((XSSimpleType)decl).isIDType(); } else{ decl = attrPSVI.getTypeDefinition(); if (decl !=null){ id = ((XSSimpleType)decl).isIDType(); } } if (id){ ((ElementImpl)currentElement).setIdAttributeNode(attr, true); } if (fPSVI) { ((PSVIAttrNSImpl) attr).setPSVI(attrPSVI); } if ((fConfiguration.features & DOMConfigurationImpl.DTNORMALIZATION) != 0) { // datatype-normalization // NOTE: The specified value MUST be set after we set // the node value because that turns the "specified" // flag to "true" which may overwrite a "false" // value from the attribute list. boolean specified = attr.getSpecified(); attr.setValue(attrPSVI.getSchemaNormalizedValue()); if (!specified) { ((AttrImpl) attr).setSpecified(specified); } } } } }
Example 18
Source File: DOMResultBuilder.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
public void startElement(QName element, XMLAttributes attributes, Augmentations augs) throws XNIException { Element elem; int attrCount = attributes.getLength(); if (fDocumentImpl == null) { elem = fDocument.createElementNS(element.uri, element.rawname); for (int i = 0; i < attrCount; ++i) { attributes.getName(i, fAttributeQName); elem.setAttributeNS(fAttributeQName.uri, fAttributeQName.rawname, attributes.getValue(i)); } } // If it's a Xerces DOM store type information for attributes, set idness, etc.. else { elem = fDocumentImpl.createElementNS(element.uri, element.rawname, element.localpart); for (int i = 0; i < attrCount; ++i) { attributes.getName(i, fAttributeQName); AttrImpl attr = (AttrImpl) fDocumentImpl.createAttributeNS(fAttributeQName.uri, fAttributeQName.rawname, fAttributeQName.localpart); attr.setValue(attributes.getValue(i)); // write type information to this attribute AttributePSVI attrPSVI = (AttributePSVI) attributes.getAugmentations(i).getItem (Constants.ATTRIBUTE_PSVI); if (attrPSVI != null) { if (fStorePSVI) { ((PSVIAttrNSImpl) attr).setPSVI(attrPSVI); } Object type = attrPSVI.getMemberTypeDefinition(); if (type == null) { type = attrPSVI.getTypeDefinition(); if (type != null) { attr.setType (type); if (((XSSimpleType) type).isIDType()) { ((ElementImpl) elem).setIdAttributeNode (attr, true); } } } else { attr.setType (type); if (((XSSimpleType) type).isIDType()) { ((ElementImpl) elem).setIdAttributeNode (attr, true); } } } attr.setSpecified(attributes.isSpecified(i)); elem.setAttributeNode(attr); } } append(elem); fCurrentNode = elem; if (fFragmentRoot == null) { fFragmentRoot = elem; } }
Example 19
Source File: DOMNormalizer.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
/** * The start of an element. * * @param element The name of the element. * @param attributes The element attributes. * @param augs Additional information that may include infoset augmentations * * @exception XNIException * Thrown by handler to signal an error. */ public void startElement(QName element, XMLAttributes attributes, Augmentations augs) throws XNIException { Element currentElement = (Element) fCurrentNode; int attrCount = attributes.getLength(); if (DEBUG_EVENTS) { System.out.println("==>startElement: " +element+ " attrs.length="+attrCount); } for (int i = 0; i < attrCount; i++) { attributes.getName(i, fAttrQName); Attr attr = null; attr = currentElement.getAttributeNodeNS(fAttrQName.uri, fAttrQName.localpart); AttributePSVI attrPSVI = (AttributePSVI) attributes.getAugmentations(i).getItem(Constants.ATTRIBUTE_PSVI); if (attrPSVI != null) { //REVISIT: instead we should be using augmentations: // to set/retrieve Id attributes XSTypeDefinition decl = attrPSVI.getMemberTypeDefinition(); boolean id = false; if (decl != null){ id = ((XSSimpleType)decl).isIDType(); } else{ decl = attrPSVI.getTypeDefinition(); if (decl !=null){ id = ((XSSimpleType)decl).isIDType(); } } if (id){ ((ElementImpl)currentElement).setIdAttributeNode(attr, true); } if (fPSVI) { ((PSVIAttrNSImpl) attr).setPSVI(attrPSVI); } if ((fConfiguration.features & DOMConfigurationImpl.DTNORMALIZATION) != 0) { // datatype-normalization // NOTE: The specified value MUST be set after we set // the node value because that turns the "specified" // flag to "true" which may overwrite a "false" // value from the attribute list. boolean specified = attr.getSpecified(); attr.setValue(attrPSVI.getSchemaNormalizedValue()); if (!specified) { ((AttrImpl) attr).setSpecified(specified); } } } } }
Example 20
Source File: DOMResultBuilder.java From jdk1.8-source-analysis with Apache License 2.0 | 4 votes |
public void startElement(QName element, XMLAttributes attributes, Augmentations augs) throws XNIException { Element elem; int attrCount = attributes.getLength(); if (fDocumentImpl == null) { elem = fDocument.createElementNS(element.uri, element.rawname); for (int i = 0; i < attrCount; ++i) { attributes.getName(i, fAttributeQName); elem.setAttributeNS(fAttributeQName.uri, fAttributeQName.rawname, attributes.getValue(i)); } } // If it's a Xerces DOM store type information for attributes, set idness, etc.. else { elem = fDocumentImpl.createElementNS(element.uri, element.rawname, element.localpart); for (int i = 0; i < attrCount; ++i) { attributes.getName(i, fAttributeQName); AttrImpl attr = (AttrImpl) fDocumentImpl.createAttributeNS(fAttributeQName.uri, fAttributeQName.rawname, fAttributeQName.localpart); attr.setValue(attributes.getValue(i)); // write type information to this attribute AttributePSVI attrPSVI = (AttributePSVI) attributes.getAugmentations(i).getItem (Constants.ATTRIBUTE_PSVI); if (attrPSVI != null) { if (fStorePSVI) { ((PSVIAttrNSImpl) attr).setPSVI(attrPSVI); } Object type = attrPSVI.getMemberTypeDefinition(); if (type == null) { type = attrPSVI.getTypeDefinition(); if (type != null) { attr.setType (type); if (((XSSimpleType) type).isIDType()) { ((ElementImpl) elem).setIdAttributeNode (attr, true); } } } else { attr.setType (type); if (((XSSimpleType) type).isIDType()) { ((ElementImpl) elem).setIdAttributeNode (attr, true); } } } attr.setSpecified(attributes.isSpecified(i)); elem.setAttributeNode(attr); } } append(elem); fCurrentNode = elem; if (fFragmentRoot == null) { fFragmentRoot = elem; } }