<?xml version="1.0"?> <License version="1"> <ActivationInfo> <ActivationDate></ActivationDate> <IssueDate>22-Dec-2015</IssueDate> </ActivationInfo> <MachineInfo> <MachineName></MachineName> <SoftwareIds></SoftwareIds> </MachineInfo> <LicenseKeys> <LicenseKey> <LicenseVersion>1</LicenseVersion> <FeatureName>PLI_FEATURE1</FeatureName> <LicenseType>PERMANENT</LicenseType> <CustomProperties> <CustomProperty> <key>LICENSETYPE</key> <value>EVAL</value> </CustomProperty> <CustomProperty> <key>CAPACITY</key> <value>10</value> </CustomProperty> <CustomProperty> <key>CAPACITY_UNIT</key> <value>TB</value> </CustomProperty> </CustomProperties> </LicenseKey> <LicenseKey> <FeatureName>PLI_FEATURE2</FeatureName> <LicenseType expirationDate="01-Jan-2017">EVALUATION</LicenseType> <CustomProperties> <CustomProperty> <key>LICENSETYPE</key> <value>EVAL</value> </CustomProperty> <CustomProperty> <key>CAPACITY</key> <value>10</value> </CustomProperty> <CustomProperty> <key>CAPACITY_UNIT</key> <value>TB</value> </CustomProperty> </CustomProperties> </LicenseKey> <LicenseKey> <FeatureName>PLI_FEATURE3</FeatureName> <LicenseType>SUBSCRIPTION</LicenseType> <CustomProperties> <CustomProperty> <key>LICENSETYPE</key> <value>EVAL</value> </CustomProperty> <CustomProperty> <key>CAPACITY</key> <value>10</value> </CustomProperty> <CustomProperty> <key>CAPACITY_UNIT</key> <value>TB</value> </CustomProperty> <CustomProperty> <key>START_DATE</key> <value>10-Jun-2015</value> </CustomProperty> <CustomProperty> <key>END_DATE</key> <value>09-Jun-2016</value> </CustomProperty> <CustomProperty> <key>GRACE_PERIOD</key> <value>23-Jun-2016</value> </CustomProperty> </CustomProperties> </LicenseKey> </LicenseKeys> </License>

HI,

i need to print <LicenseKey> complete nodes till </LicenseKey> for a given particular <FeatureName> ( this is a child of licensekey node).
please help me in this using libxml2. find below the xml.

<?xml version="1.0"?> <License version="1"> <ActivationInfo> <ActivationDate></ActivationDate> <IssueDate>22-Dec-2015</IssueDate> </ActivationInfo> <MachineInfo> <MachineName></MachineName> <SoftwareIds></SoftwareIds> </MachineInfo> <LicenseKeys> <LicenseKey> <LicenseVersion>1</LicenseVersion> <FeatureName>PLI_FEATURE1</FeatureName> <LicenseType>PERMANENT</LicenseType> <CustomProperties> <CustomProperty> <key>LICENSETYPE</key> <value>EVAL</value> </CustomProperty> <CustomProperty> <key>CAPACITY</key> <value>10</value> </CustomProperty> <CustomProperty> <key>CAPACITY_UNIT</key> <value>TB</value> </CustomProperty> </CustomProperties> </LicenseKey> <LicenseKey> <FeatureName>PLI_FEATURE2</FeatureName> <LicenseType expirationDate="01-Jan-2017">EVALUATION</LicenseType> <CustomProperties> <CustomProperty> <key>LICENSETYPE</key> <value>EVAL</value> </CustomProperty> <CustomProperty> <key>CAPACITY</key> <value>10</value> </CustomProperty> <CustomProperty> <key>CAPACITY_UNIT</key> <value>TB</value> </CustomProperty> </CustomProperties> </LicenseKey> <LicenseKey> <FeatureName>PLI_FEATURE3</FeatureName> <LicenseType>SUBSCRIPTION</LicenseType> <CustomProperties> <CustomProperty> <key>LICENSETYPE</key> <value>EVAL</value> </CustomProperty> <CustomProperty> <key>CAPACITY</key> <value>10</value> </CustomProperty> <CustomProperty> <key>CAPACITY_UNIT</key> <value>TB</value> </CustomProperty> <CustomProperty> <key>START_DATE</key> <value>10-Jun-2015</value> </CustomProperty> <CustomProperty> <key>END_DATE</key> <value>09-Jun-2016</value> </CustomProperty> <CustomProperty> <key>GRACE_PERIOD</key> <value>23-Jun-2016</value> </CustomProperty> </CustomProperties> </LicenseKey> </LicenseKeys> </License>

Please put your xml in code blocks and make sure they are properly indented and nodes are on separate lines. No one wants to analyze this as is.

<?xml version="1.0"?>
<License version="1">
    <ActivationInfo>
        <ActivationDate></ActivationDate>
        <IssueDate>22-Dec-2015</IssueDate>
    </ActivationInfo>
    <MachineInfo>
        <MachineName></MachineName>
        <SoftwareIds></SoftwareIds>
    </MachineInfo>
    <LicenseKeys>
        <LicenseKey>
            <LicenseVersion>1</LicenseVersion>
            <FeatureName>PLI_FEATURE1</FeatureName>
            <LicenseType>PERMANENT</LicenseType>
            <CustomProperties>                       
                <CustomProperty>
                    <key>LICENSETYPE</key>
                    <value>EVAL</value>
                </CustomProperty>
                <CustomProperty>
                    <key>CAPACITY</key>
                    <value>10</value>
                </CustomProperty>
                <CustomProperty>
                    <key>CAPACITY_UNIT</key>
                    <value>TB</value>
                </CustomProperty>
            </CustomProperties>
        </LicenseKey>
        <LicenseKey>
            <FeatureName>PLI_FEATURE2</FeatureName>  
            <LicenseType expirationDate="01-Jan-2017">EVALUATION</LicenseType>
            <CustomProperties>                       
                <CustomProperty>
                    <key>LICENSETYPE</key>
                    <value>EVAL</value>
                </CustomProperty>
                <CustomProperty>
                    <key>CAPACITY</key>
                    <value>10</value>
                </CustomProperty>
                <CustomProperty>
                    <key>CAPACITY_UNIT</key>
                    <value>TB</value>
                </CustomProperty>
            </CustomProperties>
        </LicenseKey>
        <LicenseKey>
            <FeatureName>PLI_FEATURE3</FeatureName>  
            <LicenseType>SUBSCRIPTION</LicenseType>      
            <CustomProperties>                       
                <CustomProperty>
                    <key>LICENSETYPE</key>
                    <value>EVAL</value>
                </CustomProperty>
                <CustomProperty>
                    <key>CAPACITY</key>
                    <value>10</value>
                </CustomProperty>
                <CustomProperty>
                    <key>CAPACITY_UNIT</key>
                    <value>TB</value>
                </CustomProperty>
                <CustomProperty>
                    <key>START_DATE</key>
                    <value>10-Jun-2015</value>
                </CustomProperty>
                <CustomProperty>
                    <key>END_DATE</key>
                    <value>09-Jun-2016</value>
                </CustomProperty>
                <CustomProperty>
                    <key>GRACE_PERIOD</key>
                    <value>23-Jun-2016</value>
                </CustomProperty>
            </CustomProperties>
        </LicenseKey>        
    </LicenseKeys>   
</License>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.