- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我想使用 STAX 解析器解析 XML。
1) 加载 XML 内容并将其打印在控制台上。
预期输出:
ObjectID = OR:wt.part.WTPart:117313:425251666-1466176866678-1329564238-1-0-0-127@tibco.ptc.com
Class = com.ptc.windchill.esi.Part
LastChangedBy = LastChangedBy
等等,无论 XML 中存在什么标签。
我发现了一些东西here但这对我没有帮助,我的 XML:
<?xml version="1.0" encoding="UTF-8"?>
<wc:COLLECTION xmlns:wc="http://www.ptc.com/infoengine/1.0">
<Release NAME="Release" TYPE="Unknown" STATUS="0">
</Release>
<DeletedECN NAME="DeletedECN" TYPE="Unknown" STATUS="0">
</DeletedECN>
<AddedECN NAME="AddedECN" TYPE="Unknown" STATUS="0">
</AddedECN>
<ChangedECN NAME="ChangedECN" TYPE="Unknown" STATUS="0">
</ChangedECN>
<UnchangedECN NAME="UnchangedECN" TYPE="Unknown" STATUS="0">
</UnchangedECN>
<DeletedParts NAME="DeletedParts" TYPE="Unknown" STATUS="0">
</DeletedParts>
<AddedParts NAME="AddedParts" TYPE="Unknown" STATUS="0">
<Part>
<ObjectID>OR:wt.part.WTPart:117313:425251666-1466176866678-1329564238-1-0-0-127@tibco.ptc.com</ObjectID>
<Class>com.ptc.windchill.esi.Part</Class>
<LastChangedBy>Administrator</LastChangedBy>
<Number>0000000032</Number>
<StartEffectivity></StartEffectivity>
<EndEffectivity></EndEffectivity>
<StartSerialNumberEffectivity></StartSerialNumberEffectivity>
<EndSerialNumberEffectivity></EndSerialNumberEffectivity>
<StartLotNumberEffectivity></StartLotNumberEffectivity>
<EndLotNumberEffectivity></EndLotNumberEffectivity>
<SerialNumberEffectivityCxtPartNumber></SerialNumberEffectivityCxtPartNumber>
<LotNumberEffectivityCxtPartNumber></LotNumberEffectivityCxtPartNumber>
<DefaultUnit>ea</DefaultUnit>
<Name>test16</Name>
<PartType>separable</PartType>
<Source>make</Source>
<State>INWORK</State>
<IsPhantom>false</IsPhantom>
<Version>A</Version>
<Iteration>1</Iteration>
<PreviousVersion></PreviousVersion>
<IsConfigurable>standard</IsConfigurable>
<IsCollapsible>false</IsCollapsible>
<TargetID>1</TargetID>
</Part>
</AddedParts>
<ChangedParts NAME="ChangedParts" TYPE="Unknown" STATUS="0">
</ChangedParts>
<UnchangedParts NAME="UnchangedParts" TYPE="Unknown" STATUS="0">
</UnchangedParts>
<DeletedAlternateLinks NAME="DeletedAlternateLinks" TYPE="Unknown" STATUS="0">
</DeletedAlternateLinks>
<AddedAlternateLinks NAME="AddedAlternateLinks" TYPE="Unknown" STATUS="0">
</AddedAlternateLinks>
<DeletedDocuments NAME="DeletedDocuments" TYPE="Unknown" STATUS="0">
</DeletedDocuments>
<AddedDocuments NAME="AddedDocuments" TYPE="Unknown" STATUS="0">
</AddedDocuments>
<ChangedDocuments NAME="ChangedDocuments" TYPE="Unknown" STATUS="0">
</ChangedDocuments>
<UnchangedDocuments NAME="UnchangedDocuments" TYPE="Unknown" STATUS="0">
</UnchangedDocuments>
<DeletedDocumentLinks NAME="DeletedDocumentLinks" TYPE="Unknown" STATUS="0">
</DeletedDocumentLinks>
<AddedDocumentLinks NAME="AddedDocumentLinks" TYPE="Unknown" STATUS="0">
</AddedDocumentLinks>
<ChangedDocumentLinks NAME="ChangedDocumentLinks" TYPE="Unknown" STATUS="0">
</ChangedDocumentLinks>
<UnchangedDocumentLinks NAME="UnchangedDocumentLinks" TYPE="Unknown" STATUS="0">
</UnchangedDocumentLinks>
<DeletedBOMs NAME="DeletedBOMs" TYPE="Unknown" STATUS="0">
</DeletedBOMs>
<AddedBOMs NAME="AddedBOMs" TYPE="Unknown" STATUS="0">
</AddedBOMs>
<ChangedBOMs NAME="ChangedBOMs" TYPE="Unknown" STATUS="0">
</ChangedBOMs>
<UnchangedBOMs NAME="UnchangedBOMs" TYPE="Unknown" STATUS="0">
</UnchangedBOMs>
<DeletedBOMComponents NAME="DeletedBOMComponents" TYPE="Unknown" STATUS="0">
</DeletedBOMComponents>
<AddedBOMComponents NAME="AddedBOMComponents" TYPE="Unknown" STATUS="0">
</AddedBOMComponents>
<ChangedBOMComponents NAME="ChangedBOMComponents" TYPE="Unknown" STATUS="0">
</ChangedBOMComponents>
<UnchangedBOMComponents NAME="UnchangedBOMComponents" TYPE="Unknown" STATUS="0">
</UnchangedBOMComponents>
<DeletedSubstitutes NAME="DeletedSubstitutes" TYPE="Unknown" STATUS="0">
</DeletedSubstitutes>
<AddedSubstitutes NAME="AddedSubstitutes" TYPE="Unknown" STATUS="0">
</AddedSubstitutes>
<DeletedReferenceDesignators NAME="DeletedReferenceDesignators" TYPE="Unknown" STATUS="0">
</DeletedReferenceDesignators>
<AddedReferenceDesignators NAME="AddedReferenceDesignators" TYPE="Unknown" STATUS="0">
</AddedReferenceDesignators>
<DeletedProcessMaterials NAME="DeletedProcessMaterials" TYPE="Unknown" STATUS="0">
</DeletedProcessMaterials>
<AddedProcessMaterials NAME="AddedProcessMaterials" TYPE="Unknown" STATUS="0">
</AddedProcessMaterials>
<ChangedProcessMaterials NAME="ChangedProcessMaterials" TYPE="Unknown" STATUS="0">
</ChangedProcessMaterials>
<UnchangedProcessMaterials NAME="UnchangedProcessMaterials" TYPE="Unknown" STATUS="0">
</UnchangedProcessMaterials>
<DeletedToolings NAME="DeletedToolings" TYPE="Unknown" STATUS="0">
</DeletedToolings>
<AddedToolings NAME="AddedToolings" TYPE="Unknown" STATUS="0">
</AddedToolings>
<ChangedToolings NAME="ChangedToolings" TYPE="Unknown" STATUS="0">
</ChangedToolings>
<UnchangedToolings NAME="UnchangedToolings" TYPE="Unknown" STATUS="0">
</UnchangedToolings>
<DeletedProcessPlans NAME="DeletedProcessPlans" TYPE="Unknown" STATUS="0">
</DeletedProcessPlans>
<AddedProcessPlans NAME="AddedProcessPlans" TYPE="Unknown" STATUS="0">
</AddedProcessPlans>
<ChangedProcessPlans NAME="ChangedProcessPlans" TYPE="Unknown" STATUS="0">
</ChangedProcessPlans>
<UnchangedProcessPlans NAME="UnchangedProcessPlans" TYPE="Unknown" STATUS="0">
</UnchangedProcessPlans>
<DeletedOperations NAME="DeletedOperations" TYPE="Unknown" STATUS="0">
</DeletedOperations>
<AddedOperations NAME="AddedOperations" TYPE="Unknown" STATUS="0">
</AddedOperations>
<ChangedOperations NAME="ChangedOperations" TYPE="Unknown" STATUS="0">
</ChangedOperations>
<UnchangedOperations NAME="UnchangedOperations" TYPE="Unknown" STATUS="0">
</UnchangedOperations>
<DeletedOperationUsageLinks NAME="DeletedOperationUsageLinks" TYPE="Unknown" STATUS="0">
</DeletedOperationUsageLinks>
<AddedOperationUsageLinks NAME="AddedOperationUsageLinks" TYPE="Unknown" STATUS="0">
</AddedOperationUsageLinks>
<ChangedOperationUsageLinks NAME="ChangedOperationUsageLinks" TYPE="Unknown" STATUS="0">
</ChangedOperationUsageLinks>
<UnchangedOperationUsageLinks NAME="UnchangedOperationUsageLinks" TYPE="Unknown" STATUS="0">
</UnchangedOperationUsageLinks>
<DeletedProcessPlanPartLinks NAME="DeletedProcessPlanPartLinks" TYPE="Unknown" STATUS="0">
</DeletedProcessPlanPartLinks>
<AddedProcessPlanPartLinks NAME="AddedProcessPlanPartLinks" TYPE="Unknown" STATUS="0">
</AddedProcessPlanPartLinks>
<ChangedProcessPlanPartLinks NAME="ChangedProcessPlanPartLinks" TYPE="Unknown" STATUS="0">
</ChangedProcessPlanPartLinks>
<UnchangedProcessPlanPartLinks NAME="UnchangedProcessPlanPartLinks" TYPE="Unknown" STATUS="0">
</UnchangedProcessPlanPartLinks>
<DeletedSequences NAME="DeletedSequences" TYPE="Unknown" STATUS="0">
</DeletedSequences>
<AddedSequences NAME="AddedSequences" TYPE="Unknown" STATUS="0">
</AddedSequences>
<ChangedSequences NAME="ChangedSequences" TYPE="Unknown" STATUS="0">
</ChangedSequences>
<UnchangedSequences NAME="UnchangedSequences" TYPE="Unknown" STATUS="0">
</UnchangedSequences>
<DeletedOprConsumableResourceLinks NAME="DeletedOprConsumableResourceLinks" TYPE="Unknown" STATUS="0">
</DeletedOprConsumableResourceLinks>
<AddedOprConsumableResourceLinks NAME="AddedOprConsumableResourceLinks" TYPE="Unknown" STATUS="0">
</AddedOprConsumableResourceLinks>
<ChangedOprConsumableResourceLinks NAME="ChangedOprConsumableResourceLinks" TYPE="Unknown" STATUS="0">
</ChangedOprConsumableResourceLinks>
<UnchangedOprConsumableResourceLinks NAME="UnchangedOprConsumableResourceLinks" TYPE="Unknown" STATUS="0">
</UnchangedOprConsumableResourceLinks>
<DeletedOprWorkCenterLinks NAME="DeletedOprWorkCenterLinks" TYPE="Unknown" STATUS="0">
</DeletedOprWorkCenterLinks>
<AddedOprWorkCenterLinks NAME="AddedOprWorkCenterLinks" TYPE="Unknown" STATUS="0">
</AddedOprWorkCenterLinks>
<ChangedOprWorkCenterLinks NAME="ChangedOprWorkCenterLinks" TYPE="Unknown" STATUS="0">
</ChangedOprWorkCenterLinks>
<UnchangedOprWorkCenterLinks NAME="UnchangedOprWorkCenterLinks" TYPE="Unknown" STATUS="0">
</UnchangedOprWorkCenterLinks>
<DeletedOprBomAllocatedParts NAME="DeletedOprBomAllocatedParts" TYPE="Unknown" STATUS="0">
</DeletedOprBomAllocatedParts>
<AddedOprBomAllocatedParts NAME="AddedOprBomAllocatedParts" TYPE="Unknown" STATUS="0">
</AddedOprBomAllocatedParts>
<ChangedOprBomAllocatedParts NAME="ChangedOprBomAllocatedParts" TYPE="Unknown" STATUS="0">
</ChangedOprBomAllocatedParts>
<UnchangedOprBomAllocatedParts NAME="UnchangedOprBomAllocatedParts" TYPE="Unknown" STATUS="0">
</UnchangedOprBomAllocatedParts>
<DeletedOprOperatedOnParts NAME="DeletedOprOperatedOnParts" TYPE="Unknown" STATUS="0">
</DeletedOprOperatedOnParts>
<AddedOprOperatedOnParts NAME="AddedOprOperatedOnParts" TYPE="Unknown" STATUS="0">
</AddedOprOperatedOnParts>
<ChangedOprOperatedOnParts NAME="ChangedOprOperatedOnParts" TYPE="Unknown" STATUS="0">
</ChangedOprOperatedOnParts>
<UnchangedOprOperatedOnParts NAME="UnchangedOprOperatedOnParts" TYPE="Unknown" STATUS="0">
</UnchangedOprOperatedOnParts>
<DeletedStandardProcedureLinks NAME="DeletedStandardProcedureLinks" TYPE="Unknown" STATUS="0">
</DeletedStandardProcedureLinks>
<AddedStandardProcedureLinks NAME="AddedStandardProcedureLinks" TYPE="Unknown" STATUS="0">
</AddedStandardProcedureLinks>
<ChangedStandardProcedureLinks NAME="ChangedStandardProcedureLinks" TYPE="Unknown" STATUS="0">
</ChangedStandardProcedureLinks>
<UnchangedStandardProcedureLinks NAME="UnchangedStandardProcedureLinks" TYPE="Unknown" STATUS="0">
</UnchangedStandardProcedureLinks>
<DeletedSkills NAME="DeletedSkills" TYPE="Unknown" STATUS="0">
</DeletedSkills>
<AddedSkills NAME="AddedSkills" TYPE="Unknown" STATUS="0">
</AddedSkills>
<ChangedSkills NAME="ChangedSkills" TYPE="Unknown" STATUS="0">
</ChangedSkills>
<UnchangedSkills NAME="UnchangedSkills" TYPE="Unknown" STATUS="0">
</UnchangedSkills>
<DeletedPlants NAME="DeletedPlants" TYPE="Unknown" STATUS="0">
</DeletedPlants>
<AddedPlants NAME="AddedPlants" TYPE="Unknown" STATUS="0">
</AddedPlants>
<ChangedPlants NAME="ChangedPlants" TYPE="Unknown" STATUS="0">
</ChangedPlants>
<UnchangedPlants NAME="UnchangedPlants" TYPE="Unknown" STATUS="0">
</UnchangedPlants>
<DeletedResourceGroups NAME="DeletedResourceGroups" TYPE="Unknown" STATUS="0">
</DeletedResourceGroups>
<AddedResourceGroups NAME="AddedResourceGroups" TYPE="Unknown" STATUS="0">
</AddedResourceGroups>
<ChangedResourceGroups NAME="ChangedResourceGroups" TYPE="Unknown" STATUS="0">
</ChangedResourceGroups>
<UnchangedResourceGroups NAME="UnchangedResourceGroups" TYPE="Unknown" STATUS="0">
</UnchangedResourceGroups>
<DeletedWorkCenters NAME="DeletedWorkCenters" TYPE="Unknown" STATUS="0">
</DeletedWorkCenters>
<AddedWorkCenters NAME="AddedWorkCenters" TYPE="Unknown" STATUS="0">
</AddedWorkCenters>
<ChangedWorkCenters NAME="ChangedWorkCenters" TYPE="Unknown" STATUS="0">
</ChangedWorkCenters>
<UnchangedWorkCenters NAME="UnchangedWorkCenters" TYPE="Unknown" STATUS="0">
</UnchangedWorkCenters>
<DeletedPlantAssignmentLinks NAME="DeletedPlantAssignmentLinks" TYPE="Unknown" STATUS="0">
</DeletedPlantAssignmentLinks>
<AddedPlantAssignmentLinks NAME="AddedPlantAssignmentLinks" TYPE="Unknown" STATUS="0">
</AddedPlantAssignmentLinks>
<ChangedPlantAssignmentLinks NAME="ChangedPlantAssignmentLinks" TYPE="Unknown" STATUS="0">
</ChangedPlantAssignmentLinks>
<UnchangedPlantAssignmentLinks NAME="UnchangedPlantAssignmentLinks" TYPE="Unknown" STATUS="0">
</UnchangedPlantAssignmentLinks>
<DeletedResourceUsageLinks NAME="DeletedResourceUsageLinks" TYPE="Unknown" STATUS="0">
</DeletedResourceUsageLinks>
<AddedResourceUsageLinks NAME="AddedResourceUsageLinks" TYPE="Unknown" STATUS="0">
</AddedResourceUsageLinks>
<ChangedResourceUsageLinks NAME="ChangedResourceUsageLinks" TYPE="Unknown" STATUS="0">
</ChangedResourceUsageLinks>
<UnchangedResourceUsageLinks NAME="UnchangedResourceUsageLinks" TYPE="Unknown" STATUS="0">
</UnchangedResourceUsageLinks>
<CurrentAUMs NAME="CurrentAUMs" TYPE="Unknown" STATUS="0">
</CurrentAUMs>
<AddedEPMRepresentations NAME="AddedEPMRepresentations" TYPE="Unknown" STATUS="0">
</AddedEPMRepresentations>
<DeletedControlCharacteristics NAME="DeletedControlCharacteristics" TYPE="Unknown" STATUS="0">
</DeletedControlCharacteristics>
<AddedControlCharacteristics NAME="AddedControlCharacteristics" TYPE="Unknown" STATUS="0">
</AddedControlCharacteristics>
<ChangedControlCharacteristics NAME="ChangedControlCharacteristics" TYPE="Unknown" STATUS="0">
</ChangedControlCharacteristics>
<UnchangedControlCharacteristics NAME="UnchangedControlCharacteristics" TYPE="Unknown" STATUS="0">
</UnchangedControlCharacteristics>
<ModelItems NAME="ModelItems" TYPE="Unknown" STATUS="0">
</ModelItems>
<DeletedQualityLinks NAME="DeletedQualityLinks" TYPE="Unknown" STATUS="0">
</DeletedQualityLinks>
<AddedQualityLinks NAME="AddedQualityLinks" TYPE="Unknown" STATUS="0">
</AddedQualityLinks>
<ChangedQualityLinks NAME="ChangedQualityLinks" TYPE="Unknown" STATUS="0">
</ChangedQualityLinks>
<UnchangedQualityLinks NAME="UnchangedQualityLinks" TYPE="Unknown" STATUS="0">
</UnchangedQualityLinks>
<DeletedOptionSets NAME="DeletedOptionSets" TYPE="Unknown" STATUS="0">
</DeletedOptionSets>
<AddedOptionSets NAME="AddedOptionSets" TYPE="Unknown" STATUS="0">
</AddedOptionSets>
<ChangedOptionSets NAME="ChangedOptionSets" TYPE="Unknown" STATUS="0">
</ChangedOptionSets>
<UnchangedOptionSets NAME="UnchangedOptionSets" TYPE="Unknown" STATUS="0">
</UnchangedOptionSets>
<DeletedOptions NAME="DeletedOptions" TYPE="Unknown" STATUS="0">
</DeletedOptions>
<AddedOptions NAME="AddedOptions" TYPE="Unknown" STATUS="0">
</AddedOptions>
<ChangedOptions NAME="ChangedOptions" TYPE="Unknown" STATUS="0">
</ChangedOptions>
<UnchangedOptions NAME="UnchangedOptions" TYPE="Unknown" STATUS="0">
</UnchangedOptions>
<DeletedChoices NAME="DeletedChoices" TYPE="Unknown" STATUS="0">
</DeletedChoices>
<AddedChoices NAME="AddedChoices" TYPE="Unknown" STATUS="0">
</AddedChoices>
<ChangedChoices NAME="ChangedChoices" TYPE="Unknown" STATUS="0">
</ChangedChoices>
<UnchangedChoices NAME="UnchangedChoices" TYPE="Unknown" STATUS="0">
</UnchangedChoices>
<DeletedOptionSetOptionLinks NAME="DeletedOptionSetOptionLinks" TYPE="Unknown" STATUS="0">
</DeletedOptionSetOptionLinks>
<AddedOptionSetOptionLinks NAME="AddedOptionSetOptionLinks" TYPE="Unknown" STATUS="0">
</AddedOptionSetOptionLinks>
<DeletedOptionSetMemberLinks NAME="DeletedOptionSetMemberLinks" TYPE="Unknown" STATUS="0">
</DeletedOptionSetMemberLinks>
<AddedOptionSetMemberLinks NAME="AddedOptionSetMemberLinks" TYPE="Unknown" STATUS="0">
</AddedOptionSetMemberLinks>
<ChangedOptionSetMemberLinks NAME="ChangedOptionSetMemberLinks" TYPE="Unknown" STATUS="0">
</ChangedOptionSetMemberLinks>
<UnchangedOptionSetMemberLinks NAME="UnchangedOptionSetMemberLinks" TYPE="Unknown" STATUS="0">
</UnchangedOptionSetMemberLinks>
<DeletedAssociatedOptionSetLinks NAME="DeletedAssociatedOptionSetLinks" TYPE="Unknown" STATUS="0">
</DeletedAssociatedOptionSetLinks>
<AddedAssociatedOptionSetLinks NAME="AddedAssociatedOptionSetLinks" TYPE="Unknown" STATUS="0">
</AddedAssociatedOptionSetLinks>
<DeletedChoiceMappableChoiceLinks NAME="DeletedChoiceMappableChoiceLinks" TYPE="Unknown" STATUS="0">
</DeletedChoiceMappableChoiceLinks>
<AddedChoiceMappableChoiceLinks NAME="AddedChoiceMappableChoiceLinks" TYPE="Unknown" STATUS="0">
</AddedChoiceMappableChoiceLinks>
<ChangedChoiceMappableChoiceLinks NAME="ChangedChoiceMappableChoiceLinks" TYPE="Unknown" STATUS="0">
</ChangedChoiceMappableChoiceLinks>
<UnchangedChoiceMappableChoiceLinks NAME="UnchangedChoiceMappableChoiceLinks" TYPE="Unknown" STATUS="0">
</UnchangedChoiceMappableChoiceLinks>
<DeletedOptionSetRuleLinks NAME="DeletedOptionSetRuleLinks" TYPE="Unknown" STATUS="0">
</DeletedOptionSetRuleLinks>
<AddedOptionSetRuleLinks NAME="AddedOptionSetRuleLinks" TYPE="Unknown" STATUS="0">
</AddedOptionSetRuleLinks>
<ChangedOptionSetRuleLinks NAME="ChangedOptionSetRuleLinks" TYPE="Unknown" STATUS="0">
</ChangedOptionSetRuleLinks>
<UnchangedOptionSetRuleLinks NAME="UnchangedOptionSetRuleLinks" TYPE="Unknown" STATUS="0">
</UnchangedOptionSetRuleLinks>
<DeletedRules NAME="DeletedRules" TYPE="Unknown" STATUS="0">
</DeletedRules>
<AddedRules NAME="AddedRules" TYPE="Unknown" STATUS="0">
</AddedRules>
<ChangedRules NAME="ChangedRules" TYPE="Unknown" STATUS="0">
</ChangedRules>
<UnchangedRules NAME="UnchangedRules" TYPE="Unknown" STATUS="0">
</UnchangedRules>
<DeletedRuleMemberLinks NAME="DeletedRuleMemberLinks" TYPE="Unknown" STATUS="0">
</DeletedRuleMemberLinks>
<AddedRuleMemberLinks NAME="AddedRuleMemberLinks" TYPE="Unknown" STATUS="0">
</AddedRuleMemberLinks>
<ChangedRuleMemberLinks NAME="ChangedRuleMemberLinks" TYPE="Unknown" STATUS="0">
</ChangedRuleMemberLinks>
<UnchangedRuleMemberLinks NAME="UnchangedRuleMemberLinks" TYPE="Unknown" STATUS="0">
</UnchangedRuleMemberLinks>
<DeletedRuleMemberActionLinks NAME="DeletedRuleMemberActionLinks" TYPE="Unknown" STATUS="0">
</DeletedRuleMemberActionLinks>
<AddedRuleMemberActionLinks NAME="AddedRuleMemberActionLinks" TYPE="Unknown" STATUS="0">
</AddedRuleMemberActionLinks>
<ChangedRuleMemberActionLinks NAME="ChangedRuleMemberActionLinks" TYPE="Unknown" STATUS="0">
</ChangedRuleMemberActionLinks>
<UnchangedRuleMemberActionLinks NAME="UnchangedRuleMemberActionLinks" TYPE="Unknown" STATUS="0">
</UnchangedRuleMemberActionLinks>
<DeletedPlantLocalizationLinks NAME="DeletedPlantLocalizationLinks" TYPE="Unknown" STATUS="0">
</DeletedPlantLocalizationLinks>
<AddedPlantLocalizationLinks NAME="AddedPlantLocalizationLinks" TYPE="Unknown" STATUS="0">
</AddedPlantLocalizationLinks>
<ChangedPlantLocalizationLinks NAME="ChangedPlantLocalizationLinks" TYPE="Unknown" STATUS="0">
</ChangedPlantLocalizationLinks>
<UnchangedPlantLocalizationLinks NAME="UnchangedPlantLocalizationLinks" TYPE="Unknown" STATUS="0">
</UnchangedPlantLocalizationLinks>
<DeletedProcessPlanLocalizationLinks NAME="DeletedProcessPlanLocalizationLinks" TYPE="Unknown" STATUS="0">
</DeletedProcessPlanLocalizationLinks>
<AddedProcessPlanLocalizationLinks NAME="AddedProcessPlanLocalizationLinks" TYPE="Unknown" STATUS="0">
</AddedProcessPlanLocalizationLinks>
<ChangedProcessPlanLocalizationLinks NAME="ChangedProcessPlanLocalizationLinks" TYPE="Unknown" STATUS="0">
</ChangedProcessPlanLocalizationLinks>
<UnchangedProcessPlanLocalizationLinks NAME="UnchangedProcessPlanLocalizationLinks" TYPE="Unknown" STATUS="0">
</UnchangedProcessPlanLocalizationLinks>
</wc:COLLECTION>
我做了类似的事情:
import java.util.ArrayList;
import java.util.List;
import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLStreamConstants;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader;
public class StaxParserDemo
{
public static void main(String[] args) throws XMLStreamException
{
List<WcCOLLECTION> empList = null;
WcCOLLECTION currEmp = null;
String tagContent = null;
XMLInputFactory factory = XMLInputFactory.newInstance();
XMLStreamReader reader =
factory.createXMLStreamReader(
ClassLoader.getSystemResourceAsStream("c:\\file.xml"));
while(reader.hasNext()){
int event = reader.next();
switch(event){
case XMLStreamConstants.START_ELEMENT:
if ("Part".equals(reader.getLocalName())){
currEmp = new WcCOLLECTION();
currEmp.ObjectID = reader.getAttributeValue(0);
}
if("Part".equals(reader.getLocalName())){
empList = new ArrayList<>();
}
break;
case XMLStreamConstants.CHARACTERS:
tagContent = reader.getText().trim();
break;
case XMLStreamConstants.END_ELEMENT:
switch(reader.getLocalName()){
case "Part":
empList.add(currEmp);
break;
case "ObjectID":
currEmp.ObjectID = tagContent;
break;
case "Class":
currEmp.Class = tagContent;
break;
case "LastChangedBy":
currEmp.LastChangedBy = tagContent;
break;
case "StartEffectivity":
currEmp.StartEffectivity = tagContent;
break;
}
break;
case XMLStreamConstants.START_DOCUMENT:
empList = new ArrayList<>();
break;
}
}
//Print the employee list populated from XML
for ( WcCOLLECTION emp : empList){
System.out.println(emp);
}
}
}
class WcCOLLECTION
{
String ObjectID;
String Class;
String LastChangedBy;
String Number;
String StartEffectivity;
String EndEffectivity;
String StartSerialNumberEffectivity;
String EndSerialNumberEffectivity;
String StartLotNumberEffectivity;
String EndLotNumberEffectivity;
String SerialNumberEffectivityCxtPartNumber;
String LotNumberEffectivityCxtPartNumber;
String DefaultUnit;
String Name;
String PartType;
String Source;
String State;
String IsPhantom;
String Version;
String Iteration;
String PreviousVersion;
String IsConfigurable;
String IsCollapsible;
String TargetID;
@Override
public String toString()
{
//return Class+" "+LastChangedBy+"("+ObjectID+") "+StartEffectivity+" "+EndEffectivity+" "+StartSerialNumberEffectivity+" "+EndSerialNumberEffectivity+" "+SerialNumberEffectivityCxtPartNumber+" "+LotNumberEffectivityCxtPartNumber+" "+DefaultUnit+" "+Name+" "+PartType+" "+Source+" "+State+" "+IsPhantom+" "+State+" "+Version+" "+Iteration+" "+PreviousVersion+" "+IsConfigurable+" "+IsCollapsible+" "+TargetID;
return Class+" "+LastChangedBy+"("+ObjectID+") "+StartEffectivity;
}
}
最佳答案
我编写了一些java代码,它使用STAX解析器解析XML,它工作得很好:
public class ErpStAXParser
{
public static void main(String[] args)
{
// all the required attributes from the xml file which will need to print
boolean ObjectID = false;
boolean Class = false;
boolean LastChangedBy = false;
boolean Number = false;
boolean StartEffectivity = false;
boolean EndEffectivity = false;
boolean StartSerialNumberEffectivity = false;
boolean EndSerialNumberEffectivity = false;
boolean StartLotNumberEffectivity = false;
boolean EndLotNumberEffectivity = false;
boolean SerialNumberEffectivityCxtPartNumber = false;
boolean LotNumberEffectivityCxtPartNumber = false;
boolean DefaultUnit = false;
boolean Name = false;
boolean PartType = false;
boolean Source = false;
boolean State = false;
boolean IsPhantom = false;
boolean Version = false;
boolean Iteration = false;
boolean PreviousVersion = false;
boolean IsConfigurable = false;
boolean IsCollapsible = false;
boolean TargetID = false;
try
{
XMLInputFactory factory = XMLInputFactory.newInstance();
XMLEventReader eventReader =
factory.createXMLEventReader(
new FileReader("c:\\staxTestFile.xml"));
while(eventReader.hasNext())
{
XMLEvent event = eventReader.nextEvent();
switch(event.getEventType())
{
case XMLStreamConstants.START_ELEMENT:
StartElement startElement = event.asStartElement();
String qName = startElement.getName().getLocalPart();
if (qName.equalsIgnoreCase("Part"))
{
System.out.println("Start Element : Part");
Iterator<Attribute> attributes = startElement.getAttributes();
}
else if (qName.equalsIgnoreCase("ObjectID"))
{
ObjectID = true;
} else if (qName.equalsIgnoreCase("Class"))
{
Class = true;
} else if (qName.equalsIgnoreCase("LastChangedBy"))
{
LastChangedBy = true;
}
else if (qName.equalsIgnoreCase("Number"))
{
Number = true;
}
else if (qName.equalsIgnoreCase("StartEffectivity"))
{
StartEffectivity = true;
} else if (qName.equalsIgnoreCase("EndSerialNumberEffectivity"))
{
EndSerialNumberEffectivity = true;
} else if (qName.equalsIgnoreCase("StartSerialNumberEffectivity"))
{
StartSerialNumberEffectivity = true;
}
else if (qName.equalsIgnoreCase("EndSerialNumberEffectivity"))
{
EndSerialNumberEffectivity = true;
}
else if (qName.equalsIgnoreCase("StartLotNumberEffectivity"))
{
StartLotNumberEffectivity = true;
} else if (qName.equalsIgnoreCase("EndLotNumberEffectivity"))
{
EndLotNumberEffectivity = true;
} else if (qName.equalsIgnoreCase("SerialNumberEffectivityCxtPartNumber"))
{
SerialNumberEffectivityCxtPartNumber = true;
}
else if (qName.equalsIgnoreCase("LotNumberEffectivityCxtPartNumber"))
{
LotNumberEffectivityCxtPartNumber = true;
}
else if (qName.equalsIgnoreCase("DefaultUnit"))
{
DefaultUnit = true;
} else if (qName.equalsIgnoreCase("Name"))
{
Name = true;
} else if (qName.equalsIgnoreCase("PartType"))
{
PartType = true;
}
else if (qName.equalsIgnoreCase("Source"))
{
Source = true;
}
else if (qName.equalsIgnoreCase("State"))
{
State = true;
} else if (qName.equalsIgnoreCase("IsPhantom"))
{
IsPhantom = true;
} else if (qName.equalsIgnoreCase("Version"))
{
Version = true;
}
else if (qName.equalsIgnoreCase("Iteration"))
{
Iteration = true;
}
else if (qName.equalsIgnoreCase("PreviousVersion"))
{
PreviousVersion = true;
} else if (qName.equalsIgnoreCase("IsConfigurable"))
{
IsConfigurable = true;
} else if (qName.equalsIgnoreCase("IsCollapsible"))
{
IsCollapsible = true;
}
else if (qName.equalsIgnoreCase("TargetID"))
{
TargetID = true;
}
break;
case XMLStreamConstants.CHARACTERS:
Characters characters = event.asCharacters();
if(ObjectID){
System.out.println("ObjectID: "
+ characters.getData());
ObjectID = false;
}
if(Class){
System.out.println("Class: "
+ characters.getData());
Class = false;
}
if(LastChangedBy){
System.out.println("LastChangedBy "
+ characters.getData());
LastChangedBy = false;
}
if(Number){
System.out.println("Number: "
+ characters.getData());
Number = false;
}
if(StartEffectivity){
System.out.println("StartEffectivity: "
+ characters.getData());
StartEffectivity = false;
}
if(EndEffectivity){
System.out.println("EndEffectivity "
+ characters.getData());
EndEffectivity = false;
}
if(StartSerialNumberEffectivity){
System.out.println("StartSerialNumberEffectivity "
+ characters.getData());
StartSerialNumberEffectivity = false;
}
if(EndSerialNumberEffectivity){
System.out.println("EndSerialNumberEffectivity: "
+ characters.getData());
EndSerialNumberEffectivity = false;
}
if(StartLotNumberEffectivity){
System.out.println("StartLotNumberEffectivity"
+ characters.getData());
StartLotNumberEffectivity = false;
}
if(EndLotNumberEffectivity){
System.out.println("EndLotNumberEffectivity: "
+ characters.getData());
EndLotNumberEffectivity = false;
}
if(SerialNumberEffectivityCxtPartNumber){
System.out.println("SerialNumberEffectivityCxtPartNumber "
+ characters.getData());
SerialNumberEffectivityCxtPartNumber = false;
}
if(LotNumberEffectivityCxtPartNumber){
System.out.println("LotNumberEffectivityCxtPartNumber: "
+ characters.getData());
LotNumberEffectivityCxtPartNumber = false;
}
if(DefaultUnit){
System.out.println("DefaultUnit: "
+ characters.getData());
DefaultUnit = false;
}
if(Name){
System.out.println("Name: "
+ characters.getData());
Name = false;
}
if(PartType){
System.out.println("PartType: "
+ characters.getData());
PartType = false;
}
if(Source){
System.out.println("Source: "
+ characters.getData());
Source = false;
}
if(State){
System.out.println("State: "
+ characters.getData());
State = false;
}
if(IsPhantom){
System.out.println("IsPhantom: "
+ characters.getData());
IsPhantom = false;
}
if(Version){
System.out.println("Version: "
+ characters.getData());
Version = false;
}
if(Iteration){
System.out.println("Iteration: "
+ characters.getData());
Iteration = false;
}
if(PreviousVersion){
System.out.println("PreviousVersion: "
+ characters.getData());
PreviousVersion = false;
}
if(IsConfigurable){
System.out.println("IsConfigurable: "
+ characters.getData());
IsConfigurable = false;
}
if(IsCollapsible){
System.out.println("IsCollapsible: "
+ characters.getData());
IsCollapsible = false;
}
if(TargetID){
System.out.println("TargetID: "
+ characters.getData());
TargetID = false;
}
break;
case XMLStreamConstants.END_ELEMENT:
EndElement endElement = event.asEndElement();
if(endElement.getName().getLocalPart().equalsIgnoreCase("Part")){
System.out.println("End Element : Part");
System.out.println();
}
break;
}//switch
}//while
}//try
catch(Exception e)
{
e.printStackTrace();
}
}//main
}//class
关于java - 如何使用 Stax 解析器解析 XML,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38067339/
我知道使用sax时可以验证xml文件。但是我可以在使用Stax时进行验证吗? 最佳答案 SAX和DOM有两种XML验证方式: 单独验证-通过Validator.validate() 在解析期间验证-通
我在类路径中有一个 woodstox 和 java SE 1.6 stax 解析器,但默认情况下似乎选择了 woodstox。 但是在某些情况下,我想使用默认的 Java stax 解析器。有没有办法
我正面临 Woodstox STAX 和 java 1.6 STAX 实现之间奇怪的运行时冲突。由于我使用的是 CXF,它会将 Woodstox jar 作为其依赖项的一部分。这是我正在使用的示例代码
我正在尝试将一些代码从使用 DOM(通过 jDOM)转换为使用 StAX。同时,我正在从基于 DTD 的验证迁移到基于 XSD 的验证。哦,为了更好的衡量,我将 JAXB 引入等式 :) 无论如何,作
我不知道如何提取 XML 文件中的开始标记元素名称。我很接近〜意味着没有错误,我正在获取标签名称,但我正在获取标签名称加上信息。我得到的是: {http://www.publishing.org}au
对于下面发布的 xml 文件,我正在使用 StAX 来处理它。我写了下面的代码,但我不知道为什么尽管 xml 文件中有属性,但没有打印有关属性的信息。我希望控制台显示有关“id”、“lat”和“lon
我正在使用 StAX 来处理巨大的 xml 文件。如下面的代码所示,在 switch-case 中有一个默认条件。当我运行代码时默认情况下的文本打印以下内容: unhandled case4 case
我正在尝试使用 stax 从下面的 xml 中获取父项,请注意,同一结构中可以有多个父项和子项。 PARENT-CODE-1 PARENT-NAME-1
我有一个 xml <RPTSVC role:instanceID="765002" role:roleName="Re
是否有可能/是否有一种简单的方法可以找到与 START_ELEMENT 相对应的结束标记 (END_ELEMENT),如下所示? while(reader.hasNext()){ XM
我有以下(测试)XML 文件和使用 StaX 的 Java 代码。我想将此代码应用于大约 30 GB 大但元素相当小的文件,所以我认为 StaX 是一个不错的选择。我收到以下错误: 线程“main”中
我正在使用 java stax XMLStreamReader 来读取 xml。我想抓取某些内部节点的整个字符串。 XML: 我只想能够
我一直在尝试使用 StAX 创建一个 XML Controller 类。我的问题是我没有得到一个元素的完整字符串,而是得到了字符串的一小部分。 (请注意,出于安全原因,某些内容已被隐藏,这些内容将显示
我使用的是 java 6,rt.jar 具有进行基于 STaX 的解析所需的所有类。我主要使用以下类: import javax.xml.stream.XMLEventReader; import j
我正在使用 STAX 事件 API 读取从 SOAP 调用接收到的二进制数据,并希望将其流式传输给使用者。 SOAP 调用的 XML 有效负载如下所示: ......... PHNvY
我在来自 http://stax.codehaus.org/ 的 vrsion 1.2.0 中使用 StAX Streaming Api .当我尝试将以下 xml 写入文件时,不会转义大于 char
我正在使用以下简单的 StAX 代码循环访问 XML 中的所有标记。尺寸input.xml > 100 MB XMLInputFactory xif = XMLInputFactory.newInst
我正在读取与下面相同的 XML 文件: 我希望下面的代码打印出三个 e在屏幕上: XMLInputFactory factory = XMLInputFact
我有以下代码: XMLInputFactory inputFactory = XMLInputFactory.newInstance(); XMLStreamReader xmlStreamReade
我知道如何利用 java stax iterator api 来读取 xml 文档,但我想了解 XMLEvent 和 XMLEventReader 的实现。 XMLInputFactory xmlIn
我是一名优秀的程序员,十分优秀!