com.sun.org.apache.xerces.internal.dom.AttrImpl Java Examples
The following examples show how to use
com.sun.org.apache.xerces.internal.dom.AttrImpl.
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: DOMResultAugmentor.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
/** Returns whether the given attribute is an ID type. **/ private boolean processAttributePSVI(AttrImpl attr, AttributePSVI attrPSVI) { if (fStorePSVI) { ((PSVIAttrNSImpl) attr).setPSVI (attrPSVI); } Object type = attrPSVI.getMemberTypeDefinition (); if (type == null) { type = attrPSVI.getTypeDefinition (); if (type != null) { attr.setType(type); return ((XSSimpleType) type).isIDType(); } } else { attr.setType(type); return ((XSSimpleType) type).isIDType(); } return false; }
Example #2
Source File: DOMResultAugmentor.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
/** Returns whether the given attribute is an ID type. **/ private boolean processAttributePSVI(AttrImpl attr, AttributePSVI attrPSVI) { if (fStorePSVI) { ((PSVIAttrNSImpl) attr).setPSVI (attrPSVI); } Object type = attrPSVI.getMemberTypeDefinition (); if (type == null) { type = attrPSVI.getTypeDefinition (); if (type != null) { attr.setType(type); return ((XSSimpleType) type).isIDType(); } } else { attr.setType(type); return ((XSSimpleType) type).isIDType(); } return false; }
Example #3
Source File: DOMResultAugmentor.java From Bytecoder with Apache License 2.0 | 6 votes |
/** Returns whether the given attribute is an ID type. **/ private boolean processAttributePSVI(AttrImpl attr, AttributePSVI attrPSVI) { if (fStorePSVI) { ((PSVIAttrNSImpl) attr).setPSVI (attrPSVI); } Object type = attrPSVI.getMemberTypeDefinition (); if (type == null) { type = attrPSVI.getTypeDefinition (); if (type != null) { attr.setType(type); return ((XSSimpleType) type).isIDType(); } } else { attr.setType(type); return ((XSSimpleType) type).isIDType(); } return false; }
Example #4
Source File: DOMResultAugmentor.java From jdk1.8-source-analysis with Apache License 2.0 | 6 votes |
/** Returns whether the given attribute is an ID type. **/ private boolean processAttributePSVI(AttrImpl attr, AttributePSVI attrPSVI) { if (fStorePSVI) { ((PSVIAttrNSImpl) attr).setPSVI (attrPSVI); } Object type = attrPSVI.getMemberTypeDefinition (); if (type == null) { type = attrPSVI.getTypeDefinition (); if (type != null) { attr.setType(type); return ((XSSimpleType) type).isIDType(); } } else { attr.setType(type); return ((XSSimpleType) type).isIDType(); } return false; }
Example #5
Source File: DOMResultAugmentor.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
/** Returns whether the given attribute is an ID type. **/ private boolean processAttributePSVI(AttrImpl attr, AttributePSVI attrPSVI) { if (fStorePSVI) { ((PSVIAttrNSImpl) attr).setPSVI (attrPSVI); } Object type = attrPSVI.getMemberTypeDefinition (); if (type == null) { type = attrPSVI.getTypeDefinition (); if (type != null) { attr.setType(type); return ((XSSimpleType) type).isIDType(); } } else { attr.setType(type); return ((XSSimpleType) type).isIDType(); } return false; }
Example #6
Source File: DOMResultAugmentor.java From hottub with GNU General Public License v2.0 | 6 votes |
/** Returns whether the given attribute is an ID type. **/ private boolean processAttributePSVI(AttrImpl attr, AttributePSVI attrPSVI) { if (fStorePSVI) { ((PSVIAttrNSImpl) attr).setPSVI (attrPSVI); } Object type = attrPSVI.getMemberTypeDefinition (); if (type == null) { type = attrPSVI.getTypeDefinition (); if (type != null) { attr.setType(type); return ((XSSimpleType) type).isIDType(); } } else { attr.setType(type); return ((XSSimpleType) type).isIDType(); } return false; }
Example #7
Source File: DOMResultAugmentor.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
/** Returns whether the given attribute is an ID type. **/ private boolean processAttributePSVI(AttrImpl attr, AttributePSVI attrPSVI) { if (fStorePSVI) { ((PSVIAttrNSImpl) attr).setPSVI (attrPSVI); } Object type = attrPSVI.getMemberTypeDefinition (); if (type == null) { type = attrPSVI.getTypeDefinition (); if (type != null) { attr.setType(type); return ((XSSimpleType) type).isIDType(); } } else { attr.setType(type); return ((XSSimpleType) type).isIDType(); } return false; }
Example #8
Source File: DOMResultAugmentor.java From JDKSourceCode1.8 with MIT License | 6 votes |
/** Returns whether the given attribute is an ID type. **/ private boolean processAttributePSVI(AttrImpl attr, AttributePSVI attrPSVI) { if (fStorePSVI) { ((PSVIAttrNSImpl) attr).setPSVI (attrPSVI); } Object type = attrPSVI.getMemberTypeDefinition (); if (type == null) { type = attrPSVI.getTypeDefinition (); if (type != null) { attr.setType(type); return ((XSSimpleType) type).isIDType(); } } else { attr.setType(type); return ((XSSimpleType) type).isIDType(); } return false; }
Example #9
Source File: DOMResultAugmentor.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
/** Returns whether the given attribute is an ID type. **/ private boolean processAttributePSVI(AttrImpl attr, AttributePSVI attrPSVI) { if (fStorePSVI) { ((PSVIAttrNSImpl) attr).setPSVI (attrPSVI); } Object type = attrPSVI.getMemberTypeDefinition (); if (type == null) { type = attrPSVI.getTypeDefinition (); if (type != null) { attr.setType(type); return ((XSSimpleType) type).isIDType(); } } else { attr.setType(type); return ((XSSimpleType) type).isIDType(); } return false; }
Example #10
Source File: DOMResultAugmentor.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
/** Returns whether the given attribute is an ID type. **/ private boolean processAttributePSVI(AttrImpl attr, AttributePSVI attrPSVI) { if (fStorePSVI) { ((PSVIAttrNSImpl) attr).setPSVI (attrPSVI); } Object type = attrPSVI.getMemberTypeDefinition (); if (type == null) { type = attrPSVI.getTypeDefinition (); if (type != null) { attr.setType(type); return ((XSSimpleType) type).isIDType(); } } else { attr.setType(type); return ((XSSimpleType) type).isIDType(); } return false; }
Example #11
Source File: DOMResultAugmentor.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
/** Returns whether the given attribute is an ID type. **/ private boolean processAttributePSVI(AttrImpl attr, AttributePSVI attrPSVI) { if (fStorePSVI) { ((PSVIAttrNSImpl) attr).setPSVI (attrPSVI); } Object type = attrPSVI.getMemberTypeDefinition (); if (type == null) { type = attrPSVI.getTypeDefinition (); if (type != null) { attr.setType(type); return ((XSSimpleType) type).isIDType(); } } else { attr.setType(type); return ((XSSimpleType) type).isIDType(); } return false; }
Example #12
Source File: ProtoResourceUsageAnalyzer.java From bazel with Apache License 2.0 | 5 votes |
@VisibleForTesting public static Attr createSimpleAttr(String simpleName, String simpleValue) { return new AttrImpl() { @Override public String getLocalName() { return simpleName; } @Override public String getValue() { return simpleValue; } }; }
Example #13
Source File: DOMResultBuilder.java From openjdk-8-source 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: DOMUtil.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
/** * Copies the source tree into the specified place in a destination * tree. The source node and its children are appended as children * of the destination node. * <p> * <em>Note:</em> This is an iterative implementation. */ public static void copyInto(Node src, Node dest) throws DOMException { // get node factory Document factory = dest.getOwnerDocument(); boolean domimpl = factory instanceof DocumentImpl; // placement variables Node start = src; Node parent = src; Node place = src; // traverse source tree while (place != null) { // copy this node Node node = null; int type = place.getNodeType(); switch (type) { case Node.CDATA_SECTION_NODE: { node = factory.createCDATASection(place.getNodeValue()); break; } case Node.COMMENT_NODE: { node = factory.createComment(place.getNodeValue()); break; } case Node.ELEMENT_NODE: { Element element = factory.createElement(place.getNodeName()); node = element; NamedNodeMap attrs = place.getAttributes(); int attrCount = attrs.getLength(); for (int i = 0; i < attrCount; i++) { Attr attr = (Attr)attrs.item(i); String attrName = attr.getNodeName(); String attrValue = attr.getNodeValue(); element.setAttribute(attrName, attrValue); if (domimpl && !attr.getSpecified()) { ((AttrImpl)element.getAttributeNode(attrName)).setSpecified(false); } } break; } case Node.ENTITY_REFERENCE_NODE: { node = factory.createEntityReference(place.getNodeName()); break; } case Node.PROCESSING_INSTRUCTION_NODE: { node = factory.createProcessingInstruction(place.getNodeName(), place.getNodeValue()); break; } case Node.TEXT_NODE: { node = factory.createTextNode(place.getNodeValue()); break; } default: { throw new IllegalArgumentException("can't copy node type, "+ type+" ("+ place.getNodeName()+')'); } } dest.appendChild(node); // iterate over children if (place.hasChildNodes()) { parent = place; place = place.getFirstChild(); dest = node; } // advance else { place = place.getNextSibling(); while (place == null && parent != start) { place = parent.getNextSibling(); parent = parent.getParentNode(); dest = dest.getParentNode(); } } } }
Example #15
Source File: DOMUtil.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
/** * Copies the source tree into the specified place in a destination * tree. The source node and its children are appended as children * of the destination node. * <p> * <em>Note:</em> This is an iterative implementation. */ public static void copyInto(Node src, Node dest) throws DOMException { // get node factory Document factory = dest.getOwnerDocument(); boolean domimpl = factory instanceof DocumentImpl; // placement variables Node start = src; Node parent = src; Node place = src; // traverse source tree while (place != null) { // copy this node Node node = null; int type = place.getNodeType(); switch (type) { case Node.CDATA_SECTION_NODE: { node = factory.createCDATASection(place.getNodeValue()); break; } case Node.COMMENT_NODE: { node = factory.createComment(place.getNodeValue()); break; } case Node.ELEMENT_NODE: { Element element = factory.createElement(place.getNodeName()); node = element; NamedNodeMap attrs = place.getAttributes(); int attrCount = attrs.getLength(); for (int i = 0; i < attrCount; i++) { Attr attr = (Attr)attrs.item(i); String attrName = attr.getNodeName(); String attrValue = attr.getNodeValue(); element.setAttribute(attrName, attrValue); if (domimpl && !attr.getSpecified()) { ((AttrImpl)element.getAttributeNode(attrName)).setSpecified(false); } } break; } case Node.ENTITY_REFERENCE_NODE: { node = factory.createEntityReference(place.getNodeName()); break; } case Node.PROCESSING_INSTRUCTION_NODE: { node = factory.createProcessingInstruction(place.getNodeName(), place.getNodeValue()); break; } case Node.TEXT_NODE: { node = factory.createTextNode(place.getNodeValue()); break; } default: { throw new IllegalArgumentException("can't copy node type, "+ type+" ("+ place.getNodeName()+')'); } } dest.appendChild(node); // iterate over children if (place.hasChildNodes()) { parent = place; place = place.getFirstChild(); dest = node; } // advance else { place = place.getNextSibling(); while (place == null && parent != start) { place = parent.getNextSibling(); parent = parent.getParentNode(); dest = dest.getParentNode(); } } } }
Example #16
Source File: DOMUtil.java From hottub with GNU General Public License v2.0 | 4 votes |
/** * Copies the source tree into the specified place in a destination * tree. The source node and its children are appended as children * of the destination node. * <p> * <em>Note:</em> This is an iterative implementation. */ public static void copyInto(Node src, Node dest) throws DOMException { // get node factory Document factory = dest.getOwnerDocument(); boolean domimpl = factory instanceof DocumentImpl; // placement variables Node start = src; Node parent = src; Node place = src; // traverse source tree while (place != null) { // copy this node Node node = null; int type = place.getNodeType(); switch (type) { case Node.CDATA_SECTION_NODE: { node = factory.createCDATASection(place.getNodeValue()); break; } case Node.COMMENT_NODE: { node = factory.createComment(place.getNodeValue()); break; } case Node.ELEMENT_NODE: { Element element = factory.createElement(place.getNodeName()); node = element; NamedNodeMap attrs = place.getAttributes(); int attrCount = attrs.getLength(); for (int i = 0; i < attrCount; i++) { Attr attr = (Attr)attrs.item(i); String attrName = attr.getNodeName(); String attrValue = attr.getNodeValue(); element.setAttribute(attrName, attrValue); if (domimpl && !attr.getSpecified()) { ((AttrImpl)element.getAttributeNode(attrName)).setSpecified(false); } } break; } case Node.ENTITY_REFERENCE_NODE: { node = factory.createEntityReference(place.getNodeName()); break; } case Node.PROCESSING_INSTRUCTION_NODE: { node = factory.createProcessingInstruction(place.getNodeName(), place.getNodeValue()); break; } case Node.TEXT_NODE: { node = factory.createTextNode(place.getNodeValue()); break; } default: { throw new IllegalArgumentException("can't copy node type, "+ type+" ("+ place.getNodeName()+')'); } } dest.appendChild(node); // iterate over children if (place.hasChildNodes()) { parent = place; place = place.getFirstChild(); dest = node; } // advance else { place = place.getNextSibling(); while (place == null && parent != start) { place = parent.getNextSibling(); parent = parent.getParentNode(); dest = dest.getParentNode(); } } } }
Example #17
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 #18
Source File: DOMResultBuilder.java From openjdk-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: DOMUtil.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
/** * Copies the source tree into the specified place in a destination * tree. The source node and its children are appended as children * of the destination node. * <p> * <em>Note:</em> This is an iterative implementation. */ public static void copyInto(Node src, Node dest) throws DOMException { // get node factory Document factory = dest.getOwnerDocument(); boolean domimpl = factory instanceof DocumentImpl; // placement variables Node start = src; Node parent = src; Node place = src; // traverse source tree while (place != null) { // copy this node Node node = null; int type = place.getNodeType(); switch (type) { case Node.CDATA_SECTION_NODE: { node = factory.createCDATASection(place.getNodeValue()); break; } case Node.COMMENT_NODE: { node = factory.createComment(place.getNodeValue()); break; } case Node.ELEMENT_NODE: { Element element = factory.createElement(place.getNodeName()); node = element; NamedNodeMap attrs = place.getAttributes(); int attrCount = attrs.getLength(); for (int i = 0; i < attrCount; i++) { Attr attr = (Attr)attrs.item(i); String attrName = attr.getNodeName(); String attrValue = attr.getNodeValue(); element.setAttribute(attrName, attrValue); if (domimpl && !attr.getSpecified()) { ((AttrImpl)element.getAttributeNode(attrName)).setSpecified(false); } } break; } case Node.ENTITY_REFERENCE_NODE: { node = factory.createEntityReference(place.getNodeName()); break; } case Node.PROCESSING_INSTRUCTION_NODE: { node = factory.createProcessingInstruction(place.getNodeName(), place.getNodeValue()); break; } case Node.TEXT_NODE: { node = factory.createTextNode(place.getNodeValue()); break; } default: { throw new IllegalArgumentException("can't copy node type, "+ type+" ("+ place.getNodeName()+')'); } } dest.appendChild(node); // iterate over children if (place.hasChildNodes()) { parent = place; place = place.getFirstChild(); dest = node; } // advance else { place = place.getNextSibling(); while (place == null && parent != start) { place = parent.getNextSibling(); parent = parent.getParentNode(); dest = dest.getParentNode(); } } } }
Example #20
Source File: DOMUtil.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
/** * Copies the source tree into the specified place in a destination * tree. The source node and its children are appended as children * of the destination node. * <p> * <em>Note:</em> This is an iterative implementation. */ public static void copyInto(Node src, Node dest) throws DOMException { // get node factory Document factory = dest.getOwnerDocument(); boolean domimpl = factory instanceof DocumentImpl; // placement variables Node start = src; Node parent = src; Node place = src; // traverse source tree while (place != null) { // copy this node Node node = null; int type = place.getNodeType(); switch (type) { case Node.CDATA_SECTION_NODE: { node = factory.createCDATASection(place.getNodeValue()); break; } case Node.COMMENT_NODE: { node = factory.createComment(place.getNodeValue()); break; } case Node.ELEMENT_NODE: { Element element = factory.createElement(place.getNodeName()); node = element; NamedNodeMap attrs = place.getAttributes(); int attrCount = attrs.getLength(); for (int i = 0; i < attrCount; i++) { Attr attr = (Attr)attrs.item(i); String attrName = attr.getNodeName(); String attrValue = attr.getNodeValue(); element.setAttribute(attrName, attrValue); if (domimpl && !attr.getSpecified()) { ((AttrImpl)element.getAttributeNode(attrName)).setSpecified(false); } } break; } case Node.ENTITY_REFERENCE_NODE: { node = factory.createEntityReference(place.getNodeName()); break; } case Node.PROCESSING_INSTRUCTION_NODE: { node = factory.createProcessingInstruction(place.getNodeName(), place.getNodeValue()); break; } case Node.TEXT_NODE: { node = factory.createTextNode(place.getNodeValue()); break; } default: { throw new IllegalArgumentException("can't copy node type, "+ type+" ("+ place.getNodeName()+')'); } } dest.appendChild(node); // iterate over children if (place.hasChildNodes()) { parent = place; place = place.getFirstChild(); dest = node; } // advance else { place = place.getNextSibling(); while (place == null && parent != start) { place = parent.getNextSibling(); parent = parent.getParentNode(); dest = dest.getParentNode(); } } } }
Example #21
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 #22
Source File: DOMUtil.java From Bytecoder with Apache License 2.0 | 4 votes |
/** * Copies the source tree into the specified place in a destination * tree. The source node and its children are appended as children * of the destination node. * <p> * <em>Note:</em> This is an iterative implementation. */ public static void copyInto(Node src, Node dest) throws DOMException { // get node factory Document factory = dest.getOwnerDocument(); boolean domimpl = factory instanceof DocumentImpl; // placement variables Node start = src; Node parent = src; Node place = src; // traverse source tree while (place != null) { // copy this node Node node = null; int type = place.getNodeType(); switch (type) { case Node.CDATA_SECTION_NODE: { node = factory.createCDATASection(place.getNodeValue()); break; } case Node.COMMENT_NODE: { node = factory.createComment(place.getNodeValue()); break; } case Node.ELEMENT_NODE: { Element element = factory.createElement(place.getNodeName()); node = element; NamedNodeMap attrs = place.getAttributes(); int attrCount = attrs.getLength(); for (int i = 0; i < attrCount; i++) { Attr attr = (Attr)attrs.item(i); String attrName = attr.getNodeName(); String attrValue = attr.getNodeValue(); element.setAttribute(attrName, attrValue); if (domimpl && !attr.getSpecified()) { ((AttrImpl)element.getAttributeNode(attrName)).setSpecified(false); } } break; } case Node.ENTITY_REFERENCE_NODE: { node = factory.createEntityReference(place.getNodeName()); break; } case Node.PROCESSING_INSTRUCTION_NODE: { node = factory.createProcessingInstruction(place.getNodeName(), place.getNodeValue()); break; } case Node.TEXT_NODE: { node = factory.createTextNode(place.getNodeValue()); break; } default: { throw new IllegalArgumentException("can't copy node type, "+ type+" ("+ place.getNodeName()+')'); } } dest.appendChild(node); // iterate over children if (place.hasChildNodes()) { parent = place; place = place.getFirstChild(); dest = node; } // advance else { place = place.getNextSibling(); while (place == null && parent != start) { place = parent.getNextSibling(); parent = parent.getParentNode(); dest = dest.getParentNode(); } } } }
Example #23
Source File: DOMResultBuilder.java From Bytecoder 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; } }
Example #24
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 #25
Source File: DOMUtil.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
/** * Copies the source tree into the specified place in a destination * tree. The source node and its children are appended as children * of the destination node. * <p> * <em>Note:</em> This is an iterative implementation. */ public static void copyInto(Node src, Node dest) throws DOMException { // get node factory Document factory = dest.getOwnerDocument(); boolean domimpl = factory instanceof DocumentImpl; // placement variables Node start = src; Node parent = src; Node place = src; // traverse source tree while (place != null) { // copy this node Node node = null; int type = place.getNodeType(); switch (type) { case Node.CDATA_SECTION_NODE: { node = factory.createCDATASection(place.getNodeValue()); break; } case Node.COMMENT_NODE: { node = factory.createComment(place.getNodeValue()); break; } case Node.ELEMENT_NODE: { Element element = factory.createElement(place.getNodeName()); node = element; NamedNodeMap attrs = place.getAttributes(); int attrCount = attrs.getLength(); for (int i = 0; i < attrCount; i++) { Attr attr = (Attr)attrs.item(i); String attrName = attr.getNodeName(); String attrValue = attr.getNodeValue(); element.setAttribute(attrName, attrValue); if (domimpl && !attr.getSpecified()) { ((AttrImpl)element.getAttributeNode(attrName)).setSpecified(false); } } break; } case Node.ENTITY_REFERENCE_NODE: { node = factory.createEntityReference(place.getNodeName()); break; } case Node.PROCESSING_INSTRUCTION_NODE: { node = factory.createProcessingInstruction(place.getNodeName(), place.getNodeValue()); break; } case Node.TEXT_NODE: { node = factory.createTextNode(place.getNodeValue()); break; } default: { throw new IllegalArgumentException("can't copy node type, "+ type+" ("+ place.getNodeName()+')'); } } dest.appendChild(node); // iterate over children if (place.hasChildNodes()) { parent = place; place = place.getFirstChild(); dest = node; } // advance else { place = place.getNextSibling(); while (place == null && parent != start) { place = parent.getNextSibling(); parent = parent.getParentNode(); dest = dest.getParentNode(); } } } }
Example #26
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 #27
Source File: DOMUtil.java From JDKSourceCode1.8 with MIT License | 4 votes |
/** * Copies the source tree into the specified place in a destination * tree. The source node and its children are appended as children * of the destination node. * <p> * <em>Note:</em> This is an iterative implementation. */ public static void copyInto(Node src, Node dest) throws DOMException { // get node factory Document factory = dest.getOwnerDocument(); boolean domimpl = factory instanceof DocumentImpl; // placement variables Node start = src; Node parent = src; Node place = src; // traverse source tree while (place != null) { // copy this node Node node = null; int type = place.getNodeType(); switch (type) { case Node.CDATA_SECTION_NODE: { node = factory.createCDATASection(place.getNodeValue()); break; } case Node.COMMENT_NODE: { node = factory.createComment(place.getNodeValue()); break; } case Node.ELEMENT_NODE: { Element element = factory.createElement(place.getNodeName()); node = element; NamedNodeMap attrs = place.getAttributes(); int attrCount = attrs.getLength(); for (int i = 0; i < attrCount; i++) { Attr attr = (Attr)attrs.item(i); String attrName = attr.getNodeName(); String attrValue = attr.getNodeValue(); element.setAttribute(attrName, attrValue); if (domimpl && !attr.getSpecified()) { ((AttrImpl)element.getAttributeNode(attrName)).setSpecified(false); } } break; } case Node.ENTITY_REFERENCE_NODE: { node = factory.createEntityReference(place.getNodeName()); break; } case Node.PROCESSING_INSTRUCTION_NODE: { node = factory.createProcessingInstruction(place.getNodeName(), place.getNodeValue()); break; } case Node.TEXT_NODE: { node = factory.createTextNode(place.getNodeValue()); break; } default: { throw new IllegalArgumentException("can't copy node type, "+ type+" ("+ place.getNodeName()+')'); } } dest.appendChild(node); // iterate over children if (place.hasChildNodes()) { parent = place; place = place.getFirstChild(); dest = node; } // advance else { place = place.getNextSibling(); while (place == null && parent != start) { place = parent.getNextSibling(); parent = parent.getParentNode(); dest = dest.getParentNode(); } } } }
Example #28
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 #29
Source File: DOMUtil.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
/** * Copies the source tree into the specified place in a destination * tree. The source node and its children are appended as children * of the destination node. * <p> * <em>Note:</em> This is an iterative implementation. */ public static void copyInto(Node src, Node dest) throws DOMException { // get node factory Document factory = dest.getOwnerDocument(); boolean domimpl = factory instanceof DocumentImpl; // placement variables Node start = src; Node parent = src; Node place = src; // traverse source tree while (place != null) { // copy this node Node node = null; int type = place.getNodeType(); switch (type) { case Node.CDATA_SECTION_NODE: { node = factory.createCDATASection(place.getNodeValue()); break; } case Node.COMMENT_NODE: { node = factory.createComment(place.getNodeValue()); break; } case Node.ELEMENT_NODE: { Element element = factory.createElement(place.getNodeName()); node = element; NamedNodeMap attrs = place.getAttributes(); int attrCount = attrs.getLength(); for (int i = 0; i < attrCount; i++) { Attr attr = (Attr)attrs.item(i); String attrName = attr.getNodeName(); String attrValue = attr.getNodeValue(); element.setAttribute(attrName, attrValue); if (domimpl && !attr.getSpecified()) { ((AttrImpl)element.getAttributeNode(attrName)).setSpecified(false); } } break; } case Node.ENTITY_REFERENCE_NODE: { node = factory.createEntityReference(place.getNodeName()); break; } case Node.PROCESSING_INSTRUCTION_NODE: { node = factory.createProcessingInstruction(place.getNodeName(), place.getNodeValue()); break; } case Node.TEXT_NODE: { node = factory.createTextNode(place.getNodeValue()); break; } default: { throw new IllegalArgumentException("can't copy node type, "+ type+" ("+ place.getNodeName()+')'); } } dest.appendChild(node); // iterate over children if (place.hasChildNodes()) { parent = place; place = place.getFirstChild(); dest = node; } // advance else { place = place.getNextSibling(); while (place == null && parent != start) { place = parent.getNextSibling(); parent = parent.getParentNode(); dest = dest.getParentNode(); } } } }
Example #30
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; } }