Java 类org.jdom.Content 实例源码

项目:incubator-netbeans    文件:NetbeansBuildActionJDOMWriter.java   
/**
 * Method updateElement.
 * 
 * @param counter
 * @param shouldExist
 * @param name
 * @param parent
 * @return Element
 */
protected Element updateElement(Counter counter, Element parent, String name, boolean shouldExist)
{
    Element element =  parent.getChild(name, parent.getNamespace());
    if (element != null && shouldExist) {
        counter.increaseCount();
    }
    if (element == null && shouldExist) {
        element = factory.element(name, parent.getNamespace());
        insertAtPreferredLocation(parent, element, counter);
        counter.increaseCount();
    }
    if (!shouldExist && element != null) {
        int index = parent.indexOf(element);
        if (index > 0) {
            Content previous = parent.getContent(index - 1);
            if (previous instanceof Text) {
                Text txt = (Text)previous;
                if (txt.getTextTrim().length() == 0) {
                    parent.removeContent(txt);
                }
            }
        }
        parent.removeContent(element);
    }
    return element;
}
项目:apache-maven-shade-plugin    文件:MavenJDOMWriter.java   
/**
 * Method updateElement
 *
 * @param counter
 * @param shouldExist
 * @param name
 * @param parent
 */
protected Element updateElement( Counter counter, Element parent, String name, boolean shouldExist )
{
    Element element = parent.getChild( name, parent.getNamespace() );
    if ( element != null && shouldExist )
    {
        counter.increaseCount();
    }
    if ( element == null && shouldExist )
    {
        element = factory.element( name, parent.getNamespace() );
        insertAtPreferredLocation( parent, element, counter );
        counter.increaseCount();
    }
    if ( !shouldExist && element != null )
    {
        int index = parent.indexOf( element );
        if ( index > 0 )
        {
            Content previous = parent.getContent( index - 1 );
            if ( previous instanceof Text )
            {
                Text txt = (Text) previous;
                if ( txt.getTextTrim().length() == 0 )
                {
                    parent.removeContent( txt );
                }
            }
        }
        parent.removeContent( element );
    }
    return element;
}
项目:DigitalMediaServer    文件:Feed.java   
private void parseElement(Element elt, boolean parseLink) {
    if ("content".equals(elt.getName()) && "media".equals(elt.getNamespacePrefix())) {
        if (parseLink) {
            tempItemLink = elt.getAttribute("url").getValue();
        }
        List<Content> subElts = elt.getContent();
        for (Content subelt : subElts) {
            if (subelt instanceof Element) {
                parseElement((Element) subelt, false);
            }
        }
    }
    if ("thumbnail".equals(elt.getName()) && "media".equals(elt.getNamespacePrefix())
            && tempItemThumbURL == null) {
        tempItemThumbURL = elt.getAttribute("url").getValue();
    }
    if ("image".equals(elt.getName()) && "exInfo".equals(elt.getNamespacePrefix())
            && tempItemThumbURL == null) {
        tempItemThumbURL = elt.getValue();
    }
}
项目:Open-Uploader    文件:StateProjectComponent.java   
@Override
public void loadState(Element element) {
    if (ELEMENT_ROOT_ITEM_NAME.equals(element.getName())) {
        Iterator<Content> iterator = element.getDescendants();
        while (iterator.hasNext()) {
            Object content = iterator.next();
            if (!(content instanceof Element)) {
                continue;
            }
            Element e = (Element) content;
            if (ELEMENT_NAME_URL.equals(e.getName())) {
                url = e.getText();
            } else if (ELEMENT_NAME_MODULE.equals(e.getName())) {
                module = e.getText();
            } else if (ELEMENT_NAME_PATH.equals(e.getName())) {
                path = e.getText();
            } else if (ELEMENT_NAME_PARAM.equals(e.getName())) {
                String key = e.getAttributeValue(ATTRIBUTE_NAME_KEY);
                String value = e.getAttributeValue(ATTRIBUTE_NAME_VAL);
                params.put(key, value);
            }
        }
    }
}
项目:pathvisio    文件:GpmlFormatAbstract.java   
protected void updateBiopax(PathwayElement o, Element e) throws ConverterException
{
    Document bp = ((BiopaxElement)o).getBiopax();
    if(e != null && bp != null) {
        List<Content> content = bp.getRootElement().cloneContent();
        for(Content c : content) {
            if(c instanceof Element) {
                Element elm = (Element)c;
                if(elm.getNamespace().equals(GpmlFormat.BIOPAX)) {
                    e.addContent(c);
                } else if(elm.getName().equals("RDF") && elm.getNamespace().equals(GpmlFormat.RDF)) {
                    for(Object ce : elm.getChildren()) {
                        if(((Element)ce).getNamespace().equals(GpmlFormat.BIOPAX)) {
                            e.addContent((Element)ce);
                        }
                    }
                } else {
                    Logger.log.info("Skipped non-biopax element" + c);
                }
            }
        }
    }
}
项目:intellij-ce-playground    文件:XmlSerializerImpl.java   
@NotNull
static String getTextValue(@NotNull Element element, @NotNull String defaultText) {
  List<Content> content = element.getContent();
  int size = content.size();
  StringBuilder builder = null;
  for (int i = 0; i < size; i++) {
    Content child = content.get(i);
    if (child instanceof Text) {
      String value = child.getValue();
      if (builder == null && i == (size - 1)) {
        return value;
      }

      if (builder == null) {
        builder = new StringBuilder();
      }
      builder.append(value);
    }
  }
  return builder == null ? defaultText : builder.toString();
}
项目:intellij-ce-playground    文件:MapBinding.java   
private void serializeKeyOrValue(@NotNull Element entry, @NotNull String attributeName, @Nullable Object value, @Nullable Binding binding, @NotNull SerializationFilter filter) {
  if (value == null) {
    return;
  }

  if (binding == null) {
    entry.setAttribute(attributeName, XmlSerializerImpl.convertToString(value));
  }
  else {
    Object serialized = binding.serialize(value, entry, filter);
    if (serialized != null) {
      if (myMapAnnotation != null && !myMapAnnotation.surroundKeyWithTag()) {
        entry.addContent((Content)serialized);
      }
      else {
        Element container = new Element(attributeName);
        container.addContent((Content)serialized);
        entry.addContent(container);
      }
    }
  }
}
项目:sortpom    文件:HierarchyWrapper.java   
/** Traverses the initial xml element wrapper and builds hierarchy */
protected void createWrappedStructure(final WrapperFactory factory) {
    HierarchyWrapper currentWrapper = null;
    for (Content child : castToContentList(elementContent)) {
        Wrapper<?> wrapper = factory.create(child);
        if (wrapper instanceof SingleNewlineInTextWrapper) {
            continue;
        }
        if (currentWrapper == null) {
            currentWrapper = new HierarchyWrapper(wrapper);
            children.add(currentWrapper);
        } else {
            currentWrapper.addContent(wrapper);
        }
        if (currentWrapper.containsElement()) {
            currentWrapper.createWrappedStructure(factory);
            currentWrapper = null;
        }
    }
}
项目:incubator-taverna-workbench    文件:XMLTree.java   
private XMLNode createTreeNode(Content content) {
    XMLNode node = new XMLNode(content);
    if (content instanceof Parent) {
        Parent parent = (Parent) content;
        for (Object child : parent.getContent()) {
            if (child instanceof Element)
                node.add(createTreeNode((Content) child));
            else if (textSizeLimit != 0 && child instanceof Text) {
                Text text = (Text) child;
                if (!text.getTextNormalize().isEmpty())
                    node.add(createTreeNode(text));
            }
        }
    }
    return node;
}
项目:incubator-taverna-workbench    文件:IterationStrategyContextualView.java   
private static void stripEmptyElements(Element asXML) {
    int childCount = asXML.getContent().size();
    int index = 0;
    while (index < childCount) {
        Content child = asXML.getContent(index);
        if (child instanceof Element) {
            Element childElement = (Element) child;
            if (childElement.getName().equals("port")) {
                index++;
            } else if (childElement.getDescendants(new ElementFilter("port")).hasNext()) {
                stripEmptyElements(childElement);
                index++;
            } else {
                asXML.removeContent(childElement);
                childCount--;
            }
        }
    }
}
项目:oliot-fc    文件:TransmitPowerLevelTableEntry.java   
/**
* {@inheritDoc}
*/
public Content encodeXML(String name, Namespace ns) {
    // element in namespace defined by parent element
    Element element = new Element(name, ns);
    // child element are always in default LLRP namespace
    ns = Namespace.getNamespace("llrp", LLRPConstants.LLRPNAMESPACE);

    if (index == null) {
        LOGGER.warn(" index not set");
        throw new MissingParameterException(" index not set");
    } else {
        element.addContent(index.encodeXML("Index", ns));
    }

    if (transmitPowerValue == null) {
        LOGGER.warn(" transmitPowerValue not set");
        throw new MissingParameterException(" transmitPowerValue not set");
    } else {
        element.addContent(transmitPowerValue.encodeXML(
                "TransmitPowerValue", ns));
    }

    //parameters
    return element;
}
项目:oliot-fc    文件:InventoryParameterSpecID.java   
/**
* {@inheritDoc}
*/
public Content encodeXML(String name, Namespace ns) {
    // element in namespace defined by parent element
    Element element = new Element(name, ns);
    // child element are always in default LLRP namespace
    ns = Namespace.getNamespace("llrp", LLRPConstants.LLRPNAMESPACE);

    if (inventoryParameterSpecID == null) {
        LOGGER.warn(" inventoryParameterSpecID not set");
        throw new MissingParameterException(
            " inventoryParameterSpecID not set");
    } else {
        element.addContent(inventoryParameterSpecID.encodeXML(
                "InventoryParameterSpecID", ns));
    }

    //parameters
    return element;
}
项目:oliot-fc    文件:C1G2BlockEraseOpSpecResult.java   
/**
* {@inheritDoc}
*/
public Content encodeXML(String name, Namespace ns) {
    // element in namespace defined by parent element
    Element element = new Element(name, ns);
    // child element are always in default LLRP namespace
    ns = Namespace.getNamespace("llrp", LLRPConstants.LLRPNAMESPACE);

    if (result == null) {
        LOGGER.warn(" result not set");
        throw new MissingParameterException(" result not set");
    } else {
        element.addContent(result.encodeXML("Result", ns));
    }

    if (opSpecID == null) {
        LOGGER.warn(" opSpecID not set");
        throw new MissingParameterException(" opSpecID not set");
    } else {
        element.addContent(opSpecID.encodeXML("OpSpecID", ns));
    }

    //parameters
    return element;
}
项目:oliot-fc    文件:GPOWriteData.java   
/**
* {@inheritDoc}
*/
public Content encodeXML(String name, Namespace ns) {
    // element in namespace defined by parent element
    Element element = new Element(name, ns);
    // child element are always in default LLRP namespace
    ns = Namespace.getNamespace("llrp", LLRPConstants.LLRPNAMESPACE);

    if (gPOPortNumber == null) {
        LOGGER.warn(" gPOPortNumber not set");
        throw new MissingParameterException(" gPOPortNumber not set");
    } else {
        element.addContent(gPOPortNumber.encodeXML("GPOPortNumber", ns));
    }

    if (gPOData == null) {
        LOGGER.warn(" gPOData not set");
        throw new MissingParameterException(" gPOData not set");
    } else {
        element.addContent(gPOData.encodeXML("GPOData", ns));
    }

    //element.addContent(reserved0.encodeXML("reserved",ns));
    //parameters
    return element;
}
项目:oliot-fc    文件:C1G2RFControl.java   
/**
* {@inheritDoc}
*/
public Content encodeXML(String name, Namespace ns) {
    // element in namespace defined by parent element
    Element element = new Element(name, ns);
    // child element are always in default LLRP namespace
    ns = Namespace.getNamespace("llrp", LLRPConstants.LLRPNAMESPACE);

    if (modeIndex == null) {
        LOGGER.warn(" modeIndex not set");
        throw new MissingParameterException(" modeIndex not set");
    } else {
        element.addContent(modeIndex.encodeXML("ModeIndex", ns));
    }

    if (tari == null) {
        LOGGER.warn(" tari not set");
        throw new MissingParameterException(" tari not set");
    } else {
        element.addContent(tari.encodeXML("Tari", ns));
    }

    //parameters
    return element;
}
项目:oliot-fc    文件:ReaderEventNotificationSpec.java   
/**
* {@inheritDoc}
*/
public Content encodeXML(String name, Namespace ns) {
    // element in namespace defined by parent element
    Element element = new Element(name, ns);
    // child element are always in default LLRP namespace
    ns = Namespace.getNamespace("llrp", LLRPConstants.LLRPNAMESPACE);

    //parameters
    if (eventNotificationStateList == null) {
        LOGGER.warn(" eventNotificationStateList not set");
        throw new MissingParameterException(
            "  eventNotificationStateList not set");
    }

    for (EventNotificationState field : eventNotificationStateList) {
        element.addContent(field.encodeXML(field.getClass().getName()
                                                .replaceAll(field.getClass()
                                                                 .getPackage()
                                                                 .getName() +
                    ".", ""), ns));
    }

    return element;
}
项目:oliot-fc    文件:EPC_96.java   
/**
* {@inheritDoc}
*/
public Content encodeXML(String name, Namespace ns) {
    // element in namespace defined by parent element
    Element element = new Element(name, ns);
    // child element are always in default LLRP namespace
    ns = Namespace.getNamespace("llrp", LLRPConstants.LLRPNAMESPACE);

    if (ePC == null) {
        LOGGER.warn(" ePC not set");
        throw new MissingParameterException(" ePC not set");
    } else {
        element.addContent(ePC.encodeXML("EPC", ns));
    }

    //parameters
    return element;
}
项目:oliot-fc    文件:UTCTimestamp.java   
/**
* {@inheritDoc}
*/
public Content encodeXML(String name, Namespace ns) {
    // element in namespace defined by parent element
    Element element = new Element(name, ns);
    // child element are always in default LLRP namespace
    ns = Namespace.getNamespace("llrp", LLRPConstants.LLRPNAMESPACE);

    if (microseconds == null) {
        LOGGER.warn(" microseconds not set");
        throw new MissingParameterException(" microseconds not set");
    } else {
        element.addContent(microseconds.encodeXML("Microseconds", ns));
    }

    //parameters
    return element;
}
项目:oliot-fc    文件:LastSeenTimestampUTC.java   
/**
* {@inheritDoc}
*/
public Content encodeXML(String name, Namespace ns) {
    // element in namespace defined by parent element
    Element element = new Element(name, ns);
    // child element are always in default LLRP namespace
    ns = Namespace.getNamespace("llrp", LLRPConstants.LLRPNAMESPACE);

    if (microseconds == null) {
        LOGGER.warn(" microseconds not set");
        throw new MissingParameterException(" microseconds not set");
    } else {
        element.addContent(microseconds.encodeXML("Microseconds", ns));
    }

    //parameters
    return element;
}
项目:oliot-fc    文件:EPCData.java   
/**
* {@inheritDoc}
*/
public Content encodeXML(String name, Namespace ns) {
    // element in namespace defined by parent element
    Element element = new Element(name, ns);
    // child element are always in default LLRP namespace
    ns = Namespace.getNamespace("llrp", LLRPConstants.LLRPNAMESPACE);

    if (ePC == null) {
        LOGGER.warn(" ePC not set");
        throw new MissingParameterException(" ePC not set");
    } else {
        element.addContent(ePC.encodeXML("EPC", ns));
    }

    //parameters
    return element;
}
项目:oliot-fc    文件:FixedFrequencyTable.java   
/**
* {@inheritDoc}
*/
public Content encodeXML(String name, Namespace ns) {
    // element in namespace defined by parent element
    Element element = new Element(name, ns);
    // child element are always in default LLRP namespace
    ns = Namespace.getNamespace("llrp", LLRPConstants.LLRPNAMESPACE);

    if (frequency == null) {
        LOGGER.warn(" frequency not set");
        throw new MissingParameterException(" frequency not set");
    } else {
        element.addContent(frequency.encodeXML("Frequency", ns));
    }

    //parameters
    return element;
}
项目:oliot-fc    文件:Uptime.java   
/**
* {@inheritDoc}
*/
public Content encodeXML(String name, Namespace ns) {
    // element in namespace defined by parent element
    Element element = new Element(name, ns);
    // child element are always in default LLRP namespace
    ns = Namespace.getNamespace("llrp", LLRPConstants.LLRPNAMESPACE);

    if (microseconds == null) {
        LOGGER.warn(" microseconds not set");
        throw new MissingParameterException(" microseconds not set");
    } else {
        element.addContent(microseconds.encodeXML("Microseconds", ns));
    }

    //parameters
    return element;
}
项目:oliot-fc    文件:C1G2LockOpSpecResult.java   
/**
* {@inheritDoc}
*/
public Content encodeXML(String name, Namespace ns) {
    // element in namespace defined by parent element
    Element element = new Element(name, ns);
    // child element are always in default LLRP namespace
    ns = Namespace.getNamespace("llrp", LLRPConstants.LLRPNAMESPACE);

    if (result == null) {
        LOGGER.warn(" result not set");
        throw new MissingParameterException(" result not set");
    } else {
        element.addContent(result.encodeXML("Result", ns));
    }

    if (opSpecID == null) {
        LOGGER.warn(" opSpecID not set");
        throw new MissingParameterException(" opSpecID not set");
    } else {
        element.addContent(opSpecID.encodeXML("OpSpecID", ns));
    }

    //parameters
    return element;
}
项目:oliot-fc    文件:Identification.java   
/**
* {@inheritDoc}
*/
public Content encodeXML(String name, Namespace ns) {
    // element in namespace defined by parent element
    Element element = new Element(name, ns);
    // child element are always in default LLRP namespace
    ns = Namespace.getNamespace("llrp", LLRPConstants.LLRPNAMESPACE);

    if (iDType == null) {
        LOGGER.warn(" iDType not set");
        throw new MissingParameterException(" iDType not set");
    } else {
        element.addContent(iDType.encodeXML("IDType", ns));
    }

    if (readerID == null) {
        LOGGER.warn(" readerID not set");
        throw new MissingParameterException(" readerID not set");
    } else {
        element.addContent(readerID.encodeXML("ReaderID", ns));
    }

    //parameters
    return element;
}
项目:oliot-fc    文件:C1G2UHFRFModeTable.java   
/**
* {@inheritDoc}
*/
public Content encodeXML(String name, Namespace ns) {
    // element in namespace defined by parent element
    Element element = new Element(name, ns);
    // child element are always in default LLRP namespace
    ns = Namespace.getNamespace("llrp", LLRPConstants.LLRPNAMESPACE);

    //parameters
    if (c1G2UHFRFModeTableEntryList == null) {
        LOGGER.warn(" c1G2UHFRFModeTableEntryList not set");
        throw new MissingParameterException(
            "  c1G2UHFRFModeTableEntryList not set");
    }

    for (C1G2UHFRFModeTableEntry field : c1G2UHFRFModeTableEntryList) {
        element.addContent(field.encodeXML(field.getClass().getName()
                                                .replaceAll(field.getClass()
                                                                 .getPackage()
                                                                 .getName() +
                    ".", ""), ns));
    }

    return element;
}
项目:oliot-fc    文件:PeakRSSI.java   
/**
* {@inheritDoc}
*/
public Content encodeXML(String name, Namespace ns) {
    // element in namespace defined by parent element
    Element element = new Element(name, ns);
    // child element are always in default LLRP namespace
    ns = Namespace.getNamespace("llrp", LLRPConstants.LLRPNAMESPACE);

    if (peakRSSI == null) {
        LOGGER.warn(" peakRSSI not set");
        throw new MissingParameterException(" peakRSSI not set");
    } else {
        element.addContent(peakRSSI.encodeXML("PeakRSSI", ns));
    }

    //parameters
    return element;
}
项目:oliot-fc    文件:EventNotificationState.java   
/**
* {@inheritDoc}
*/
public Content encodeXML(String name, Namespace ns) {
    // element in namespace defined by parent element
    Element element = new Element(name, ns);
    // child element are always in default LLRP namespace
    ns = Namespace.getNamespace("llrp", LLRPConstants.LLRPNAMESPACE);

    if (eventType == null) {
        LOGGER.warn(" eventType not set");
        throw new MissingParameterException(" eventType not set");
    } else {
        element.addContent(eventType.encodeXML("EventType", ns));
    }

    if (notificationState == null) {
        LOGGER.warn(" notificationState not set");
        throw new MissingParameterException(" notificationState not set");
    } else {
        element.addContent(notificationState.encodeXML(
                "NotificationState", ns));
    }

    //element.addContent(reserved0.encodeXML("reserved",ns));
    //parameters
    return element;
}
项目:oliot-fc    文件:ReceiveSensitivityTableEntry.java   
/**
* {@inheritDoc}
*/
public Content encodeXML(String name, Namespace ns) {
    // element in namespace defined by parent element
    Element element = new Element(name, ns);
    // child element are always in default LLRP namespace
    ns = Namespace.getNamespace("llrp", LLRPConstants.LLRPNAMESPACE);

    if (index == null) {
        LOGGER.warn(" index not set");
        throw new MissingParameterException(" index not set");
    } else {
        element.addContent(index.encodeXML("Index", ns));
    }

    if (receiveSensitivityValue == null) {
        LOGGER.warn(" receiveSensitivityValue not set");
        throw new MissingParameterException(
            " receiveSensitivityValue not set");
    } else {
        element.addContent(receiveSensitivityValue.encodeXML(
                "ReceiveSensitivityValue", ns));
    }

    //parameters
    return element;
}
项目:oliot-fc    文件:C1G2SingulationDetails.java   
/**
* {@inheritDoc}
*/
public Content encodeXML(String name, Namespace ns) {
    // element in namespace defined by parent element
    Element element = new Element(name, ns);
    // child element are always in default LLRP namespace
    ns = Namespace.getNamespace("llrp", LLRPConstants.LLRPNAMESPACE);

    if (numCollisionSlots == null) {
        LOGGER.warn(" numCollisionSlots not set");
        throw new MissingParameterException(" numCollisionSlots not set");
    } else {
        element.addContent(numCollisionSlots.encodeXML(
                "NumCollisionSlots", ns));
    }

    if (numEmptySlots == null) {
        LOGGER.warn(" numEmptySlots not set");
        throw new MissingParameterException(" numEmptySlots not set");
    } else {
        element.addContent(numEmptySlots.encodeXML("NumEmptySlots", ns));
    }

    //parameters
    return element;
}
项目:oliot-fc    文件:RFReceiver.java   
/**
* {@inheritDoc}
*/
public Content encodeXML(String name, Namespace ns) {
    // element in namespace defined by parent element
    Element element = new Element(name, ns);
    // child element are always in default LLRP namespace
    ns = Namespace.getNamespace("llrp", LLRPConstants.LLRPNAMESPACE);

    if (receiverSensitivity == null) {
        LOGGER.warn(" receiverSensitivity not set");
        throw new MissingParameterException(" receiverSensitivity not set");
    } else {
        element.addContent(receiverSensitivity.encodeXML(
                "ReceiverSensitivity", ns));
    }

    //parameters
    return element;
}
项目:oliot-fc    文件:EventsAndReports.java   
/**
* {@inheritDoc}
*/
public Content encodeXML(String name, Namespace ns) {
    // element in namespace defined by parent element
    Element element = new Element(name, ns);
    // child element are always in default LLRP namespace
    ns = Namespace.getNamespace("llrp", LLRPConstants.LLRPNAMESPACE);

    if (holdEventsAndReportsUponReconnect == null) {
        LOGGER.warn(" holdEventsAndReportsUponReconnect not set");
        throw new MissingParameterException(
            " holdEventsAndReportsUponReconnect not set");
    } else {
        element.addContent(holdEventsAndReportsUponReconnect.encodeXML(
                "HoldEventsAndReportsUponReconnect", ns));
    }

    //element.addContent(reserved0.encodeXML("reserved",ns));
    //parameters
    return element;
}
项目:oliot-fc    文件:C1G2TagSpec.java   
/**
* {@inheritDoc}
*/
public Content encodeXML(String name, Namespace ns) {
    // element in namespace defined by parent element
    Element element = new Element(name, ns);
    // child element are always in default LLRP namespace
    ns = Namespace.getNamespace("llrp", LLRPConstants.LLRPNAMESPACE);

    //parameters
    if (c1G2TargetTagList == null) {
        LOGGER.warn(" c1G2TargetTagList not set");
        throw new MissingParameterException("  c1G2TargetTagList not set");
    }

    for (C1G2TargetTag field : c1G2TargetTagList) {
        element.addContent(field.encodeXML(field.getClass().getName()
                                                .replaceAll(field.getClass()
                                                                 .getPackage()
                                                                 .getName() +
                    ".", ""), ns));
    }

    return element;
}
项目:oliot-fc    文件:C1G2TagInventoryStateUnawareFilterAction.java   
/**
* {@inheritDoc}
*/
public Content encodeXML(String name, Namespace ns) {
    // element in namespace defined by parent element
    Element element = new Element(name, ns);
    // child element are always in default LLRP namespace
    ns = Namespace.getNamespace("llrp", LLRPConstants.LLRPNAMESPACE);

    if (action == null) {
        LOGGER.warn(" action not set");
        throw new MissingParameterException(" action not set");
    } else {
        element.addContent(action.encodeXML("Action", ns));
    }

    //parameters
    return element;
}
项目:oliot-fc    文件:C1G2LockPayload.java   
/**
* {@inheritDoc}
*/
public Content encodeXML(String name, Namespace ns) {
    // element in namespace defined by parent element
    Element element = new Element(name, ns);
    // child element are always in default LLRP namespace
    ns = Namespace.getNamespace("llrp", LLRPConstants.LLRPNAMESPACE);

    if (privilege == null) {
        LOGGER.warn(" privilege not set");
        throw new MissingParameterException(" privilege not set");
    } else {
        element.addContent(privilege.encodeXML("Privilege", ns));
    }

    if (dataField == null) {
        LOGGER.warn(" dataField not set");
        throw new MissingParameterException(" dataField not set");
    } else {
        element.addContent(dataField.encodeXML("DataField", ns));
    }

    //parameters
    return element;
}
项目:oliot-fc    文件:GPIOCapabilities.java   
/**
* {@inheritDoc}
*/
public Content encodeXML(String name, Namespace ns) {
    // element in namespace defined by parent element
    Element element = new Element(name, ns);
    // child element are always in default LLRP namespace
    ns = Namespace.getNamespace("llrp", LLRPConstants.LLRPNAMESPACE);

    if (numGPIs == null) {
        LOGGER.warn(" numGPIs not set");
        throw new MissingParameterException(" numGPIs not set");
    } else {
        element.addContent(numGPIs.encodeXML("NumGPIs", ns));
    }

    if (numGPOs == null) {
        LOGGER.warn(" numGPOs not set");
        throw new MissingParameterException(" numGPOs not set");
    } else {
        element.addContent(numGPOs.encodeXML("NumGPOs", ns));
    }

    //parameters
    return element;
}
项目:oliot-fc    文件:GPIEvent.java   
/**
* {@inheritDoc}
*/
public Content encodeXML(String name, Namespace ns) {
    // element in namespace defined by parent element
    Element element = new Element(name, ns);
    // child element are always in default LLRP namespace
    ns = Namespace.getNamespace("llrp", LLRPConstants.LLRPNAMESPACE);

    if (gPIPortNumber == null) {
        LOGGER.warn(" gPIPortNumber not set");
        throw new MissingParameterException(" gPIPortNumber not set");
    } else {
        element.addContent(gPIPortNumber.encodeXML("GPIPortNumber", ns));
    }

    if (gPIEvent == null) {
        LOGGER.warn(" gPIEvent not set");
        throw new MissingParameterException(" gPIEvent not set");
    } else {
        element.addContent(gPIEvent.encodeXML("GPIEvent", ns));
    }

    //element.addContent(reserved0.encodeXML("reserved",ns));
    //parameters
    return element;
}
项目:oliot-fc    文件:KeepaliveSpec.java   
/**
* {@inheritDoc}
*/
public Content encodeXML(String name, Namespace ns) {
    // element in namespace defined by parent element
    Element element = new Element(name, ns);
    // child element are always in default LLRP namespace
    ns = Namespace.getNamespace("llrp", LLRPConstants.LLRPNAMESPACE);

    if (keepaliveTriggerType == null) {
        LOGGER.warn(" keepaliveTriggerType not set");
        throw new MissingParameterException(" keepaliveTriggerType not set");
    } else {
        element.addContent(keepaliveTriggerType.encodeXML(
                "KeepaliveTriggerType", ns));
    }

    if (periodicTriggerValue == null) {
        LOGGER.warn(" periodicTriggerValue not set");
        throw new MissingParameterException(" periodicTriggerValue not set");
    } else {
        element.addContent(periodicTriggerValue.encodeXML(
                "PeriodicTriggerValue", ns));
    }

    //parameters
    return element;
}
项目:oliot-fc    文件:C1G2TagInventoryStateAwareFilterAction.java   
/**
* {@inheritDoc}
*/
public Content encodeXML(String name, Namespace ns) {
    // element in namespace defined by parent element
    Element element = new Element(name, ns);
    // child element are always in default LLRP namespace
    ns = Namespace.getNamespace("llrp", LLRPConstants.LLRPNAMESPACE);

    if (target == null) {
        LOGGER.warn(" target not set");
        throw new MissingParameterException(" target not set");
    } else {
        element.addContent(target.encodeXML("Target", ns));
    }

    if (action == null) {
        LOGGER.warn(" action not set");
        throw new MissingParameterException(" action not set");
    } else {
        element.addContent(action.encodeXML("Action", ns));
    }

    //parameters
    return element;
}
项目:oliot-fc    文件:TagSeenCount.java   
/**
* {@inheritDoc}
*/
public Content encodeXML(String name, Namespace ns) {
    // element in namespace defined by parent element
    Element element = new Element(name, ns);
    // child element are always in default LLRP namespace
    ns = Namespace.getNamespace("llrp", LLRPConstants.LLRPNAMESPACE);

    if (tagCount == null) {
        LOGGER.warn(" tagCount not set");
        throw new MissingParameterException(" tagCount not set");
    } else {
        element.addContent(tagCount.encodeXML("TagCount", ns));
    }

    //parameters
    return element;
}
项目:oliot-fc    文件:C1G2EPCMemorySelector.java   
/**
* {@inheritDoc}
*/
public Content encodeXML(String name, Namespace ns) {
    // element in namespace defined by parent element
    Element element = new Element(name, ns);
    // child element are always in default LLRP namespace
    ns = Namespace.getNamespace("llrp", LLRPConstants.LLRPNAMESPACE);

    if (enableCRC == null) {
        LOGGER.warn(" enableCRC not set");
        throw new MissingParameterException(" enableCRC not set");
    } else {
        element.addContent(enableCRC.encodeXML("EnableCRC", ns));
    }

    if (enablePCBits == null) {
        LOGGER.warn(" enablePCBits not set");
        throw new MissingParameterException(" enablePCBits not set");
    } else {
        element.addContent(enablePCBits.encodeXML("EnablePCBits", ns));
    }

    //element.addContent(reserved0.encodeXML("reserved",ns));
    //parameters
    return element;
}