Start a new XML element using the given name and attribute set.
179894
public void startElement(String elemName, Attributes attrs) {
        writeStartElement(elemName, attrs);
        m_tagStack.push(elemName);
    }
1317586
def start_element (self, tag, attrs):
        """"""
        if tag == 'meta' and attrs.get('name') == 'robots':
            val = attrs.get_true('content', u'').lower().split(u',')
            self.follow = u'nofollow' not in val
            self.index = u'noindex' not in val
            raise StopParse("found <meta name=robots> tag")
        elif tag == 'body':
            raise StopParse("found <body> tag")
829413
def StartElement(self, name, attributes):
        '''
        
        '''
        if name == 'hierarchy':
            pass
        elif name == 'node':
            # Instantiate an Element object
            attributes['uniqueId'] = 'id/no_id/%d' % self.idCount
            bounds = re.split('[\][,]', attributes['bounds'])
            attributes['bounds'] = ((int(bounds[1]), int(bounds[2])), (int(bounds[4]), int(bounds[5])))
            if DEBUG_BOUNDS:
                print >> sys.stderr, "bounds=", attributes['bounds']
            self.idCount += 1
            child = View.factory(attributes, self.device, version=self.version, uiAutomatorHelper=self.uiAutomatorHelper)
            self.views.append(child)
            # Push element onto the stack and make it a child of parent
            if not self.nodeStack:
                self.root = child
            else:
                self.parent = self.nodeStack[-1]
                self.parent.add(child)
            self.nodeStack.append(child)
240210
def newNode(name):
    
    ret = libxml2mod.xmlNewNode(name)
    if ret is None:raise treeError('xmlNewNode() failed')
    return xmlNode(_obj=ret)
55824
def setProp(self, name, value):
        
        ret = libxml2mod.xmlSetProp(self._o, name, value)
        if ret is None:raise treeError('xmlSetProp() failed')
        __tmp = xmlAttr(_obj=ret)
        return __tmp
791667
@Override
    public void startElement(String namespace, String localName, String qName, Attributes attributes) throws SAXException {

        if (skipElementUntil != null) {
            elementStack.push(skippableElement);
            return;
        }

        boolean mixedContent = detectMixedContent();

        if (builder.xsiTypeSupport && attributes.getValue("http://www.w3.org/2001/XMLSchema-instance", "type") != null) {
            String type = attributes.getValue("http://www.w3.org/2001/XMLSchema-instance", "type");

            if (type.contains(":")) {
                String[] split = type.split(":");
                namespace = prefixUriMap.get(split[0]);
                localName = split[1];
            } else {
                localName = type;
            }
        }

        Element<ResourceType, Datatype> element = new Element<>(this, builder);
        element.index = index++;

        namespace = calculateNamespace(namespace);

        element.setType(namespace + localName);

        if (builder.skipElementMap != null && builder.skipElementMap.containsKey(element.getType())) {
            skipElementUntil = element;
            elementStack.push(element);
            return;
        }


        Element<ResourceType, Datatype> parent = null;

        if (!elementStack.isEmpty()) {
            parent = elementStack.peek();
            if (builder.addIndex) {
                element.elementIndex = parent.indexMap.plusPlus(element.getType());
            }
            parent.hasChild.add(element);
            if(builder.useHashmapForChildren){
                parent.hasChildMap.put(element.getType(), element);
            }
            if (mixedContent) {
                parent.addMixedContent(element);
            }

        }

        element.parent = parent;

        renameElement(namespace, localName, element);

        if (builder.forcedMixedContentMap != null &&
            builder.forcedMixedContentMap.containsKey(element.getType())) {

            element.containsMixedContent = true;
        }


        if (builder.compositeIdMap != null) {

            CompositeId compositeId = builder.compositeIdMap.get(element.getType());
            if (compositeId == null) {
                calculateNodeId(element);
            } else {
                element.compositeId = compositeId.simpleClone();
                if(element.compositeId.elementIndex){
                    element.compositeId.reolveElementIndex(XmlToRdfVocabulary.index, element.index);
                    element.compositeId.reolveElementIndex(XmlToRdfVocabulary.elementIndex, element.elementIndex);
                }

            }

        } else {
            calculateNodeId(element);
        }

        handleAttributes(namespace, attributes, element);

        if (builder.useElementAsPredicateMap != null && builder.useElementAsPredicateMap.containsKey(element.getType())) {
            element.useElementAsPredicate = true;
        }

        builder.doComplexTransformElementAtStartOfElement(element);


        elementStack.push(element);

    }
