public void loadSecondStage (Dictionary dictionaries) throws XMLInvalidInputException,XMLTreeException { super.loadSecondStage(dictionaries); for(int i=0;i<count.length;i++) for(int j=0;j<count[i].length;j++) for(int k=0;k<count[i][j].length;k++) XMLUtils.loadSecondStage(count[i][j][k].elements(),dictionaries); for(int i=0;i<p_table.length;i++) for(int j=0;j<p_table[i].length;j++) for(int k=0;k<p_table[i][j].length;k++) XMLUtils.loadSecondStage(p_table[i][j][k].elements(),dictionaries); for(int i=0;i<pKtl_table.length;i++) for(int j=0;j<pKtl_table[i].length;j++) for(int k=0;k<pKtl_table[i][j].length;k++) XMLUtils.loadSecondStage(pKtl_table[i][j][k].elements(),dictionaries); System.out.println("TC3 second stage load finished."); }
public static XMLReader newXMLReader(XMLUtils.ParserConfiguration parserConfiguration) { final SAXParser saxParser = XMLUtils.newSAXParser(parserConfiguration); try { final XMLReader xmlReader = saxParser.getXMLReader(); xmlReader.setEntityResolver(XMLUtils.ENTITY_RESOLVER); xmlReader.setErrorHandler(XMLUtils.ERROR_HANDLER); return xmlReader; } catch (Exception e) { throw new OXFException(e); } }
/** * This interface method is called to set all the fieldValues of this object of <code>InPort * </code>, using the specified XML string. * * @param port The new fieldValues value * @exception FioranoException if an error occurs while parsing the XMLString * @since Tifosi2.0 */ public void setFieldValues(Element port) throws FioranoException { // Document doc = XMLUtils.getDOMDocumentFromXML(xmlString); // Element port = doc.getDocumentElement(); if (port != null) { m_bIsSyncRequestType = XMLDmiUtil.getAttributeAsBoolean(port, "isSyncRequestType"); NodeList children = port.getChildNodes(); Node child = null; for (int i = 0; children != null && i < children.getLength(); ++i) { child = children.item(i); String nodeName = child.getNodeName(); if (nodeName.equalsIgnoreCase("Name")) { m_strPortName = XMLUtils.getNodeValueAsString(child).toUpperCase(); } if (nodeName.equalsIgnoreCase("Description")) { m_strDscription = XMLUtils.getNodeValueAsString(child); } if (nodeName.equalsIgnoreCase("XSD")) { m_strXSD = XMLUtils.getNodeValueAsString(child); } if (nodeName.equalsIgnoreCase("JavaClass")) { m_strJavaClass = XMLUtils.getNodeValueAsString(child); } if (nodeName.equalsIgnoreCase("Param")) { Param paramDmi = new Param(); paramDmi.setFieldValues((Element) child); addParam(paramDmi); } } } validate(); }
private static void mapPrefixIfNeeded( Set<String> declaredPrefixes, String uri, String qName, StringBuilder sb) { final String prefix = XMLUtils.prefixFromQName(qName); if (prefix.length() > 0 && !declaredPrefixes.contains(prefix)) { sb.append(" xmlns:"); sb.append(prefix); sb.append("=\""); sb.append(uri); sb.append("\""); declaredPrefixes.add(prefix); } }
public static AttributesImpl addOrReplaceAttribute( Attributes attributes, String uri, String prefix, String localname, String value) { final AttributesImpl newAttributes = new AttributesImpl(); boolean replaced = false; for (int i = 0; i < attributes.getLength(); i++) { final String attributeURI = attributes.getURI(i); final String attributeValue = attributes.getValue(i); final String attributeType = attributes.getType(i); final String attributeQName = attributes.getQName(i); final String attributeLocalname = attributes.getLocalName(i); if (uri.equals(attributeURI) && localname.equals(attributeLocalname)) { // Found existing attribute replaced = true; newAttributes.addAttribute( uri, localname, XMLUtils.buildQName(prefix, localname), ContentHandlerHelper.CDATA, value); } else { // Not a matched attribute newAttributes.addAttribute( attributeURI, attributeLocalname, attributeQName, attributeType, attributeValue); } } if (!replaced) { // Attribute did not exist already so add it newAttributes.addAttribute( uri, localname, XMLUtils.buildQName(prefix, localname), ContentHandlerHelper.CDATA, value); } return newAttributes; }
/** * Get the first topic id. * * @param path file path * @param dir file dir * @param useCatalog whether use catalog file for validation * @return topic id */ public static String getFirstTopicId(final URI path, final File dir, final boolean useCatalog) { if (path == null && dir == null) { return null; } final DITAOTLogger logger = new DITAOTJavaLogger(); final StringBuilder firstTopicId = new StringBuilder(); final TopicIdParser parser = new TopicIdParser(firstTopicId); try { final XMLReader reader = XMLUtils.getXMLReader(); reader.setContentHandler(parser); if (useCatalog) { reader.setEntityResolver(CatalogUtils.getCatalogResolver()); } reader.parse(dir.toURI().resolve(path).toString()); } catch (final Exception e) { logger.error(e.getMessage(), e); } return firstTopicId.toString(); }
public void loadSecondStage(Dictionary dictionaries) throws XMLInvalidInputException, XMLTreeException { XMLUtils.loadSecondStage(count.elements(), dictionaries); // XMLUtils.loadSecondStage(p_table.elements(),dictionaries); System.out.println("SL1 second stage load finished."); }