Example usage for org.dom4j QName QName

List of usage examples for org.dom4j QName QName

Introduction

In this page you can find the example usage for org.dom4j QName QName.

Prototype

public QName(String name, Namespace namespace) 

Source Link

Usage

From source file:com.rayo.core.xml.providers.HandsetProvider.java

License:Apache License

private void createOnHoldEvent(OnHoldEvent onHold, Document document) {
    document.addElement(new QName("onhold", NAMESPACE));
}

From source file:com.rayo.core.xml.providers.HandsetProvider.java

License:Apache License

private void createOffHoldEvent(OffHoldEvent offHold, Document document) {
    document.addElement(new QName("offhold", NAMESPACE));
}

From source file:com.rayo.core.xml.providers.HandsetProvider.java

License:Apache License

private void createPrivateEvent(PrivateEvent event, Document document) {
    document.addElement(new QName("private", NAMESPACE));
}

From source file:com.rayo.core.xml.providers.HandsetProvider.java

License:Apache License

private void createPublicEvent(PublicEvent event, Document document) {
    document.addElement(new QName("public", NAMESPACE));
}

From source file:com.rayo.core.xml.providers.HandsetProvider.java

License:Apache License

private void createTransferredEvent(TransferredEvent event, Document document) {
    document.addElement(new QName("transferred", NAMESPACE));
}

From source file:com.rayo.core.xml.providers.HandsetProvider.java

License:Apache License

private void createTransferringEvent(TransferringEvent event, Document document) {
    document.addElement(new QName("transferring", NAMESPACE));
}

From source file:com.sun.tools.xjc.reader.dtd.bindinfo.BindInfo.java

License:Open Source License

public BindInfo(Document _dom, ErrorReceiver _errorReceiver, JCodeModel _codeModel, Options opts) {
    this.dom = _dom.getRootElement();
    this.codeModel = _codeModel;
    this.options = opts;
    this.errorReceiver = _errorReceiver;
    this.classFactory = new CodeModelClassFactory(_errorReceiver);
    // TODO: decide name converter from the binding file
    this.nameConverter = NameConverter.standard;

    this.defaultPackage = opts.defaultPackage;

    Iterator itr;/*  w ww. jav a  2s . c  o m*/

    // process element declarations
    itr = dom.elementIterator("element");
    while (itr.hasNext()) {
        BIElement e = new BIElement(this, (Element) itr.next());
        elements.put(e.name(), e);
    }

    // add built-in conversions
    BIUserConversion.addBuiltinConversions(this, conversions);

    // process conversion declarations
    itr = dom.elementIterator("conversion");
    while (itr.hasNext()) {
        BIConversion c = new BIUserConversion(this, (Element) itr.next());
        conversions.put(c.name(), c);
    }
    itr = dom.elementIterator("enumeration");
    while (itr.hasNext()) {
        BIConversion c = BIEnumeration.create((Element) itr.next(), this);
        conversions.put(c.name(), c);
    }
    // TODO: check the uniquness of conversion name

    // process interface definitions
    itr = dom.elementIterator("interface");
    while (itr.hasNext()) {
        BIInterface c = new BIInterface((Element) itr.next());
        interfaces.put(c.name(), c);
    }

    options.generateMarshallingCode = dom.element(new QName("noMarshaller", XJC_NS)) == null;
    options.generateUnmarshallingCode = dom.element(new QName("noUnmarshaller", XJC_NS)) == null;
    options.generateValidationCode = dom.element(new QName("noValidator", XJC_NS)) == null;
    options.generateValidatingUnmarshallingCode = dom
            .element(new QName("noValidatingUnmarshaller", XJC_NS)) == null;
    if (!options.generateUnmarshallingCode)
        options.generateValidatingUnmarshallingCode = false;
}

From source file:com.sun.tools.xjc.reader.dtd.bindinfo.BindInfo.java

License:Open Source License

/** Gets the serialVersionUID if it's turned on. */
public Long getSerialVersionUID() {
    Element serial = dom.element(new QName("serializable", XJC_NS));
    if (serial == null)
        return null;

    return new Long(serial.attributeValue("uid", "1"));
}

From source file:com.sun.tools.xjc.reader.dtd.bindinfo.BindInfo.java

License:Open Source License

/** Gets the xjc:superClass customization if it's turned on. */
public JClass getSuperClass() {
    Element sc = dom.element(new QName("superClass", XJC_NS));
    if (sc == null)
        return null;

    JDefinedClass c;/*from www .  ja  va  2 s .  co m*/

    try {
        c = codeModel._class(sc.attributeValue("name", "java.lang.Object"));
        c.hide();
    } catch (JClassAlreadyExistsException e) {
        c = e.getExistingClass();
    }

    return c;
}

From source file:com.uletian.ultcrm.business.service.CustomerInfoSyncService.java