1255164
private void addToCreateElements(String elementName) {
        HashMap<String, String> elementAttributes = new HashMap<>();

        elementAttributes.put(XsdAbstractElement.NAME_TAG, elementName);

        if (!createdElements.containsKey(getCleanName(elementName))){
            createdElements.put(getCleanName(elementName), new XsdElement(null, elementAttributes));
        }
    }
1059139
@Override
    public void startElement(final String uri, final String localName, final String name, final Attributes atts)
            throws SAXException {
        AttributesImpl resAtts = null;
        final String conkeyref = atts.getValue(ATTRIBUTE_NAME_CONKEYREF);
        conkeyref: if (conkeyref != null) {
            final int keyIndex = conkeyref.indexOf(SLASH);
            final String key = keyIndex != -1 ? conkeyref.substring(0, keyIndex) : conkeyref;
            final KeyDef keyDef = keys.get(key);
            if (keyDef != null) {
                final String id = keyIndex != -1 ? conkeyref.substring(keyIndex + 1) : null;
                if (delayConrefUtils != null) {
                    final List<Boolean> list = delayConrefUtils.checkExport(stripFragment(keyDef.href).toString(), id, key, job.tempDir);
                    final boolean idExported = list.get(0);
                    final boolean keyrefExported = list.get(1);
                    //both id and key are exported and transtype is eclipsehelp
                    if (idExported && keyrefExported) {
                        break conkeyref;
                    }
                }
                resAtts = new AttributesImpl(atts);
                XMLUtils.removeAttribute(resAtts, ATTRIBUTE_NAME_CONKEYREF);
                final KeyDef k = keys.get(key);
                if (k.href != null && (k.scope.equals(ATTR_SCOPE_VALUE_LOCAL))) {
                    URI target = getRelativePath(k.href);
                    final String keyFragment = k.href.getFragment();
                    if (id != null && keyFragment != null) {
                        target = setFragment(target, keyFragment + SLASH + id);
                    } else if (id != null) {
                        target = setFragment(target, id);
                    } else if (keyFragment != null) {
                        target = setFragment(target, keyFragment);
                    }
                    XMLUtils.addOrSetAttribute(resAtts, ATTRIBUTE_NAME_CONREF, target.toString());
                } else {
                    logger.warn(MessageUtils.getMessage("DOTJ060W", key, conkeyref).toString());
                }
            } else {
                logger.error(MessageUtils.getMessage("DOTJ046E", conkeyref).toString());
            }
        }
        getContentHandler().startElement(uri, localName, name, resAtts != null ? resAtts : atts);
    }
993740
public void beginElement(String elementName) throws IOException {		
		addElementName(elementName);
		indent();
		writer.write("<");
		writer.write(elementName);
	}
666709
@Override
    public void startElement(String namespaceURI, String localName,
            String qName, Attributes atts) throws SAXException {
        try {
            if (XHTML_NS.equals(namespaceURI)) {

                if ("meta".equals(localName)
                        && ((atts.getIndex("", "http-equiv") != -1) || (atts.getIndex(
                                "", "httpequiv") != -1))) {
                    return;
                }

                // start and element name
                this.writer.write('<');
                this.writer.write(localName);

                // attributes
                int length = atts.getLength();
                boolean langPrinted = false;
                for (int i = 0; i < length; i++) {
                    String ns = atts.getURI(i);
                    String name = null;
                    if ("".equals(ns)) {
                        name = atts.getLocalName(i);
                    } else if ("http://www.w3.org/XML/1998/namespace".equals(ns)
                            && "lang".equals(atts.getLocalName(i))) {
                        name = "lang";
                    }
                    if (name != null && !(langPrinted && "lang".equals(name))) {
                        this.writer.write(' ');
                        this.writer.write(name);
                        if ("lang".equals(name)) {
                            langPrinted = true;
                        }
                        if (Arrays.binarySearch(booleanAttributes, name) < 0) {
                            // write value, escape certain characters
                            this.writer.write("=\"");
                            String value = atts.getValue(i);
                            for (int j = 0; j < value.length(); j++) {
                                char c = value.charAt(j);
                                switch (c) {
                                    case '<':
                                        this.writer.write("&lt;");
                                        break;
                                    case '>':
                                        this.writer.write("&gt;");
                                        break;
                                    case '&':
                                        this.writer.write("&amp;");
                                        break;
                                    case '"':
                                        this.writer.write("&quot;");
                                        break;
                                    default:
                                        this.writer.write(c);
                                }
                            }

                            this.writer.write('"');
                        }
                    }
                }

                // close
                this.writer.write('>');
                if (emitMeta && "head".equals(localName)) {
                    this.writer.write("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=");
                    this.writer.write(encoding);
                    this.writer.write("\">");
                }
            }
        } catch (IOException ioe) {
            throw (SAXException)new SAXException(ioe).initCause(ioe);
        }
    }
840651
@Override
    public void startElement(CMLStack xpath, String uri, String local, String raw, Attributes atts) {
        //		<molecule convention="md:mdMolecule"
        //	          xmlns="http://www.xml-cml.org/schema"
        //	          xmlns:md="http://www.bioclipse.org/mdmolecule">
        //	  <atomArray>
        //	    <atom id="a1" elementType="C"/>
        //	    <atom id="a2" elementType="C"/>
        //	  </atomArray>
        //	  <molecule dictRef="md:chargeGroup" id="cg1">
        //	    <scalar dictRef="md:cgNumber">5</scalar>
        //	    <atomArray>
        //	      <atom ref="a1"/>
        //	      <atom ref="a2"><scalar dictRef="md:switchingAtom"/></atom>
        //	    </atomArray>
        //	  </molecule>
        //	  <molecule dictRef="md:residue" id="r1" title="resName">
        //	    <scalar dictRef="md:resNumber">3</scalar>
        //	    <atomArray>
        //	      <atom ref="a1"/>
        //	      <atom ref="a2"/>
        //	    </atomArray>
        //	  </molecule>
        //	</molecule>

        // let the CMLCore convention deal with things first

        if ("molecule".equals(local)) {

            // the copy the parsed content into a new MDMolecule
            if (atts.getValue("convention") != null && atts.getValue("convention").equals("md:mdMolecule")) {
                //				System.out.println("creating a MDMolecule");
                super.startElement(xpath, uri, local, raw, atts);
                currentMolecule = new MDMolecule(currentMolecule);
            } else {
                DICTREF = atts.getValue("dictRef") != null ? atts.getValue("dictRef") : "";
                //If residue or chargeGroup, set up a new one
                if (DICTREF.equals("md:chargeGroup")) {
                    //					System.out.println("Creating a new charge group...");
                    currentChargeGroup = new ChargeGroup();
                } else if (DICTREF.equals("md:residue")) {
                    //					System.out.println("Creating a new residue group...");
                    currentResidue = new Residue();
                    if (atts.getValue("title") != null) currentResidue.setName(atts.getValue("title"));
                }
            }
        } else

        //We have a scalar element. Now check who it belongs to
        if ("scalar".equals(local)) {
            DICTREF = atts.getValue("dictRef");
            //Switching Atom
            if ("md:switchingAtom".equals(DICTREF)) {
                //Set current atom as switching atom
                currentChargeGroup.setSwitchingAtom(currentAtom);
            } else {
                super.startElement(xpath, uri, local, raw, atts);
            }
        }

        else if ("atom".equals(local)) {
            if (currentChargeGroup != null) {
                String id = atts.getValue("ref");
                if (id != null) {
                    // ok, an atom is referenced; look it up
                    currentAtom = null;
                    //					System.out.println("#atoms: " + currentMolecule.getAtomCount());
                    for (IAtom nextAtom : currentMolecule.atoms()) {
                        if (nextAtom.getID().equals(id)) {
                            currentAtom = nextAtom;
                        }
                    }
                    if (currentAtom == null) {
                        logger.error("Could not found the referenced atom '" + id + "' for this charge group!");
                    } else {
                        currentChargeGroup.addAtom(currentAtom);
                    }
                }
            } else if (currentResidue != null) {
                String id = atts.getValue("ref");
                if (id != null) {
                    // ok, an atom is referenced; look it up
                    IAtom referencedAtom = null;
                    //					System.out.println("#atoms: " + currentMolecule.getAtomCount());
                    for (IAtom nextAtom : currentMolecule.atoms()) {
                        if (nextAtom.getID().equals(id)) {
                            referencedAtom = nextAtom;
                        }
                    }
                    if (referencedAtom == null) {
                        logger.error("Could not found the referenced atom '" + id + "' for this residue!");
                    } else {
                        currentResidue.addAtom(referencedAtom);
                    }
                }
            } else {
                // ok, fine, just add it to the currentMolecule
                super.startElement(xpath, uri, local, raw, atts);
            }
        }

        else {
            super.startElement(xpath, uri, local, raw, atts);
        }

    }