public void notifycationDataChange(Customer customer) {
    StringWriter writer = new StringWriter();
    OutputFormat format = OutputFormat.createPrettyPrint();
    format.setEncoding("UTF-8");
    Document doc = DocumentHelper.createDocument();

    Namespace namespace = new Namespace("ns0", "http://crm/91jpfw.cn");
    Element root = doc.addElement(new QName("customer", namespace));
    root.addElement(new QName("action")).addText(action.BINDING_TEL.toString());
    root.addElement(new QName("sourceSys")).addText("ULTCRM");
    root.addElement(new QName("ultcrmid")).addText(customer.getId().toString());
    root.addElement(new QName("crmid")).addText(customer.getSyncid() == null ? "" : customer.getSyncid());
    String name = null;//from  w  w w. j  a  v  a  2  s  .c  o m
    if (customer.getName() == null || "".equals(customer.getName())) {
        name = customer.getNickname();
    } else {
        name = customer.getName();
    }
    root.addElement(new QName("name")).addText(name);
    root.addElement(new QName("sexy")).addText(customer.getSex() == null ? "" : customer.getSex());
    root.addElement(new QName("telephone")).addText(customer.getPhone() == null ? "" : customer.getPhone());
    root.addElement(new QName("country")).addText(customer.getCountry() == null ? "" : customer.getCountry());
    root.addElement(new QName("province"))
            .addText(customer.getProvince() == null ? "" : customer.getProvince());
    root.addElement(new QName("city")).addText(customer.getCity() == null ? "" : customer.getCity());
    root.addElement(new QName("address")).addText(customer.getAddress() == null ? "" : customer.getAddress());
    root.addElement(new QName("postcode"))
            .addText(customer.getPostcode() == null ? "" : customer.getPostcode());
    Element techsElement = root.addElement(new QName("techs"));
    List<Tech> techs = customer.getTechs();
    if (techs != null && techs.size() > 0) {
        for (int i = 0; i < techs.size(); i++) {
            Tech tech = techs.get(i);
            Element techElement = techsElement.addElement("tech");

            techElement.addElement(new QName("crmtechid"))
                    .addText(tech.getCrmTechId() == null ? "" : tech.getCrmTechId());
            techElement.addElement(new QName("code")).addText(tech.getTechModel().getCode());
            techElement.addElement(new QName("techlevelno"))
                    .addText(tech.getTechlevelno() == null ? "" : tech.getTechlevelno());
            techElement.addElement(new QName("techerno"))
                    .addText(tech.getTecherno() == null ? "" : tech.getTecherno());
            techElement.addElement(new QName("techname"))
                    .addText(tech.getTechname() == null ? "" : tech.getTechname());
            techElement.addElement(new QName("coursetime"))
                    .addText(tech.getCoursetime() == null ? "" : tech.getCoursetime());
            String trainExpireDate = "";
            if (tech.getTrainExpireDate() != null) {
                trainExpireDate = sdf.format(tech.getTrainExpireDate());
            }
            techElement.addElement(new QName("trainExpireDate")).addText(trainExpireDate);
            techElement.addElement(new QName("trainCompany"))
                    .addText(tech.getTrainCompany() == null ? "" : tech.getTrainCompany());
            techElement.addElement(new QName("courseCode"))
                    .addText(tech.getCourseCode() == null ? "" : tech.getCourseCode());
            techElement.addElement(new QName("techColor"))
                    .addText(tech.getColor() == null ? "" : tech.getColor());
            String registerDate = "";
            if (tech.getRegisterDate() != null) {
                registerDate = sdf.format(tech.getRegisterDate());
            }
            techElement.addElement(new QName("registerDate")).addText(registerDate);
            techElement.addElement(new QName("courseLicense"))
                    .addText(tech.getCourseLicense() == null ? "" : tech.getCourseLicense());
            String checkExpireDate = "";
            if (tech.getCheckExpireDate() != null) {
                checkExpireDate = sdf.format(tech.getCheckExpireDate());
            }
            techElement.addElement(new QName("checkExpireDate")).addText(checkExpireDate);
            techElement.addElement(new QName("memberLevel"))
                    .addText(tech.getMemberLevel() == null ? "" : tech.getMemberLevel());

            // ? by xiecheng 2015-11-19
            techElement.addElement(new QName("nextMaintCoursetime"))
                    .addText(StringUtils.isNoneBlank(tech.getNextMaintCoursetime())
                            ? tech.getNextMaintCoursetime()
                            : "");

            String nextMaintDate = "";
            if (tech.getNextMaintDate() != null) {
                nextMaintDate = sdf.format(tech.getNextMaintDate());
            }
            techElement.addElement(new QName("nextMaintDate")).addText(nextMaintDate);

            String lastConsumeDate = "";
            if (tech.getLastConsumeDate() != null) {
                lastConsumeDate = sdf.format(tech.getLastConsumeDate());
            }
            techElement.addElement(new QName("lastConsumeDate")).addText(lastConsumeDate);

        }
    }
    XMLWriter xmlwriter = new XMLWriter(writer, format);
    try {
        xmlwriter.write(doc);
    } catch (IOException e) {
    }
    customerInfoMessageService.sendMessage(writer.toString());

}