606460
def create_xml(self, useNamespace=False):
        """"""
        UNTL_NAMESPACE = 'http://digital2.library.unt.edu/untl/'
        UNTL = '{%s}' % UNTL_NAMESPACE

        NSMAP = {'untl': UNTL_NAMESPACE}

        if useNamespace:
            root = Element(UNTL + self.tag, nsmap=NSMAP)
        else:
            root = Element(self.tag)

        # Sort the elements by the index of
        # UNTL_XML_ORDER pre-ordered list.
        self.sort_untl(UNTL_XML_ORDER)
        # Create an XML structure from field list.
        for element in self.children:
            if useNamespace:
                create_untl_xml_subelement(root, element, UNTL)
            else:
                create_untl_xml_subelement(root, element)
        return root
195232
public void startElement(String elemName, String attrName, String attrValue) {
        AttributesImpl attrs = new AttributesImpl();
        attrs.addAttribute("", attrName, "", "CDATA", attrValue);
        writeStartElement(elemName, attrs);
        m_tagStack.push(elemName);
    }
534071
protected void startNode(int node) throws org.xml.sax.SAXException
  {

    XPathContext xcntxt = m_transformer.getXPathContext();
    try
    {
      
      if (DTM.ELEMENT_NODE == m_dtm.getNodeType(node))
      {
        xcntxt.pushCurrentNode(node);                   
                                        
        if(m_startNode != node)
        {
          super.startNode(node);
        }
        else
        {
          String elemName = m_dtm.getNodeName(node);
          String localName = m_dtm.getLocalName(node);
          String namespace = m_dtm.getNamespaceURI(node);
                                        
          //xcntxt.pushCurrentNode(node);       
          // SAX-like call to allow adding attributes afterwards
          m_handler.startElement(namespace, localName, elemName);
          boolean hasNSDecls = false;
          DTM dtm = m_dtm;
          for (int ns = dtm.getFirstNamespaceNode(node, true); 
               DTM.NULL != ns; ns = dtm.getNextNamespaceNode(node, ns, true))
          {
            SerializerUtils.ensureNamespaceDeclDeclared(m_handler,dtm, ns);
          }
                                                
                                                
          for (int attr = dtm.getFirstAttribute(node); 
               DTM.NULL != attr; attr = dtm.getNextAttribute(attr))
          {
            SerializerUtils.addAttribute(m_handler, attr);
          }
        }
                                
      }
      else
      {
        xcntxt.pushCurrentNode(node);
        super.startNode(node);
        xcntxt.popCurrentNode();
      }
    }
    catch(javax.xml.transform.TransformerException te)
    {
      throw new org.xml.sax.SAXException(te);
    }
  }
1013937
def start(self, content):
        
        content.data = Factory.object(content.node.name)
1215112
public void toXML(XMLBuilder xml) throws IllegalArgumentException {
        assert xml != null;
        
        // Determine what tag name to use for the generated element. 
        Map<String, String> attrMap = new LinkedHashMap<>(); 
        String elemName = m_name;
        if (m_tagName.length() > 0) {
            // Place m_name into a "name" attribute and use m_tagName
            attrMap.put("name", m_name);
            elemName = m_tagName;
        }
        
        // Add child VALUE nodes marked as "attribute" in its own map.
        addXMLAttributes(attrMap);
        switch (m_type) {
        case ARRAY:
            // Start an element with or without attributes.
            if (attrMap.size() > 0) {
                xml.startElement(elemName, attrMap);
            } else {
                xml.startElement(elemName);
            }
            
            // Add XML for non-attribute child nodes.
            if (m_children != null) {
                for (UNode childNode : m_children) {
                    if (childNode.m_type != NodeType.VALUE || !childNode.m_bAttribute) {
                        childNode.toXML(xml);
                    }
                }
            }
            xml.endElement();
            break;
        case MAP:
            // Start an element with or without attributes.
            if (attrMap.size() > 0) {
                xml.startElement(elemName, attrMap);
            } else {
                xml.startElement(elemName);
            }
            
            // Add XML for non-attribute child nodes in name order.
            if (m_childNodeMap != null) {
                assert m_childNodeMap.size() == m_children.size();
                for (UNode childNode : m_childNodeMap.values()) {
                    if (childNode.m_type != NodeType.VALUE || !childNode.m_bAttribute) {
                        childNode.toXML(xml);
                    }
                }
            }
            xml.endElement();
            break;
        case VALUE:
            // Map to a simple element.
            String value = m_value;
            if (Utils.containsIllegalXML(value)) {
                value = Utils.base64FromString(m_value);
                attrMap.put("encoding", "base64");
            }
            if (attrMap.size() > 0) {
                xml.addDataElement(elemName, value, attrMap);
            } else {
                xml.addDataElement(elemName, value);
            }
            break;
        default:
            assert false : "Unexpected NodeType: " + m_type;
        }
    }
872620
@Override
    public void startElement(final String uri, final String localName, final String qName,
                             final Attributes atts) throws SAXException {
        ignoreStack.push(MAP_RELTABLE.matches(atts) ? false : ignoreStack.isEmpty() || ignoreStack.peek());

        Attributes res = atts;
        if (ignoreStack.peek() && MAP_TOPICREF.matches(res)) {
            final URI href = toURI(res.getValue(ATTRIBUTE_NAME_HREF));
            final URI copyTo = toURI(res.getValue(ATTRIBUTE_NAME_COPY_TO));
            final URI source = copyTo != null ? copyTo : href;
            final String scope = res.getValue(ATTRIBUTE_NAME_SCOPE);
            final String format = res.getValue(ATTRIBUTE_NAME_FORMAT);
            // FIXME: handle cascading
            final String processingRole = res.getValue(ATTRIBUTE_NAME_PROCESSING_ROLE);
            if (source != null &&
                    (scope == null || scope.equals(ATTR_SCOPE_VALUE_LOCAL)) &&
                    (format == null || format.equals(ATTR_FORMAT_VALUE_DITA)) &&
                    (processingRole == null || processingRole.equals(ATTR_PROCESSING_ROLE_VALUE_NORMAL))) {
                final URI file = stripFragment(source);
                Integer count = topicrefCount.getOrDefault(file, 0);
                count++;
                topicrefCount.put(file, count);
                if (count > 1) { // not only reference to this topic
                    final FileInfo srcFi = job.getFileInfo(currentFile.resolve(stripFragment(source)));
                    if (srcFi != null) {
                        final FileInfo dstFi = generateCopyToTarget(srcFi, count);
                        copyToMap.put(dstFi, srcFi);

                        final URI dstTempAbs = job.tempDirURI.resolve(dstFi.uri);
                        final URI targetRel = getRelativePath(currentFile, dstTempAbs);
                        final URI target = setFragment(targetRel, href.getFragment());

                        final AttributesImpl buf = new AttributesImpl(atts);
                        XMLUtils.addOrSetAttribute(buf, ATTRIBUTE_NAME_COPY_TO, target.toString());
                        res = buf;
                    }
                }
            }
        }

        getContentHandler().startElement(uri, localName, qName, res);
    }